Skip to content

Commit

Permalink
整理: workflow の冗長な記述を削除 (VOICEVOX#1286)
Browse files Browse the repository at this point in the history
* refactor: workflow の冗長な記述を削除

* refactor: `python -m pip` を `pip` へ単純化

* refactor: 環境変数設定をワンライナー化

* Apply suggestions from code review

---------

Co-authored-by: Hiroshiba <[email protected]>
  • Loading branch information
tarepan and Hiroshiba authored May 27, 2024
1 parent ed5906c commit c4f10e3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 31 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,16 @@ jobs:
uses: actions/checkout@v4

- name: <Setup> Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip

- name: <Setup> Install Python dependencies
run: |
pip install -r requirements.txt
run: pip install -r requirements.txt

- name: <Build> Make documents
run: |
PYTHONPATH=. python build_util/make_docs.py
run: PYTHONPATH=. python build_util/make_docs.py

- name: <Deploy> Deploy documents to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Expand Down
21 changes: 7 additions & 14 deletions .github/workflows/build-engine-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ jobs:
steps:
- name: <Setup> 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: <Setup> Check out the repository
uses: actions/checkout@v4
Expand All @@ -118,8 +117,7 @@ jobs:
# so you need to install GNU 'sed' and 'split'.
- name: <Setup> 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: <Setup> Install ONNX Runtime dependencies (Linux)
Expand Down Expand Up @@ -282,14 +280,13 @@ jobs:

# Python install path of windows: C:/hostedtoolcache/windows/Python
- name: <Setup> Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip

- name: <Setup> Install Python dependencies
run: python -m pip install -r requirements-dev.txt
run: pip install -r requirements-dev.txt

- name: <Setup> Prepare custom PyInstaller
if: startsWith(matrix.os, 'windows-')
Expand Down Expand Up @@ -550,21 +547,18 @@ jobs:
- name: <Setup> 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: <Build> 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: <Build> Rename artifact directory to archive
run: |
mv dist/run/ "${{ matrix.target }}/"
run: mv dist/run/ "${{ matrix.target }}/"

# 7z archives
- name: <Build> Create 7z archives
Expand Down Expand Up @@ -597,8 +591,7 @@ jobs:
commit: ${{ github.sha }}

- name: <Setup> 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: <Build> Create VVPP archives
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-engine-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ jobs:
cache: pip

- name: <Setup> Install Python dependencies
run: |
pip install -r requirements-test.txt
run: pip install -r requirements-test.txt

- name: <Setup> Declare variables
id: docker_vars
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-engine-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ jobs:
run: chmod +x dist/run

- name: <Setup> Install Python test dependencies
run: |
pip install -r requirements-test.txt
run: pip install -r requirements-test.txt

- name: <Test> Test ENGINE package
run: python build_util/check_release_build.py --dist_dir dist/
11 changes: 3 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: test
on:
push:
pull_request:
branches:
- "**"
workflow_dispatch:

defaults:
Expand Down Expand Up @@ -32,7 +30,7 @@ jobs:
cache: pip

- name: <Setup> Install Python dependencies
run: python -m pip install -r requirements-test.txt
run: pip install -r requirements-test.txt

- name: <Test> Validate poetry.lock
run: |
Expand Down Expand Up @@ -60,17 +58,15 @@ jobs:

- name: <Test> Test codes and coverage
run: coverage run --omit=test/* -m pytest

- name: <Deploy> Submit coverage results to Coveralls
if: matrix.os == 'ubuntu-20.04'
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: <Test> 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> Test names by checking typo
if: matrix.os == 'ubuntu-20.04'
Expand All @@ -94,4 +90,3 @@ jobs:
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint
shell: bash

0 comments on commit c4f10e3

Please sign in to comment.