Files
poulpy/.github/workflows/ci.yml
2025-11-21 16:38:19 +01:00

79 lines
2.2 KiB
YAML

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rustfmt
- name: Cache cargo deps
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
# Detect whether runner supports AVX2 + FMA
- name: Detect AVX support
id: avxcheck
run: |
if lscpu | grep -qi avx2 && lscpu | grep -qi fma; then
echo "supported=true" >> $GITHUB_OUTPUT
else
echo "supported=false" >> $GITHUB_OUTPUT
fi
# rustfmt always runs — unrelated to AVX support
- name: rustfmt (check only)
run: cargo fmt --all --check
# Build / lint / test WITH AVX
- name: Build (AVX enabled)
if: steps.avxcheck.outputs.supported == 'true'
run: |
RUSTFLAGS="-C target-feature=+avx2,+fma" \
cargo build --workspace --all-targets --features enable-avx
- name: Clippy (AVX enabled)
if: steps.avxcheck.outputs.supported == 'true'
run: |
RUSTFLAGS="-C target-feature=+avx2,+fma" \
cargo clippy --workspace --all-targets --features enable-avx -- -D warnings
- name: Tests (AVX enabled)
if: steps.avxcheck.outputs.supported == 'true'
run: |
RUSTFLAGS="-C target-feature=+avx2,+fma" \
cargo test --workspace --features enable-avx
# Build / lint / test WITHOUT AVX
- name: Build (portable mode)
if: steps.avxcheck.outputs.supported == 'false'
run: cargo build --workspace --all-targets
- name: Clippy (portable mode)
if: steps.avxcheck.outputs.supported == 'false'
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Tests (portable mode)
if: steps.avxcheck.outputs.supported == 'false'
run: cargo test --workspace