From b43590510d5f46e2dbebe01611cce1218266848a Mon Sep 17 00:00:00 2001 From: datdenkikniet Date: Sat, 22 Mar 2025 23:15:04 +0100 Subject: [PATCH] ci: use reusable workflow --- .github/workflows/build.yml | 84 ++++------------------ .github/workflows/clippy-check-example.yml | 56 +++++++++++++++ 2 files changed, 68 insertions(+), 72 deletions(-) create mode 100644 .github/workflows/clippy-check-example.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0ed66b4a50..a18fcd7ac7a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,10 +33,15 @@ jobs: - name: cargo xtask fmt run: cargo xtask --verbose fmt -c - # Compilation check - check: - name: check - runs-on: ubuntu-22.04 + # Verify all examples, checks + check-clippy: + uses: ./.github/workflows/clippy-check-example.yml + with: + backend: ${{ matrix.input.backend }} + platform: ${{ matrix.input.platform }} + rustup-target: ${{ matrix.input.rustup-target }} + example-args: ${{ matrix.input.example-args }} + strategy: matrix: input: @@ -51,6 +56,7 @@ jobs: - backend: thumbv8-base platform: lm3s6965 rustup-target: thumbv8m.base-none-eabi + example-args: --exampleexclude pool - backend: thumbv8-main platform: lm3s6965 @@ -67,20 +73,9 @@ jobs: - backend: riscv-esp32-c3 platform: esp32-c3 rustup-target: riscv32imc-unknown-none-elf - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Configure Rust target ${{ matrix.input.rustup-target }} - run: rustup target add ${{ matrix.input.rustup-target }} - - - name: Cache Dependencies - uses: Swatinem/rust-cache@v2 - - - run: cargo xtask --deny-warnings --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} check # Clippy - # TODO: clippy esp32-c3 + # TODO: put in clippy-check-example once esp32-c3 clippy is fixed clippy: name: clippy runs-on: ubuntu-22.04 @@ -126,59 +121,6 @@ jobs: - run: cargo xtask --deny-warnings --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} clippy - # Verify all examples, checks - checkexamples: - name: check examples - runs-on: ubuntu-22.04 - strategy: - matrix: - input: - - backend: thumbv7 - platform: lm3s6965 - rustup-target: thumbv7m-none-eabi - - - backend: thumbv6 - platform: lm3s6965 - rustup-target: thumbv6m-none-eabi - - - backend: thumbv8-base - platform: lm3s6965 - rustup-target: thumbv8m.base-none-eabi - - - backend: thumbv8-main - platform: lm3s6965 - rustup-target: thumbv8m.main-none-eabi - - - backend: riscv32-imc-clint - platform: hifive1 - rustup-target: riscv32imc-unknown-none-elf - - - backend: riscv32-imc-mecall - platform: hifive1 - rustup-target: riscv32imc-unknown-none-elf - - - backend: riscv-esp32-c3 - platform: esp32-c3 - rustup-target: riscv32imc-unknown-none-elf - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Configure Rust target ${{ matrix.input.rustup-target }} - run: rustup target add ${{ matrix.input.rustup-target }} - - - name: Cache Dependencies - uses: Swatinem/rust-cache@v2 - - - name: Check the examples - if: ${{ matrix.input.backend == 'thumbv8-base' }} - run: cargo xtask --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} --exampleexclude pool example-check - - - name: Check the examples - if: ${{ matrix.input.backend != 'thumbv8-base' }} - run: cargo xtask --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} example-check - buildqemu: name: Get modern QEMU, build and store runs-on: ubuntu-22.04 @@ -763,9 +705,7 @@ jobs: if: github.event_name == 'push' && success() needs: - formatcheck - - check - - clippy - - checkexamples + - check-clippy - testexamples - tests - docs diff --git a/.github/workflows/clippy-check-example.yml b/.github/workflows/clippy-check-example.yml new file mode 100644 index 00000000000..5d4461483fc --- /dev/null +++ b/.github/workflows/clippy-check-example.yml @@ -0,0 +1,56 @@ +name: check-clippy-examples +on: + workflow_call: + inputs: + backend: + description: The backend to execute for + required: true + type: string + + platform: + description: The platform to execute for + required: true + type: string + + # TODO: get this from `cargo xtask`! + rustup-target: + description: The rustup target to install + required: true + type: string + + example-args: + description: Extra args to pass when checking examples + required: false + type: string + +jobs: + check: + runs-on: ubuntu-22.04 + name: Validate platform ${{ inputs.platform }}, backend ${{ inputs.backend }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure Rust target ${{ inputs.rustup-target }} + run: rustup target add ${{ inputs.rustup-target }} + + - name: Cache Dependencies + uses: Swatinem/rust-cache@v2 + + - run: cargo xtask --deny-warnings check -p ${{ inputs.platform }} -b ${{ inputs.backend }} + + check-examples: + runs-on: ubuntu-22.04 + name: Check examples + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure Rust target ${{ inputs.rustup-target }} + run: rustup target add ${{ inputs.rustup-target }} + + - name: Cache Dependencies + uses: Swatinem/rust-cache@v2 + + - name: Check the examples + run: cargo xtask example-check --platform ${{ inputs.platform }} --backend ${{ inputs.backend }} ${{ inputs.example-args }} \ No newline at end of file