Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR時に走るworkflowの数を減らす #382

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: shellcheck
on:
push:
branches:
- main
pull_request:
paths:
- .github/workflows/**
- .github/actions/**/*

jobs:
actionlint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
# ShellCheckとPyflakesをインストールしておくと、shell: bashとshell: pythonのコードを検査してくれるようになる
#
# 参考:
# - https://github.com/rhysd/actionlint/blob/main/docs/checks.md#shellcheck-integration-for-run
# - https://github.com/rhysd/actionlint/blob/main/docs/checks.md#pyflakes-integration-for-run
- name: Update ShellCheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install Pyflakes
run: pip install 'pyflakes>3,<4'
- name: actionlint
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color
12 changes: 9 additions & 3 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ on:
types:
- published
pull_request:
paths:
- build_util/**
Comment on lines +16 to +17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参考: #345

Suggested change
paths:
- build_util/**
paths:
- .github/workflows/build_and_deploy.yml
- build_util/**

- Cargo.*
- crates/voicevox_core**
- model/**
- rust-toolchain
- scripts/downloads/*
push:
branches:
- "*"
- "**/*"
branches:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
branches:
branches:

- main
env:
# releaseタグ名か、workflow_dispatchでのバージョン名か、'0.0.0'が入る
VERSION: ${{ github.event.release.tag_name || github.event.inputs.version || '0.0.0' }}
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/build_cpp_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build C++ example
on:
push:
branches:
- main
pull_request:
paths:
- crates/voicevox_core**
Comment on lines +7 to +8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
paths:
- crates/voicevox_core**
paths:
- .github/workflows/build_cpp_example.yml
- crates/voicevox_core**

- '!crates/voicevox_core_python_api/**'
- model/**
- example/cpp/unix/**

jobs:
build-unix-cpp-example:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
artifact_name: osx-x64-cpu-cpp-shared
- os: ubuntu-latest
artifact_name: linux-x64-cpu-cpp-shared
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: ./.github/actions/rust-toolchain-from-file
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install cbindgen
uses: ./.github/actions/cargo-binstall-cbindgen
- name: build voicevox_core_c_api
run: cargo build -p voicevox_core_c_api -vv
- name: voicevox_core.hを生成
run: cbindgen --crate voicevox_core_c_api -o ./example/cpp/unix/voicevox_core/voicevox_core.h
- name: 必要なfileをunix用exampleのディレクトリに移動させる
run: |
mkdir -p example/cpp/unix/voicevox_core/
cp -v target/debug/libvoicevox_core.{so,dylib} example/cpp/unix/voicevox_core/ || true
cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.so.* example/cpp/unix/voicevox_core/ || true
cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.*.dylib example/cpp/unix/voicevox_core/ || true

- if: startsWith(matrix.os, 'mac')
uses: jwlawson/[email protected]
- name: Install build dependencies
if: startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y cmake
- name: Build
shell: bash
run: |
cd example/cpp/unix
cmake -S . -B build
cmake --build build
6 changes: 6 additions & 0 deletions .github/workflows/cargo-deny.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
name: cargo-deny
on:
push:
branches:
- main
pull_request:
paths:
- '**/Cargo.*'
- deny.toml
Comment on lines +7 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
paths:
- '**/Cargo.*'
- deny.toml
paths:
- '**/Cargo.*'
- .github/workflows/cargo-deny.yml
- deny.toml

- rust-toolchain
jobs:
cargo-deny:
runs-on: ubuntu-20.04
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/generate_document.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
branches:
- main
pull_request:
paths:
- 'Cargo.*'
- crates/voicevox_core**
Comment on lines +8 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 'Cargo.*'
- crates/voicevox_core**
- 'Cargo.*'
- .github/workflows/generate_document.yml
- crates/voicevox_core**

- docs/**
- rust-toolchain
jobs:
generate_api_document:
runs-on: ubuntu-latest
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: shellcheck
on:
push:
branches:
- main
pull_request:
paths:
- '**.sh'
- '**.bash'
jobs:
shellcheck:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Update ShellCheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: ShellCheck
run: git ls-files | grep -E '\.(ba)?sh' | xargs shellcheck
44 changes: 6 additions & 38 deletions .github/workflows/test.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build_cpp_example.ymlに分離したbuild-unix-cpp-exampleがまだ残っています。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

指摘ありがとうございます!

昨日の時点で気づいてはいて、ローカルでは直しています。あとで他の変更と一緒にまとめてpushするつもりでした

Original file line number Diff line number Diff line change
@@ -1,46 +1,14 @@
name: test workflow
on:
push:
branches:
- "*"
- "**/*"
branches:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
branches:
branches:

- main
pull_request:
paths:
- crates/**
- Cargo.*
- rust-toolchain
jobs:
shellcheck:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Update ShellCheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: ShellCheck
run: git ls-files | grep -E '\.(ba)?sh' | xargs shellcheck

actionlint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
# ShellCheckとPyflakesをインストールしておくと、shell: bashとshell: pythonのコードを検査してくれるようになる
#
# 参考:
# - https://github.com/rhysd/actionlint/blob/main/docs/checks.md#shellcheck-integration-for-run
# - https://github.com/rhysd/actionlint/blob/main/docs/checks.md#pyflakes-integration-for-run
- name: Update ShellCheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install Pyflakes
run: pip install 'pyflakes>3,<4'
- name: actionlint
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color

validate-cargo-lock:
runs-on: ubuntu-22.04
steps:
Expand Down