ci: use reusable workflow

This commit is contained in:
datdenkikniet 2025-03-22 23:15:04 +01:00
parent ae2ad9f7d8
commit b43590510d
2 changed files with 68 additions and 72 deletions

View file

@ -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

View file

@ -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 }}