Skip to content

Commit 51ebe13

Browse files
committed
ci: fmt+clippy, per-algo build matrix, end-to-end render
1 parent 5cd8c29 commit 51ebe13

1 file changed

Lines changed: 113 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
env:
9+
# Bump in lockstep with Cargo.toml when those interfaces change.
10+
CH32_DATA_REPO: ch32-rs/ch32-data
11+
CH32_DATA_REF: 6f94309ec3bc7480b9686c3119284df833050c54
12+
13+
jobs:
14+
fmt-clippy:
15+
name: fmt + clippy
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v6
19+
with:
20+
path: flash-algorithms
21+
- uses: actions/checkout@v6
22+
with:
23+
repository: ${{ env.CH32_DATA_REPO }}
24+
ref: ${{ env.CH32_DATA_REF }}
25+
path: ch32-data
26+
- uses: dtolnay/rust-toolchain@stable
27+
with:
28+
components: rustfmt, clippy
29+
- uses: Swatinem/rust-cache@v2
30+
with:
31+
workspaces: |
32+
flash-algorithms
33+
ch32-data
34+
shared-key: fmt-clippy
35+
- name: generate ch32-metapac
36+
working-directory: ch32-data
37+
run: ./d gen
38+
- name: cargo fmt --check
39+
working-directory: flash-algorithms
40+
# Explicit `-p` list (not `--all`) so fmt skips path deps like `ch32-metapac`.
41+
run: |
42+
cargo fmt --check \
43+
-p xtask \
44+
-p flash-algo-common \
45+
-p flash-algo-v0 \
46+
-p flash-algo-v00x \
47+
-p flash-algo-v1 \
48+
-p flash-algo-v3 \
49+
-p flash-algo-l1 \
50+
-p flash-algo-x0
51+
- name: cargo clippy -p xtask
52+
working-directory: flash-algorithms
53+
run: cargo clippy -p xtask -- -D warnings
54+
55+
algos:
56+
name: algos/${{ matrix.crate }}
57+
runs-on: ubuntu-latest
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
crate: [v0, v00x, v1, v3, l1, x0]
62+
steps:
63+
- uses: actions/checkout@v6
64+
with:
65+
path: flash-algorithms
66+
- uses: actions/checkout@v6
67+
with:
68+
repository: ${{ env.CH32_DATA_REPO }}
69+
ref: ${{ env.CH32_DATA_REF }}
70+
path: ch32-data
71+
- uses: dtolnay/rust-toolchain@nightly
72+
with:
73+
components: rust-src
74+
- uses: Swatinem/rust-cache@v2
75+
with:
76+
workspaces: |
77+
flash-algorithms
78+
ch32-data
79+
key: ${{ matrix.crate }}
80+
- name: generate ch32-metapac
81+
working-directory: ch32-data
82+
run: ./d gen
83+
- name: cargo build --release
84+
working-directory: flash-algorithms/algos/${{ matrix.crate }}
85+
run: cargo build --release
86+
87+
render:
88+
name: render YAMLs
89+
runs-on: ubuntu-latest
90+
steps:
91+
- uses: actions/checkout@v6
92+
with:
93+
path: flash-algorithms
94+
- uses: actions/checkout@v6
95+
with:
96+
repository: ${{ env.CH32_DATA_REPO }}
97+
ref: ${{ env.CH32_DATA_REF }}
98+
path: ch32-data
99+
- uses: dtolnay/rust-toolchain@nightly
100+
with:
101+
components: rust-src
102+
- uses: Swatinem/rust-cache@v2
103+
with:
104+
workspaces: |
105+
flash-algorithms
106+
ch32-data
107+
shared-key: render
108+
- name: generate ch32-metapac
109+
working-directory: ch32-data
110+
run: ./d gen
111+
- name: cargo run -p xtask
112+
working-directory: flash-algorithms
113+
run: cargo run -p xtask

0 commit comments

Comments
 (0)