CI #4358
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: | |
pull_request: | |
branches: [main] | |
schedule: | |
# runs 1 min after 2 or 1 AM (summer/winter) berlin time | |
- cron: "1 0 * * *" | |
merge_group: | |
env: | |
CARGO_TERM_COLOR: always | |
NO_STD_TARGET: thumbv7em-none-eabi # firmware uses atomics | |
QEMU_TARGET: thumbv7m-none-eabi | |
jobs: | |
host: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macOS-latest | |
- windows-latest | |
toolchain: | |
- "stable" | |
- "1.81" # host MSRV | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Rust version | |
uses: ./.github/actions/update-rust | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Install C libraries for tooling on ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get update && sudo apt-get install libudev-dev libusb-1.0-0-dev | |
- name: Check that all crates that can be compiled for the host build, check that defmt compiles with different features, run all unit tests on the host | |
run: cargo xtask -d test-host ${{ matrix.toolchain == '1.81' && '--skip-ui-tests' || '' }} | |
cross: | |
strategy: | |
matrix: | |
toolchain: | |
- "stable" | |
- "1.76" # firmware MSRV | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Rust version | |
uses: ./.github/actions/update-rust | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Install Rust targets, build defmt crates for no_std targets, build defmt dependent crates for cortex-m targets, build panic-probe with different features | |
run: cargo xtask test-cross | |
lint-cross: | |
strategy: | |
matrix: | |
toolchain: | |
- "1.87" # we pin clippy because it keeps adding new lints | |
- "1.76" # firmware MSRV | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Rust version | |
uses: ./.github/actions/update-rust | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Install Rust targets, lint defmt crates for no_std targets | |
run: cargo xtask test-lint-cross | |
cargo-deny: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
checks: | |
- advisories | |
- bans licenses sources | |
# Prevent sudden announcement of a new advisory from failing ci: | |
continue-on-error: ${{ matrix.checks == 'advisories' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: EmbarkStudios/cargo-deny-action@v2 | |
with: | |
command: check ${{ matrix.checks }} | |
rust-version: stable | |
lint: | |
strategy: | |
matrix: | |
toolchain: | |
- "1.87" # we pin clippy because it keeps adding new lints | |
- "1.81" # host MSRV | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Rust version | |
uses: ./.github/actions/update-rust | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Run rustfmt & clippy | |
run: cargo xtask test-lint | |
ui: | |
strategy: | |
matrix: | |
toolchain: | |
- "stable" | |
- "1.81" # host MSRV | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Rust version | |
uses: ./.github/actions/update-rust | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Install Rust stable, run all UI tests on the host | |
run: cargo xtask test-ui | |
mdbook: | |
strategy: | |
matrix: | |
toolchain: | |
- "stable" | |
- "1.81" # host MSRV | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Rust version | |
uses: ./.github/actions/update-rust | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Setup mdBook | |
uses: peaceiris/actions-mdbook@v1 | |
with: | |
mdbook-version: latest | |
- name: Run book tests | |
run: cargo xtask test-book | |
qemu-snapshot: | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
- "1.81" # host MSRV | |
- nightly-2025-08-05 # some tests use unstable features, but avoid LLVM21 due to https://github.com/rust-lang/rust/issues/146065 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use the latest ${{ matrix.toolchain }} release | |
uses: ./.github/actions/update-rust | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Install QEMU_TARGET | |
run: rustup target add ${{ env.QEMU_TARGET }} | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install qemu-system-arm | |
- name: Run QEMU snapshot tests | |
run: cargo xtask test-snapshot | |
backcompat: | |
strategy: | |
matrix: | |
toolchain: | |
- "stable" | |
- "1.81" # host MSRV | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set Rust version | |
uses: ./.github/actions/update-rust | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Install QEMU_TARGET | |
run: rustup target add ${{ env.QEMU_TARGET }} | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install qemu-system-arm | |
- name: Run backward compatibility test | |
run: cargo xtask test-backcompat | |
ci-success: | |
name: CI finished successfully | |
runs-on: ubuntu-latest | |
if: success() | |
needs: | |
- host | |
- cross | |
- cargo-deny | |
- lint | |
- ui | |
- mdbook | |
- qemu-snapshot | |
- backcompat | |
steps: | |
- name: Mark the build as successful | |
run: exit 0 |