diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 000000000..3f33a0fb7 --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -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 diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 46a506446..608f07e05 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -13,10 +13,16 @@ on: types: - published pull_request: + paths: + - build_util/** + - Cargo.* + - crates/voicevox_core** + - model/** + - rust-toolchain + - scripts/downloads/* push: - branches: - - "*" - - "**/*" + branches: + - main env: # releaseタグ名か、workflow_dispatchでのバージョン名か、'0.0.0'が入る VERSION: ${{ github.event.release.tag_name || github.event.inputs.version || '0.0.0' }} diff --git a/.github/workflows/build_cpp_example.yml b/.github/workflows/build_cpp_example.yml new file mode 100644 index 000000000..b1a1509f6 --- /dev/null +++ b/.github/workflows/build_cpp_example.yml @@ -0,0 +1,56 @@ +name: Build C++ example +on: + push: + branches: + - main + pull_request: + paths: + - 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/actions-setup-cmake@v1.13 + - 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 diff --git a/.github/workflows/cargo-deny.yml b/.github/workflows/cargo-deny.yml index 76c9e412d..5e5f4a45f 100644 --- a/.github/workflows/cargo-deny.yml +++ b/.github/workflows/cargo-deny.yml @@ -1,7 +1,13 @@ name: cargo-deny on: push: + branches: + - main pull_request: + paths: + - '**/Cargo.*' + - deny.toml + - rust-toolchain jobs: cargo-deny: runs-on: ubuntu-20.04 diff --git a/.github/workflows/generate_document.yml b/.github/workflows/generate_document.yml index ad52529e3..353d96617 100644 --- a/.github/workflows/generate_document.yml +++ b/.github/workflows/generate_document.yml @@ -4,6 +4,11 @@ on: branches: - main pull_request: + paths: + - 'Cargo.*' + - crates/voicevox_core** + - docs/** + - rust-toolchain jobs: generate_api_document: runs-on: ubuntu-latest diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 000000000..3dca32007 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed26b05c3..01734a1fd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,46 +1,14 @@ name: test workflow on: push: - 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: