Skip to content

Commit a5212bc

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

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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@v4
19+
with:
20+
path: flash-algorithms
21+
- uses: actions/checkout@v4
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: cargo fmt --check
36+
working-directory: flash-algorithms
37+
run: cargo fmt --all -- --check
38+
- name: generate ch32-metapac
39+
working-directory: ch32-data
40+
run: ./d gen
41+
- name: cargo clippy -p xtask
42+
working-directory: flash-algorithms
43+
run: cargo clippy -p xtask -- -D warnings
44+
45+
algos:
46+
name: algos/${{ matrix.crate }}
47+
runs-on: ubuntu-latest
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
crate: [v0, v00x, v1, v3, l1, x0]
52+
steps:
53+
- uses: actions/checkout@v4
54+
with:
55+
path: flash-algorithms
56+
- uses: actions/checkout@v4
57+
with:
58+
repository: ${{ env.CH32_DATA_REPO }}
59+
ref: ${{ env.CH32_DATA_REF }}
60+
path: ch32-data
61+
- uses: dtolnay/rust-toolchain@nightly
62+
with:
63+
components: rust-src
64+
- uses: Swatinem/rust-cache@v2
65+
with:
66+
workspaces: |
67+
flash-algorithms
68+
ch32-data
69+
key: ${{ matrix.crate }}
70+
- name: generate ch32-metapac
71+
working-directory: ch32-data
72+
run: ./d gen
73+
- name: cargo build --release
74+
working-directory: flash-algorithms/algos/${{ matrix.crate }}
75+
run: cargo build --release
76+
77+
render:
78+
name: render YAMLs
79+
runs-on: ubuntu-latest
80+
steps:
81+
- uses: actions/checkout@v4
82+
with:
83+
path: flash-algorithms
84+
- uses: actions/checkout@v4
85+
with:
86+
repository: ${{ env.CH32_DATA_REPO }}
87+
ref: ${{ env.CH32_DATA_REF }}
88+
path: ch32-data
89+
- uses: dtolnay/rust-toolchain@nightly
90+
with:
91+
components: rust-src
92+
- uses: Swatinem/rust-cache@v2
93+
with:
94+
workspaces: |
95+
flash-algorithms
96+
ch32-data
97+
shared-key: render
98+
- name: generate ch32-metapac
99+
working-directory: ch32-data
100+
run: ./d gen
101+
- name: cargo run -p xtask
102+
working-directory: flash-algorithms
103+
run: cargo run -p xtask

0 commit comments

Comments
 (0)