Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cargo regress tool and move CI #905

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 54 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,53 +54,47 @@ jobs:
runs-on: ubuntu-latest
needs: [check]
strategy:
fail-fast: false
matrix:
# Options are all, none, strict and const
include:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could use a

outputs:
    matrix: ${{ steps.generate-matrix.outputs.matrix }}

job

which would convert the matrix in this file to

strategy:
  fail-fast: false
    include: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}

however, that wouldn't test different command flags. So maybe we shouldn't do that and instead just have a single job to test all defined test targets in svd2rust-regress

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would the input specification via a different job help? Wouldn´t one command mean that there are no individual CI jobs for the architecture and flag options anymore? I think this is a good thing in the current setup.. I tried to preserve the old setup here.

Copy link
Member

@Emilgardis Emilgardis Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do this in cross-rs, where I have a targets.toml that populate the CI automatically through a ci job to filter targets.

The input basically expands to a list of targets, not just a single target in a list

Copy link
Contributor Author

@robamu robamu Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would probably be useful to make running the tests as they are done in the CI locally, even though it makes the CI chain a bit more complex.. But it might be better for a different PR?

- { 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 -f enum_value::p: --max-cluster-size --atomics --atomics-feature atomics --impl-debug --impl-defmt defmt" }
- { rust: stable, vendor: Toshiba, options: all }
- { rust: stable, vendor: Toshiba, options: "" }
# Test MSRV
- { rust: 1.76.0, vendor: Nordic, options: "" }
# Use nightly for architectures which don't support stable
- { rust: nightly, vendor: MSP430, options: "--atomics" }
- { rust: nightly, vendor: MSP430, options: "" }
# Workaround for _1token0
- { rust: nightly-2024-09-25, vendor: Espressif, options: "--atomics --ident-formats-theme legacy" }
- { rust: nightly-2024-09-25, vendor: Espressif, options: "--ident-format register:::Reg" }
- { vendor: Atmel }
- { vendor: Atmel, options: "-- --strict --atomics" }
- { vendor: Freescale }
- { vendor: Freescale, options: "-- --strict --atomics" }
- { vendor: Fujitsu }
- { vendor: Fujitsu, options: "-- --atomics" }
- { vendor: Holtek }
- { vendor: Holtek, options: "-- --strict --atomics" }
- { vendor: Atmel }
- { vendor: Atmel, options: "-- --strict --atomics" }
- { vendor: Microchip }
- { vendor: Microchip, options: "-- --atomics" }
- { vendor: Nordic }
- { vendor: Nordic, options: "-- --strict --atomics" }
- { vendor: Nuvoton }
- { vendor: Nuvoton, options: "-- --atomics" }
- { vendor: NXP }
- { vendor: NXP, options: "-- --strict --atomics" }
- { vendor: SiFive }
- { vendor: SiFive, options: "-- --atomics" }
- { vendor: SiliconLabs, options: "" }
- { vendor: SiliconLabs, options: "-- --strict --atomics" }
- { vendor: Spansion }
- { vendor: Spansion, options: "-- --atomics" }
- { vendor: STMicro }
- { vendor: STMicro, options: "-- --atomics" }
- { vendor: STMicro, options: "-- --strict -f enum_value::p: --max-cluster-size --atomics --atomics-feature atomics --impl-debug --impl-defmt defmt" }
- { vendor: Toshiba }
- { vendor: Toshiba, options: "-- --strict --atomics" }
- { vendor: TexasInstruments }
- { vendor: TexasInstruments, options: "-- --atomics" }
- { vendor: Espressif }
- { vendor: Espressif, options: "-- --atomics" }

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: dtolnay/rust-toolchain@stable

- name: Cache
uses: Swatinem/rust-cache@v2
Expand All @@ -109,13 +103,25 @@ jobs:
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
RUST_TOOLCHAIN: ${{ matrix.rust }}
run: bash ci/script.sh
- name: Run regression tool
run: cargo regress tests -m ${{ matrix.vendor }} ${{ matrix.options }}

ci-msrv-check:
runs-on: ubuntu-latest
needs: [check]
steps:
- uses: actions/checkout@v4

- name: Self install
run: |
cargo install svd2rust --path .

# Install the MSRV toolchain
- uses: dtolnay/[email protected]
- name: Run reression tool with MSRV
# The MSRV only applies to the generated crate. The regress tool should still be run with
# stable.
run: cargo +stable regress tests --toolchain 1.76.0 -m Nordic -- --strict --atomics

ci-clippy:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions ci/svd2rust-regress/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ edition = "2021"
name = "svd2rust-regress"
version = "0.1.0"
authors = ["James Munns <[email protected]>", "The svd2rust developers"]
rust-version = "1.82.0"

[dependencies]
clap = { version = "4.1", features = ["color", "derive", "string", "env"] }
Expand Down
Loading