Skip to content

Commit f896cc1

Browse files
committed
ci: use reusable workflow
1 parent ae2ad9f commit f896cc1

File tree

2 files changed

+68
-72
lines changed

2 files changed

+68
-72
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ jobs:
3333
- name: cargo xtask fmt
3434
run: cargo xtask --verbose fmt -c
3535

36-
# Compilation check
37-
check:
38-
name: check
39-
runs-on: ubuntu-22.04
36+
# Verify all examples, checks
37+
check-clippy:
38+
uses: ./.github/workflows/clippy-check-example.yml
39+
with:
40+
backend: ${{ matrix.input.backend }}
41+
platform: ${{ matrix.input.platform }}
42+
rustup-target: ${{ matrix.input.rustup-target }}
43+
example-args: ${{ matrix.input.example-args }}
44+
4045
strategy:
4146
matrix:
4247
input:
@@ -51,6 +56,7 @@ jobs:
5156
- backend: thumbv8-base
5257
platform: lm3s6965
5358
rustup-target: thumbv8m.base-none-eabi
59+
example-args: --exampleexclude pool example-check
5460

5561
- backend: thumbv8-main
5662
platform: lm3s6965
@@ -67,20 +73,9 @@ jobs:
6773
- backend: riscv-esp32-c3
6874
platform: esp32-c3
6975
rustup-target: riscv32imc-unknown-none-elf
70-
steps:
71-
- name: Checkout
72-
uses: actions/checkout@v4
73-
74-
- name: Configure Rust target ${{ matrix.input.rustup-target }}
75-
run: rustup target add ${{ matrix.input.rustup-target }}
76-
77-
- name: Cache Dependencies
78-
uses: Swatinem/rust-cache@v2
79-
80-
- run: cargo xtask --deny-warnings --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} check
8176

8277
# Clippy
83-
# TODO: clippy esp32-c3
78+
# TODO: put in clippy-check-example once esp32-c3 clippy is fixed
8479
clippy:
8580
name: clippy
8681
runs-on: ubuntu-22.04
@@ -126,59 +121,6 @@ jobs:
126121

127122
- run: cargo xtask --deny-warnings --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} clippy
128123

129-
# Verify all examples, checks
130-
checkexamples:
131-
name: check examples
132-
runs-on: ubuntu-22.04
133-
strategy:
134-
matrix:
135-
input:
136-
- backend: thumbv7
137-
platform: lm3s6965
138-
rustup-target: thumbv7m-none-eabi
139-
140-
- backend: thumbv6
141-
platform: lm3s6965
142-
rustup-target: thumbv6m-none-eabi
143-
144-
- backend: thumbv8-base
145-
platform: lm3s6965
146-
rustup-target: thumbv8m.base-none-eabi
147-
148-
- backend: thumbv8-main
149-
platform: lm3s6965
150-
rustup-target: thumbv8m.main-none-eabi
151-
152-
- backend: riscv32-imc-clint
153-
platform: hifive1
154-
rustup-target: riscv32imc-unknown-none-elf
155-
156-
- backend: riscv32-imc-mecall
157-
platform: hifive1
158-
rustup-target: riscv32imc-unknown-none-elf
159-
160-
- backend: riscv-esp32-c3
161-
platform: esp32-c3
162-
rustup-target: riscv32imc-unknown-none-elf
163-
164-
steps:
165-
- name: Checkout
166-
uses: actions/checkout@v4
167-
168-
- name: Configure Rust target ${{ matrix.input.rustup-target }}
169-
run: rustup target add ${{ matrix.input.rustup-target }}
170-
171-
- name: Cache Dependencies
172-
uses: Swatinem/rust-cache@v2
173-
174-
- name: Check the examples
175-
if: ${{ matrix.input.backend == 'thumbv8-base' }}
176-
run: cargo xtask --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} --exampleexclude pool example-check
177-
178-
- name: Check the examples
179-
if: ${{ matrix.input.backend != 'thumbv8-base' }}
180-
run: cargo xtask --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} example-check
181-
182124
buildqemu:
183125
name: Get modern QEMU, build and store
184126
runs-on: ubuntu-22.04
@@ -763,9 +705,7 @@ jobs:
763705
if: github.event_name == 'push' && success()
764706
needs:
765707
- formatcheck
766-
- check
767-
- clippy
768-
- checkexamples
708+
- check-clippy
769709
- testexamples
770710
- tests
771711
- docs
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: check-clippy-examples
2+
on:
3+
workflow_call:
4+
inputs:
5+
backend:
6+
description: The backend to execute for
7+
required: true
8+
type: string
9+
10+
platform:
11+
description: The platform to execute for
12+
required: true
13+
type: string
14+
15+
# TODO: get this from `cargo xtask`!
16+
rustup-target:
17+
description: The rustup target to install
18+
required: true
19+
type: string
20+
21+
example-args:
22+
description: Extra args to pass when checking examples
23+
required: false
24+
type: string
25+
26+
jobs:
27+
check:
28+
runs-on: ubuntu-22.04
29+
name: Validate platform ${{ inputs.platform }}, backend ${{ inputs.backend }}
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Configure Rust target ${{ inputs.rustup-target }}
35+
run: rustup target add ${{ inputs.rustup-target }}
36+
37+
- name: Cache Dependencies
38+
uses: Swatinem/rust-cache@v2
39+
40+
- run: cargo xtask check --deny-warnings -p ${{ inputs.platform }} -b ${{ inputs.backend }}
41+
42+
check-examples:
43+
runs-on: ubuntu-22.04
44+
name: Check examples
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
49+
- name: Configure Rust target ${{ inputs.rustup-target }}
50+
run: rustup target add ${{ inputs.rustup-target }}
51+
52+
- name: Cache Dependencies
53+
uses: Swatinem/rust-cache@v2
54+
55+
- name: Check the examples
56+
run: cargo xtask example-check --platform ${{ inputs.platform }} --backend ${{ inputs.backend }} ${{ inputs.example-args }}

0 commit comments

Comments
 (0)