name: CI
on:
push:
branches:
- main
- 'feature/**'
- 'refactor/**'
- 'fix/**'
- beta
tags:
- "v*"
- "[0-9]*"
- "*"
pull_request:
branches:
- main
- 'feature/**'
- 'refactor/**'
- 'fix/**'
- beta
schedule:
- cron: "0 3 * * 1"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
RUSTFLAGS: -C link-dead-code
jobs:
typos:
name: Typos
runs-on: ubuntu-latest
if: github.event_name != 'schedule'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Run typos
uses: crate-ci/typos@v1.46.2
security:
name: Security (cargo-audit)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2.9.1
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run cargo-audit
run: cargo audit
build-linux:
name: Build Linux (${{ matrix.toolchain }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [ stable, beta, nightly ]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master with:
toolchain: ${{ matrix.toolchain }}
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2.9.1
- name: Build all crates
run: cargo build --verbose --workspace --exclude rustfs-erasure-codec-fuzz
build-windows-native:
name: Build Windows Native (${{ matrix.toolchain }})
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
toolchain: [ stable, beta, nightly ]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master with:
toolchain: ${{ matrix.toolchain }}
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2.9.1
- name: Build all crates
run: cargo build --verbose --workspace --exclude rustfs-erasure-codec-fuzz
build-windows-gnu-targets:
name: Build Windows GNU Target (${{ matrix.toolchain }}, ${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [ stable, beta, nightly ]
target: [ i686-pc-windows-gnu, x86_64-pc-windows-gnu ]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust with target
uses: dtolnay/rust-toolchain@master with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
- name: Install MinGW cross toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2.9.1
- name: Check target build (default features)
run: cargo check --verbose --workspace --exclude rustfs-erasure-codec-fuzz --target ${{ matrix.target }}
- name: Check target build (no default features)
run: cargo check --verbose --workspace --exclude rustfs-erasure-codec-fuzz --target ${{ matrix.target }} --no-default-features
- name: Check target build (simd-accel)
run: cargo check --verbose --workspace --exclude rustfs-erasure-codec-fuzz --target ${{ matrix.target }} --features simd-accel
test-linux:
name: Test Linux (${{ matrix.toolchain }})
runs-on: ubuntu-latest
timeout-minutes: 30
env:
QUICKCHECK_TESTS: 4
QUICKCHECK_GENERATOR_SIZE: 32
strategy:
fail-fast: false
matrix:
toolchain: [ stable, beta, nightly ]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master with:
toolchain: ${{ matrix.toolchain }}
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2.9.1
- name: Test no_std
run: cargo test --verbose --workspace --exclude rustfs-erasure-codec-fuzz --no-default-features
- name: Test std + simd
run: cargo test --verbose --workspace --exclude rustfs-erasure-codec-fuzz --features simd-accel
test-linux-aarch64:
name: Test Linux ARM64 (${{ matrix.toolchain }})
runs-on: ubuntu-24.04-arm
timeout-minutes: 30
env:
QUICKCHECK_TESTS: 4
QUICKCHECK_GENERATOR_SIZE: 32
strategy:
fail-fast: false
matrix:
toolchain: [ stable ]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master with:
toolchain: ${{ matrix.toolchain }}
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2.9.1
- name: Test no_std
run: cargo test --verbose --workspace --exclude rustfs-erasure-codec-fuzz --no-default-features
- name: Test std + simd
run: cargo test --verbose --workspace --exclude rustfs-erasure-codec-fuzz --features simd-accel
test-windows-native:
name: Test Windows Native (${{ matrix.toolchain }})
runs-on: windows-latest
timeout-minutes: 30
env:
QUICKCHECK_TESTS: 4
QUICKCHECK_GENERATOR_SIZE: 32
strategy:
fail-fast: false
matrix:
toolchain: [ stable, beta, nightly ]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master with:
toolchain: ${{ matrix.toolchain }}
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2.9.1
- name: Test all crates
run: cargo test --verbose --workspace --exclude rustfs-erasure-codec-fuzz
test-macos-arm64:
name: Test macOS ARM64 (${{ matrix.toolchain }})
runs-on: macos-latest
timeout-minutes: 30
env:
QUICKCHECK_TESTS: 4
QUICKCHECK_GENERATOR_SIZE: 32
strategy:
fail-fast: false
matrix:
toolchain: [ stable ]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master with:
toolchain: ${{ matrix.toolchain }}
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2.9.1
- name: Test no_std
run: cargo test --verbose --workspace --exclude rustfs-erasure-codec-fuzz --no-default-features
- name: Test std + simd
run: cargo test --verbose --workspace --exclude rustfs-erasure-codec-fuzz --features simd-accel
release-preflight:
name: Release preflight
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs:
- typos
- security
- build-linux
- build-windows-native
- build-windows-gnu-targets
- test-linux
- test-linux-aarch64
- test-windows-native
- test-macos-arm64
env:
RUN_X86_SIMD_OVERRIDE_MATRIX: 1
RUN_AARCH64_SIMD_OVERRIDE_MATRIX: 1
RSE_SMOKE_BASELINE: ${{ vars.RSE_SMOKE_BASELINE }}
RSE_SMALL_FILE_BASELINE: ${{ vars.RSE_SMALL_FILE_BASELINE }}
RSE_RECONSTRUCTION_HOTSPOT_BASELINE: ${{ vars.RSE_RECONSTRUCTION_HOTSPOT_BASELINE }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master with:
toolchain: stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2.9.1
- name: Release preflight checks
run: |
if [[ -n "${RSE_SMOKE_BASELINE:-}" && -n "${RSE_SMALL_FILE_BASELINE:-}" && -n "${RSE_RECONSTRUCTION_HOTSPOT_BASELINE:-}" ]]; then
export VALIDATION_PROFILE=release
else
echo "[ci] baseline files are not fully configured, run release preflight in extended profile"
export VALIDATION_PROFILE=extended
fi
bash scripts/release-check.sh
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs:
- release-preflight
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master with:
toolchain: stable
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2.9.1
- name: Verify package
run: cargo package --allow-dirty --no-verify
- name: Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --registry crates-io --package rustfs-erasure-codec --allow-dirty