name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: Format & clippy (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache
uses: Swatinem/rust-cache@v2
with:
key: lint-${{ matrix.os }}
- name: Format
if: runner.os == 'Linux' run: cargo fmt --all --check
- name: Clippy (warnings denied)
run: cargo clippy --all-targets -- -D warnings
test:
name: Test (${{ matrix.os }}, share ${{ matrix.shard }} of ${{ matrix.of }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, shard: 0, of: 6 }
- { os: ubuntu-latest, shard: 1, of: 6 }
- { os: ubuntu-latest, shard: 2, of: 6 }
- { os: ubuntu-latest, shard: 3, of: 6 }
- { os: ubuntu-latest, shard: 4, of: 6 }
- { os: ubuntu-latest, shard: 5, of: 6 }
- { os: windows-latest, shard: 0, of: 2 }
- { os: windows-latest, shard: 1, of: 2 }
- { os: macos-latest, shard: 0, of: 2 }
- { os: macos-latest, shard: 1, of: 2 }
steps:
- uses: actions/checkout@v7
- name: Install ARM cross compiler and QEMU
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-none-eabi binutils-arm-none-eabi clang qemu-system-arm
arm-none-eabi-gcc --version
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Cache
uses: Swatinem/rust-cache@v2
with:
key: test-${{ matrix.os }}
- name: Test
shell: bash
run: |
python scripts/ci_shard.py --shard ${{ matrix.shard }} --of ${{ matrix.of }} \
--record "test-times-${{ matrix.shard }}.tsv"
- name: Keep the test times
if: always() && runner.os == 'Linux'
uses: actions/upload-artifact@v7
with:
name: test-times-${{ matrix.shard }}
path: test-times-${{ matrix.shard }}.tsv
if-no-files-found: ignore
msrv:
name: MSRV (Rust 1.95)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install Rust 1.95 (declared MSRV)
uses: dtolnay/rust-toolchain@1.95
- name: Cache
uses: Swatinem/rust-cache@v2
with:
key: msrv
- name: cargo check --all-targets
run: cargo check --all-targets
binary:
name: Build binary (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aarch64-apple-darwin
os: macos-latest
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache
uses: Swatinem/rust-cache@v2
with:
key: binary-${{ matrix.target }}
- name: Build the cverif binary
run: cargo build --release --bin cverif --target ${{ matrix.target }}
- name: Smoke test
shell: bash
run: target/${{ matrix.target }}/release/cverif --version
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: cverif-${{ matrix.target }}
path: |
target/${{ matrix.target }}/release/cverif
target/${{ matrix.target }}/release/cverif.exe
if-no-files-found: error