From 6d95d4b9e086f56cfe963c1d4fb04f7c65a5c22b Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Sat, 7 Oct 2023 22:44:58 +0900 Subject: [PATCH] =?UTF-8?q?=E5=85=B1=E9=80=9A=E3=83=AF=E3=83=BC=E3=82=AF?= =?UTF-8?q?=E3=83=95=E3=83=AD=E3=83=BC=E3=82=92=E5=AE=9A=E7=BE=A9=E3=80=81?= =?UTF-8?q?super-linter=E3=82=92=E5=B0=8E=E5=85=A5=20(#5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/README.md | 4 ++++ .github/workflows/shared.yml | 19 +++++++++++++++ .github/workflows/super-linter.yml | 38 ++++++++++++++++++++++++++++++ .github/workflows/test.yml | 29 +++++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 .github/workflows/README.md create mode 100644 .github/workflows/shared.yml create mode 100644 .github/workflows/super-linter.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000..7fbd73a --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,4 @@ +# VOICEVOX .github Workflow README + +`shared.yml`は全 VOICEVOX リポジトリで共通するワークフローをまとめたものです。 +`test.yml`をコピペして使うことを想定しています。 diff --git a/.github/workflows/shared.yml b/.github/workflows/shared.yml new file mode 100644 index 0000000..4e23f60 --- /dev/null +++ b/.github/workflows/shared.yml @@ -0,0 +1,19 @@ +name: VOICEVOX Shared Workflow + +on: + workflow_call: + inputs: + super_linter_env_vars: + type: string + description: "super linter用の環境変数定義。複数行のenv_name=env_value" + +defaults: + run: + shell: bash + +jobs: + super-linter: + name: Super Linter + uses: VOICEVOX/.github/.github/workflows/super-linter.yml@main + with: + env_vars: ${{ inputs.super_linter_env_vars }} diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml new file mode 100644 index 0000000..23acd4c --- /dev/null +++ b/.github/workflows/super-linter.yml @@ -0,0 +1,38 @@ +# https://github.com/super-linter/super-linter/blob/main/TEMPLATES/linter.yml +--- +name: Super Linter + +on: + workflow_call: + inputs: + env_vars: + type: string + description: "env_name=env_value,..." + +jobs: + super-linter: + name: Super Linter + runs-on: ubuntu-latest + + permissions: + contents: read + packages: read + statuses: write + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # 差分を取得するために必要 + + - name: Setup Environment Variables + if: ${{ inputs.env_vars }} + run: for line in "${{ inputs.env_vars }}"; do echo "$line" >> $GITHUB_ENV; done + + - name: Lint Code Base + uses: super-linter/super-linter/slim@v5 + env: + VALIDATE_ALL_CODEBASE: true # すべてのファイルを検証する。 + VALIDATE_JSCPD: false # コピペ検出。厳しすぎるので無効化。 + VALIDATE_NATURAL_LANGUAGE: false # 自然言語検出。英語のみなので無効化。 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b4e5a70 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,29 @@ +name: Test VOICEVOX Shared Workflow + +on: + push: + pull_request: + +defaults: + run: + shell: bash + +jobs: + voicevox-shared-workflow: + uses: VOICEVOX/.github/.github/workflows/shared.yml@main + + # Super Linter に必要 + permissions: + contents: read + packages: read + statuses: write + + # Pythonの検証を無効化する例 + # with: + # super_linter_env_vars: | + # VALIDATE_PYTHON=false + # VALIDATE_PYTHON_BLACK=false + # VALIDATE_PYTHON_FLAKE8=false + # VALIDATE_PYTHON_ISORT=false + # VALIDATE_PYTHON_MYPY=false + # VALIDATE_PYTHON_PYLINT=false