Skip to content

Re-write CI to use cargo-rbmt #459

Re-write CI to use cargo-rbmt

Re-write CI to use cargo-rbmt #459

Workflow file for this run

on: [push, pull_request]
name: Continuous Integration
permissions: {}
jobs:
Prepare:
runs-on: ubuntu-24.04
permissions:
contents: read
outputs:
nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }}
maintainer_tools_version: ${{ steps.read_toolchain.outputs.maintainer_tools_version }}
steps:
- name: "Checkout repo"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Read workspace versions"
id: read_toolchain
run: |
echo "nightly_version=$(cat nightly-version)" >> $GITHUB_OUTPUT
echo "maintainer_tools_version=$(cat maintainer-tools-version)" >> $GITHUB_OUTPUT
Stable: # 2 jobs, one per manifest.
name: Test - stable toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [minimal, recent]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: stable
- name: "Run tests"
run: cargo rbmt test stable --lock-file ${{ matrix.dep }}
Nightly: # 2 jobs, one per manifest.
name: Test - nightly toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [minimal, recent]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: nightly
- name: "Run tests"
run: cargo rbmt test nightly --lock-file ${{ matrix.dep }}
MSRV: # 2 jobs, one per manifest.
name: Test - MSRV toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [minimal, recent]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: "1.56.1"
- name: "Run tests"
run: cargo rbmt test msrv --lock-file ${{ matrix.dep }}
Lint:
name: Lint - nightly toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: nightly
components: clippy
- name: "Run lint"
run: cargo rbmt lint
Docs:
name: Docs - stable toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: stable
- name: "Build docs"
run: cargo rbmt docs
Docsrs:
name: Docs - nightly toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: nightly
- name: "Build docs.rs docs"
run: cargo rbmt docsrs
Bench:
name: Bench - nightly toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: nightly
- name: "Run benches"
run: cargo rbmt test nightly --lock-file ${{ matrix.dep }}
EmbeddedWithAlloc:
name: no_std with alloc
needs: Prepare
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Set up QEMU
run: sudo apt update && sudo apt install -y qemu-system-arm gcc-arm-none-eabi
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@v1
with:
targets: thumbv7m-none-eabi
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: Run
env:
RUSTFLAGS: "-C link-arg=-Tlink.x"
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER: "qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel"
run: cd embedded/with-allocator && cargo run --target thumbv7m-none-eabi
EmbeddedNoAlloc:
name: no_std no alloc
needs: Prepare
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Set up QEMU
run: sudo apt update && sudo apt install -y qemu-system-arm gcc-arm-none-eabi
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@v1
with:
targets: thumbv7m-none-eabi
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: Run
env:
RUSTFLAGS: "-C link-arg=-Tlink.x"
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER: "qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel"
run: cd embedded/no-allocator && cargo run --target thumbv7m-none-eabi
Arch32bit:
name: Test 32-bit version
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@stable
- name: Add architecture i386
run: sudo dpkg --add-architecture i386
- name: Install i686 gcc
run: sudo apt-get update -y && sudo apt-get install -y gcc-multilib
- name: Install target
run: rustup target add i686-unknown-linux-gnu
- name: Run tests on i686
run: cargo test --target i686-unknown-linux-gnu
Cross:
name: Cross test
if: ${{ !github.event.act }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install target
run: rustup target add s390x-unknown-linux-gnu
- name: install cross
run: cargo install cross --locked
- name: run cross test
run: cross test --target s390x-unknown-linux-gnu