Merge pull request #723 from JalonWong/feature/steal #1215
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@v3 | |
- 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 }} | |
env: | |
RUSTFLAGS: -D warnings | |
- run: cargo clippy --target ${{ matrix.TARGET }} | |
ci-linux: | |
runs-on: ubuntu-latest | |
needs: [check] | |
strategy: | |
matrix: | |
# Options are all, none, strict and const | |
include: | |
- { rust: stable, vendor: Atmel, options: all } | |
- { rust: stable, vendor: Atmel, options: "" } | |
- { rust: stable, vendor: Freescale, options: all } | |
- { rust: stable, vendor: Freescale, options: "" } | |
- { rust: stable, vendor: Fujitsu, options: "" } | |
- { rust: stable, vendor: Fujitsu, options: "--atomics" } | |
- { rust: stable, vendor: GD32, options: all } | |
- { rust: stable, vendor: GD32, options: "" } | |
- { rust: stable, vendor: Holtek, options: all } | |
- { rust: stable, vendor: Holtek, options: "" } | |
- { rust: stable, vendor: Microchip, options: "" } | |
- { rust: stable, vendor: Microchip, options: "--atomics" } | |
- { rust: stable, vendor: Nordic, options: all } | |
- { rust: stable, vendor: Nordic, options: "" } | |
- { rust: stable, vendor: Nuvoton, options: "" } | |
- { rust: stable, vendor: Nuvoton, options: "--atomics" } | |
- { rust: stable, vendor: NXP, options: all } | |
- { rust: stable, vendor: NXP, options: "" } | |
- { rust: stable, vendor: RISC-V, options: "" } | |
- { rust: stable, vendor: RISC-V, options: "--atomics" } | |
- { rust: stable, vendor: SiliconLabs, options: all } | |
- { rust: stable, vendor: SiliconLabs, options: "" } | |
- { rust: stable, vendor: Spansion, options: "" } | |
- { rust: stable, vendor: Spansion, options: "--atomics" } | |
- { rust: stable, vendor: STMicro, options: "" } | |
- { rust: stable, vendor: STMicro, options: "--atomics" } | |
- { rust: stable, vendor: STM32-patched, options: "--strict --const_generic --pascal_enum_values --max_cluster_size --atomics --atomics_feature atomics" } | |
- { rust: stable, vendor: Toshiba, options: all } | |
- { rust: stable, vendor: Toshiba, options: "" } | |
# Test MSRV | |
- { rust: 1.65.0, vendor: Nordic, options: "" } | |
# Use nightly for architectures which don't support stable | |
- { rust: nightly, vendor: MSP430, options: "--atomics" } | |
- { rust: nightly, vendor: MSP430, options: "" } | |
- { rust: nightly, vendor: Espressif, options: "--atomics" } | |
- { rust: nightly, vendor: Espressif, options: "" } | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Self install | |
run: | | |
cargo install svd2rust --path . | |
- name: Run CI script for `${{ matrix.vendor }}` under rust `${{ matrix.rust }}` with options=`${{ matrix.options }}` | |
env: | |
VENDOR: ${{ matrix.vendor }} | |
OPTIONS: ${{ matrix.options }} | |
COMMAND: check | |
run: bash ci/script.sh | |
ci-clippy: | |
runs-on: ubuntu-latest | |
needs: [check] | |
steps: | |
- uses: actions/checkout@v3 | |
- 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@v3 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: svdtools-0.2.3 | |
- name: Install svdtools | |
run: | | |
cargo install svdtools --version 0.2.3 --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@v3 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Cache Dependencies | |
uses: Swatinem/rust-cache@v2 | |
- run: cargo fmt --all -- --check |