Update cargo regress tool and move CI #1875
Workflow file for this run
This file contains 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
on: | |
push: | |
branches: master | |
pull_request: | |
merge_group: | |
name: Continuous integration | |
jobs: | |
ci: | |
name: CI | |
runs-on: ubuntu-latest | |
needs: [check, ci-linux, ci-clippy, ci-serde] | |
if: always() | |
steps: | |
- name: Done | |
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' | |
check: | |
name: Cargo check / clippy | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
TARGET: | |
[ | |
x86_64-unknown-linux-gnu, | |
x86_64-apple-darwin, | |
x86_64-pc-windows-msvc, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
targets: ${{ matrix.TARGET }} | |
components: clippy | |
- name: Cache Dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.TARGET }} | |
- run: cargo check --target ${{ matrix.TARGET }} --no-default-features | |
env: | |
RUSTFLAGS: -D warnings | |
- run: cargo check --target ${{ matrix.TARGET }} | |
env: | |
RUSTFLAGS: -D warnings | |
- run: cargo clippy --target ${{ matrix.TARGET }} | |
ci-linux: | |
runs-on: ubuntu-latest | |
needs: [check] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# TODO: There are currently no working Atmel tests... | |
# - { rust: stable, vendor: Atmel } | |
# - { rust: stable, vendor: Atmel, options: "-- --strict --atomics" } | |
- { rust: stable, vendor: Freescale } | |
- { rust: stable, vendor: Freescale, options: "-- --strict --atomics" } | |
- { rust: stable, vendor: Fujitsu } | |
- { rust: stable, vendor: Fujitsu, options: "-- --atomics" } | |
- { rust: stable, vendor: Holtek } | |
- { rust: stable, vendor: Holtek, options: "-- --strict --atomics" } | |
- { rust: stable, vendor: Atmel } | |
- { rust: stable, vendor: Atmel, options: "-- --strict --atomics" } | |
- { rust: stable, vendor: Microchip } | |
- { rust: stable, vendor: Microchip, options: "-- --atomics" } | |
- { rust: stable, vendor: Nordic } | |
- { rust: stable, vendor: Nordic, options: "-- --strict --atomics" } | |
- { rust: 1.76.0, vendor: Nordic, options: "-- --strict --atomics" } | |
- { rust: stable, vendor: Nuvoton } | |
- { rust: stable, vendor: Nuvoton, options: "-- --atomics" } | |
- { rust: stable, vendor: NXP } | |
- { rust: stable, vendor: NXP, options: "-- --strict --atomics" } | |
- { rust: stable, vendor: SiFive } | |
- { rust: stable, vendor: SiFive, options: "-- --strict --atomics" } | |
- { rust: stable, vendor: SiliconLabs, options: "" } | |
- { rust: stable, vendor: SiliconLabs, options: "-- --strict --atomics" } | |
- { rust: stable, vendor: Spansion } | |
- { rust: stable, vendor: Spansion, options: "-- --strict --atomics" } | |
- { rust: stable, vendor: STMicro } | |
- { rust: stable, vendor: STMicro, options: "-- --atomics" } | |
- { rust: stable, vendor: STMicro, options: "-- --strict -f enum_value::p: --max-cluster-size --atomics --atomics-feature atomics --impl-debug --impl-defmt defmt" } | |
- { rust: stable, vendor: Toshiba } | |
- { rust: stable, vendor: Toshiba, options: "-- --strict --atomics" } | |
- { rust: stable, vendor: TexasInstruments } | |
- { rust: stable, vendor: TexasInstruments, options: "-- --atomics" } | |
- { rust: stable, vendor: Espressif } | |
- { rust: stable, vendor: Espressif, options: "-- --atomics" } | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Self install | |
run: | | |
cargo install svd2rust --path . | |
cargo install svd2rust-regress --path ci/svd2rust-regress | |
- name: Run regression tool | |
run: svd2rust-regress tests --test-cases ci/svd2rust-regress/tests.yml -m ${{ matrix.vendor }} ${{ matrix.options }} | |
ci-clippy: | |
runs-on: ubuntu-latest | |
needs: [check] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Self install | |
run: | | |
cargo install svd2rust --path . | |
- name: Run CI script | |
env: | |
VENDOR: RISC-V | |
OPTIONS: "" | |
COMMAND: clippy | |
run: bash ci/script.sh | |
ci-serde: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: svdtools-0.3.19 | |
- name: Install svdtools | |
run: | | |
cargo install svdtools --version 0.3.19 --target-dir target | |
- name: Run CI script | |
run: | | |
wget https://stm32-rs.github.io/stm32-rs/stm32f411.svd.patched | |
svdtools convert --input-format xml stm32f411.svd.patched stm32f411.yaml | |
cargo run --release -- -i stm32f411.yaml | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Cache Dependencies | |
uses: Swatinem/rust-cache@v2 | |
- run: cargo fmt --all -- --check | |
artifact: | |
name: Build svd2rust artifact | |
if: github.event_name == 'pull_request' | |
needs: [check] | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
runs-on: ubuntu-latest | |
- target: aarch64-apple-darwin | |
runs-on: macos-latest | |
- target: x86_64-pc-windows-msvc | |
runs-on: windows-latest | |
suffix: .exe | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
targets: ${{ matrix.target }} | |
- name: Cache Dependencies | |
uses: Swatinem/rust-cache@v2 | |
- name: Build svd2rust artifact | |
run: cargo build --release --target ${{ matrix.target }} | |
- run: mv target/${{ matrix.target }}/release/svd2rust${{ matrix.suffix || '' }} svd2rust-${{ matrix.target }}-$(git rev-parse --short HEAD)${{ matrix.suffix || '' }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifact-svd2rust-${{ matrix.target }} | |
path: svd2rust-${{ matrix.target }}* |