CI #3644
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - "develop" | |
| - "feature/**" | |
| - "hotfix/**" | |
| paths-ignore: | |
| - "**.md" | |
| - "python/**" | |
| - "devtools/**" | |
| - ".github/workflows/pypi-publish.yml" | |
| - ".github/workflows/ci-devtools.yml" | |
| - ".github/workflows/deploy-devtools.yml" | |
| schedule: | |
| # UTC の 01:00 は JST だと 10:00 。 | |
| # 1-5 で 月曜日から金曜日 | |
| - cron: "0 1 * * 1-5" | |
| env: | |
| RUST_BACKTRACE: 1 | |
| CUDA_VERSION: 13.0.2 | |
| jobs: | |
| ci: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - run: rustup update stable | |
| - name: Install packages to build external dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y meson ninja-build nasm yasm build-essential autoconf automake libtool pkg-config yasm cmake libx11-dev libpulse-dev protobuf-compiler | |
| - uses: shiguredo/github-actions/.github/actions/rust-cache@main | |
| with: | |
| os: ubuntu-24.04 | |
| toolchain: stable | |
| - run: cargo fmt --all --check | |
| - run: cargo check --workspace | |
| - run: cargo clippy --workspace --all-targets -- --deny warnings | |
| - run: cargo check --workspace --no-default-features | |
| - run: cargo clippy --workspace --no-default-features -- --deny warnings | |
| - run: cargo test --workspace | |
| test-nvidia-video-codec: | |
| runs-on: | |
| group: Self | |
| labels: [self-hosted, linux, x64, NVIDIA-Video-Codec-SDK] | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install rustup | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| - name: Update PATH | |
| run: echo "PATH=$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV | |
| - name: Setup CUDA PATH | |
| run: | | |
| echo "CUDA_PATH=/usr/local/cuda" >> $GITHUB_ENV | |
| echo "/usr/local/cuda/bin" >> $GITHUB_PATH | |
| - run: cargo check --features nvcodec -p hisui | |
| - run: cargo clippy --features nvcodec -p hisui --all-targets -- --deny warnings | |
| - run: cargo test --features nvcodec -p hisui -- --test-threads=1 | |
| - run: cargo check --features candle,candle-cuda -p hisui | |
| - run: cargo clippy --features candle,candle-cuda -p hisui --all-targets -- --deny warnings | |
| - run: cargo test --features candle,candle-cuda -p hisui -- --test-threads=1 | |
| test-apple-toolbox: | |
| runs-on: | |
| group: Self | |
| labels: [self-hosted, macOS, ARM64] | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: 🍺 Set up Homebrew | |
| uses: Homebrew/actions/setup-homebrew@5037c6f1012cc5ea0b9f03fedbaf9955ed9e51e0 # master | |
| - name: Install rustup | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| - name: Update PATH | |
| run: echo "PATH=$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV | |
| - name: Install packages to build external dependencies | |
| run: | | |
| brew update | |
| brew install meson ninja nasm yasm cmake automake autoconf libtool pkg-config protobuf | |
| - run: cargo check --workspace | |
| - run: cargo clippy --workspace --all-targets -- --deny warnings | |
| - run: cargo test --workspace | |
| - run: cargo check --features candle,candle-metal -p hisui | |
| - run: cargo clippy --features candle,candle-metal -p hisui --all-targets -- --deny warnings | |
| - run: cargo test --features candle,candle-metal -p hisui | |
| test-fdk-aac: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| env: | |
| HISUI_FDK_AAC_PATH: /usr/lib/x86_64-linux-gnu/libfdk-aac.so | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - run: rustup update stable | |
| - name: Install packages to build external dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y meson ninja-build nasm yasm build-essential autoconf automake libtool pkg-config yasm cmake libx11-dev libpulse-dev libfdk-aac-dev | |
| - uses: shiguredo/github-actions/.github/actions/rust-cache@main | |
| with: | |
| os: ubuntu-24.04 | |
| toolchain: stable | |
| - run: cargo test --features fdk-aac | |
| test-openh264: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| env: | |
| OPENH264_VERSION: "2.6.0" | |
| OPENH264_PATH: ${{ github.workspace }}/libopenh264.so | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - run: rustup update stable | |
| - name: Install packages to build external dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y meson ninja-build nasm yasm build-essential autoconf automake libtool pkg-config yasm cmake libx11-dev libpulse-dev | |
| - uses: shiguredo/github-actions/.github/actions/rust-cache@main | |
| with: | |
| os: ubuntu-24.04 | |
| toolchain: stable | |
| - name: Download libopenh264 v${{ env.OPENH264_VERSION }} | |
| run: | | |
| OPENH264_ARCHIVE="libopenh264-${OPENH264_VERSION}-linux64.8.so.bz2" | |
| OPENH264_URL="https://ciscobinary.openh264.org/${OPENH264_ARCHIVE}" | |
| echo "Downloading ${OPENH264_URL}" | |
| curl -fL -o "${OPENH264_ARCHIVE}" "${OPENH264_URL}" | |
| bzip2 -d "${OPENH264_ARCHIVE}" | |
| mv "libopenh264-${OPENH264_VERSION}-linux64.8.so" "${OPENH264_PATH}" | |
| - run: cargo test -p hisui | |
| test-candle: | |
| # 本 job は candle feature 有効ビルドの妥当性と、Silero VAD / Whisper の integration テスト | |
| # (実モデルロード + 実推論 + エラーパス) を検証する。 | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| env: | |
| # integration テストが参照するモデル配置ディレクトリ (絶対パスで指定)。 | |
| HISUI_ML_MODELS_DIR: ${{ github.workspace }}/ml-models | |
| # CI では integration テストの silent skip を無効化し、モデル不在なら panic で退行を検知させる。 | |
| HISUI_CI: "1" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - run: rustup update stable | |
| - name: Install packages to build external dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y meson ninja-build nasm yasm build-essential autoconf automake libtool pkg-config cmake libx11-dev libpulse-dev protobuf-compiler | |
| - uses: shiguredo/github-actions/.github/actions/rust-cache@main | |
| with: | |
| os: ubuntu-24.04 | |
| toolchain: stable | |
| - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | |
| - name: Cache Silero VAD ONNX model | |
| # scripts/download_ml_models.py の TARGETS["silero-vad"][0].expected_sha256 と同じ値を key にする。 | |
| # SHA256 が更新されたら key ミスマッチで再取得される (script 側と手動同期する)。 | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ml-models/silero-vad | |
| key: silero-vad-a4a068cd6cf1ea8355b84327595838ca748ec29a25bc91fc82e6c299ccdc5808 | |
| - name: Cache Whisper tiny model | |
| # scripts/download_ml_models.py の TARGETS["whisper-tiny"][2].expected_sha256 と同じ値を key にする。 | |
| # config / tokenizer だけの更新を無効化したいときは key にサフィックスを足して運用する。 | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ml-models/whisper-tiny | |
| key: whisper-tiny-7ebd0e69e78190ffe1438491fa05cc1f5c1aa3a4c4db3bc1723adbb551ea2395 | |
| - name: Download Silero VAD ONNX model | |
| run: uv run scripts/download_ml_models.py --dest ml-models/ silero-vad | |
| - name: Download Whisper tiny model | |
| run: uv run scripts/download_ml_models.py --dest ml-models/ whisper-tiny | |
| - run: cargo clippy --features candle --all-targets -p hisui -- --deny warnings | |
| # candle は既定でホストの物理コア数まで並列化するため、テストを並列実行するとコアを奪い合って | |
| # 各推論が極端に遅くなり、テスト内のタイムアウトに達する。CI では直列実行に切り替える。 | |
| # (実運用でスレッド数を絞る場合は RAYON_NUM_THREADS を設定する。) | |
| - run: cargo test --features candle -p hisui -- --test-threads=1 | |
| test-fuzz: | |
| # libFuzzer ベースの fuzz target がビルド + 短時間実行で動くことだけ確認するジョブ | |
| # NOTE: fuzz バイナリの main が protobuf compiler の PluginMain に乗っ取られて | |
| # libFuzzer のフラグを処理できない問題を調査中のため一時無効化している。 | |
| if: false | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - run: rustup toolchain install nightly --profile minimal | |
| - name: Install packages to build external dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y meson ninja-build nasm yasm build-essential autoconf automake libtool pkg-config yasm cmake libx11-dev libpulse-dev | |
| - uses: shiguredo/github-actions/.github/actions/rust-cache@main | |
| with: | |
| os: ubuntu-24.04 | |
| toolchain: nightly | |
| - name: Install cargo-fuzz | |
| run: cargo install cargo-fuzz --locked | |
| - name: Run fuzz_h264_sample_entry briefly | |
| run: cargo +nightly fuzz run fuzz_h264_sample_entry -- -max_total_time=30 | |
| ubuntu-binary: | |
| name: "Upload Binary for Ubuntu" | |
| needs: [ci] | |
| strategy: | |
| matrix: | |
| platform: | |
| - name: ubuntu-24.04_x86_64 | |
| runs-on: ubuntu-24.04 | |
| # TODO: webrtc-rs が ubuntu-24.04 arm64 をサポートしたら ubuntu-24.04_arm64 を復帰する | |
| # - name: ubuntu-24.04_arm64 | |
| # runs-on: ubuntu-24.04-arm | |
| - name: ubuntu-22.04_x86_64 | |
| runs-on: ubuntu-22.04 | |
| # TODO: webrtc-rs が ubuntu-22.04 arm64 をサポートしたら ubuntu-22.04_arm64 を復帰する | |
| # - name: ubuntu-22.04_arm64 | |
| # runs-on: ubuntu-22.04-arm | |
| runs-on: ${{ matrix.platform.runs-on }} | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install packages to build external dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y meson ninja-build nasm yasm build-essential autoconf automake libtool pkg-config yasm cmake libx11-dev libpulse-dev libfdk-aac-dev | |
| # CUDA のインストール (x86_64 のみ) | |
| - uses: shiguredo/github-actions/.github/actions/setup-cuda-toolkit@main | |
| if: contains(matrix.platform.name, 'x86_64') | |
| id: cuda | |
| with: | |
| cuda_version: ${{ env.CUDA_VERSION }} | |
| platform: ${{ matrix.platform.runs-on }} | |
| - run: rustup update stable | |
| - uses: shiguredo/github-actions/.github/actions/rust-cache@main | |
| with: | |
| os: ${{ matrix.platform.runs-on }} | |
| toolchain: stable | |
| # x86_64 では nvcodec と fdk-aac feature を有効化 | |
| - name: Build with NVCODEC and FDK-AAC (x86_64) | |
| if: contains(matrix.platform.name, 'x86_64') | |
| run: cargo build --release --features nvcodec,fdk-aac | |
| # ARM では fdk-aac のみ有効化 | |
| - name: Build with FDK-AAC (ARM) | |
| if: contains(matrix.platform.name, 'arm64') | |
| run: cargo build --release --features fdk-aac | |
| - name: Get the version | |
| id: get_version | |
| run: | | |
| VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "hisui") | .version') | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| - run: | | |
| mkdir -p hisui-${{ steps.get_version.outputs.version }}_${{ matrix.platform.name }} | |
| cp target/release/hisui hisui-${{ steps.get_version.outputs.version }}_${{ matrix.platform.name }}/ | |
| tar -czf hisui-${{ steps.get_version.outputs.version }}_${{ matrix.platform.name }}.tar.gz \ | |
| hisui-${{ steps.get_version.outputs.version }}_${{ matrix.platform.name }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: hisui-binary-${{ matrix.platform.name }} | |
| path: hisui-${{ steps.get_version.outputs.version }}_${{ matrix.platform.name }}.tar.gz | |
| macos-binary: | |
| name: "Upload Binary for MacOS" | |
| needs: [test-apple-toolbox] | |
| strategy: | |
| matrix: | |
| platform: | |
| - name: macos-26_arm64 | |
| runs-on: macos-26 | |
| - name: macos-15_arm64 | |
| runs-on: macos-15 | |
| - name: macos-14_arm64 | |
| runs-on: macos-14 | |
| runs-on: ${{ matrix.platform.runs-on }} | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Get the version | |
| id: get_version | |
| run: | | |
| VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "hisui") | .version') | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| - run: rustup update stable | |
| - name: Install packages to build external dependencies | |
| run: | | |
| brew update | |
| brew install meson nasm yasm automake autoconf libtool pkg-config | |
| - uses: shiguredo/github-actions/.github/actions/rust-cache@main | |
| with: | |
| os: ${{ matrix.platform.runs-on }} | |
| toolchain: stable | |
| - run: cargo build --release | |
| - run: | | |
| mkdir -p hisui-${{ steps.get_version.outputs.version }}_${{ matrix.platform.name }} | |
| cp target/release/hisui hisui-${{ steps.get_version.outputs.version }}_${{ matrix.platform.name }}/ | |
| tar -czf hisui-${{ steps.get_version.outputs.version }}_${{ matrix.platform.name }}.tar.gz \ | |
| hisui-${{ steps.get_version.outputs.version }}_${{ matrix.platform.name }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: hisui-binary-${{ matrix.platform.name }} | |
| path: hisui-${{ steps.get_version.outputs.version }}_${{ matrix.platform.name }}.tar.gz | |
| slack_notify: | |
| needs: | |
| - ci | |
| - test-nvidia-video-codec | |
| - test-apple-toolbox | |
| - test-fdk-aac | |
| - test-openh264 | |
| - test-candle | |
| - test-fuzz | |
| - ubuntu-binary | |
| - macos-binary | |
| permissions: | |
| actions: read | |
| timeout-minutes: 20 | |
| runs-on: ubuntu-slim | |
| if: always() | |
| steps: | |
| - name: Slack Notification | |
| uses: shiguredo/github-actions/.github/actions/slack-notify@main | |
| with: | |
| status: ${{ job.status }} | |
| slack_webhook: ${{ secrets.SLACK_WEBHOOK }} | |
| slack_channel: hisui | |
| notify_mode: failure_and_fixed | |
| env: | |
| GH_TOKEN: ${{ github.token }} |