Skip to content

Commit 73628df

Browse files
authored
add AVX2/NEON matrix builds with caching (#46)
* CI: AVX2/AVX‑512/NEON でのビルド・テストを追加 (vibe-kanban 4c682469) branche name: feat/multi_arch_ci ## 背景 - 本ワークスペースの SIMD 最適化(AVX2/AVX‑512/NEON)コードパスの劣化検知が必要 。 - GitHub ホストランナーは AVX‑512 を保証せず、ARM64 も環境により未提供のため、実行戦略を分離。 - AVX2: x86_64 ランナーでビルド+テストを実行。 - AVX‑512: x86_64 ランナーでは未対応の可能性が高く、ビルドのみで担保。 - NEON: ARM64 ランナー(例: `ubuntu-24.04-arm64` または `self-hosted, Linux, ARM64`)でビルド+テストを実行。 ## スコープ - `.github/workflows/rust.yml` の Build & Test を CPU 機能マトリクス化。 - x86_64/AVX2 は実行テストまで、x86_64/AVX‑512 はビルドのみ、ARM64/NEON は実行テストまで。 - 既存の Clippy/Fmt ジョブは維持。 - すべて nightly、`Swatinem/rust-cache@v2`、`RUST_BACKTRACE=1` を適用。 ## 受け入れ条件 - Push/PR で以下が動作: - x64/AVX2: リリースビルド+テストが成功。 - x64/AVX‑512: リリースビルドが成功(テストはスキップ)。 - ARM64/NEON: リリースビルド+テストが成功(ARM64 ランナーが利用可能な場合)。 - Clippy/Fmt は従来通り、警告・未整形で CI が失敗。 - 2 回目以降の実行でビルドキャッシュが効く。 ## 注意点 - AVX‑512 はホストランナーで未対応の可能性が高く、テスト実行は SIGILL 回避のためスキップ。 - ARM64 ランナーが未提供の場合は NEON 行を一時的にコメントアウト、または `self-hosted` ラベル運用に切替。 - 実行テストは `is_x86_feature_detected!` や `cfg(target_feature)` で条件化し、誤実行を防止。 ## 提案する rust.yml(差し替え案) ```yaml name: Rust CI on: push: branches: [ "main" ] pull_request: branches: [ "main" ] workflow_dispatch: permissions: contents: read concurrency: group: rust-ci-${{ github.ref }} cancel-in-progress: true env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 jobs: build-test-matrix: name: Build & Test (${{ matrix.name }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - name: x64-avx2 os: ubuntu-latest rustflags: -C target-cpu=haswell run_tests: true - name: x64-avx512-build os: ubuntu-latest rustflags: -C target-cpu=skylake-avx512 run_tests: false # build only to avoid SIGILL - name: arm64-neon # 利用可能な場合は GitHub ホスト ARM64 ランナーに置換 # 例: ubuntu-24.04-arm64(組織設定依存) # 未提供時は self-hosted を使用: [self-hosted, Linux, ARM64] os: ubuntu-24.04-arm64 rustflags: -C target-feature=+neon run_tests: true steps: - uses: actions/checkout@v4 - name: Install nightly toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: nightly - name: Cache cargo build uses: Swatinem/rust-cache@v2 - name: Build (release) run: cargo build --workspace --release --verbose env: RUSTFLAGS: ${{ matrix.rustflags }} - name: Test (release) if: ${{ matrix.run_tests == true }} run: cargo test --workspace --release --verbose env: RUSTFLAGS: ${{ matrix.rustflags }} clippy: runs-on: ubuntu-latest name: Clippy steps: - uses: actions/checkout@v4 - name: Install nightly toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: nightly components: clippy - name: Cache cargo build uses: Swatinem/rust-cache@v2 - name: Clippy (deny warnings) run: cargo clippy --workspace --all-targets --all-features -- -D warning s fmt: runs-on: ubuntu-latest name: Rustfmt steps: - uses: actions/checkout@v4 - name: Install nightly toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: nightly components: rustfmt - name: Cache cargo build uses: Swatinem/rust-cache@v2 - name: Check formatting run: cargo fmt --all -- --check ``` * delete unsupported machine * test neon * Enable AVX2 tests in CI workflow by uncommenting the x64-avx2 configuration in rust.yml * Refactor CI workflow: Rename jobs for clarity and update step names in rust.yml * Update Clippy command in CI workflow to use a more concise flag format in rust.yml * Refactor CI workflow: Simplify build and test steps in rust.yml by removing workspace flag
1 parent 7c10274 commit 73628df

File tree

1 file changed

+41
-12
lines changed

1 file changed

+41
-12
lines changed

.github/workflows/rust.yml

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,82 @@ name: Rust
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches: [ "main" ]
66
pull_request:
7-
branches: ["main"]
7+
branches: [ "main" ]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: rust-ci-${{ github.ref }}
15+
cancel-in-progress: true
816

917
env:
1018
CARGO_TERM_COLOR: always
19+
RUST_BACKTRACE: 1
1120

1221
jobs:
13-
build:
14-
runs-on: ubuntu-latest
15-
name: Build & Test
16-
22+
build-test-matrix:
23+
name: Build & Test (${{ matrix.name }})
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
- name: x64-avx2
30+
os: ubuntu-latest
31+
rustflags: -C target-cpu=haswell
32+
run_tests: true
33+
- name: arm64-neon
34+
os: ubuntu-24.04-arm64
35+
rustflags: -C target-feature=+neon
36+
run_tests: true
1737
steps:
1838
- uses: actions/checkout@v4
1939
- name: Install nightly toolchain
2040
uses: actions-rust-lang/setup-rust-toolchain@v1
2141
with:
2242
toolchain: nightly
43+
- name: Cache cargo build
44+
uses: Swatinem/rust-cache@v2
2345
- name: Build
2446
run: cargo build --release --verbose
25-
- name: Run tests
47+
env:
48+
RUSTFLAGS: ${{ matrix.rustflags }}
49+
- name: Test
50+
if: ${{ matrix.run_tests == true }}
2651
run: cargo test --release --verbose
52+
env:
53+
RUSTFLAGS: ${{ matrix.rustflags }}
2754

2855
cargo-clippy:
2956
runs-on: ubuntu-latest
3057
name: Clippy
31-
3258
steps:
3359
- uses: actions/checkout@v4
3460
- name: Install nightly toolchain
3561
uses: actions-rust-lang/setup-rust-toolchain@v1
3662
with:
3763
toolchain: nightly
3864
components: clippy
65+
- name: Cache cargo build
66+
uses: Swatinem/rust-cache@v2
3967
- name: Clippy Check
4068
run: cargo clippy --workspace --all-targets -- -Dwarnings
4169

4270
cargo-fmt:
43-
name: Cargo fmt
4471
runs-on: ubuntu-latest
45-
72+
name: Rustfmt Check
4673
steps:
4774
- uses: actions/checkout@v4
4875
- name: Install nightly toolchain
4976
uses: actions-rust-lang/setup-rust-toolchain@v1
5077
with:
5178
toolchain: nightly
5279
components: rustfmt
53-
- name: Rustfmt Check
54-
run: cargo fmt --all --check
80+
- name: Cache cargo build
81+
uses: Swatinem/rust-cache@v2
82+
- name: Check formatting
83+
run: cargo fmt --all -- --check

0 commit comments

Comments
 (0)