-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (81 loc) · 2.44 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Build Template
on:
schedule:
- cron: "0 8 * * 1"
push:
branches: ["*"]
paths-ignore:
- "**.md"
pull_request:
branches: ["*"]
paths-ignore:
- "**.md"
env:
CARGO_TERM_COLOR: always
PROJECT_NAME: ch32-blink
jobs:
build:
strategy:
matrix:
mcu_family:
[
ch32l003,
ch32v003,
ch32v103,
ch32v203,
ch32v208,
ch32v303,
ch32v305,
ch32v307,
ch32x033,
ch32x035,
ch641,
]
embassy: [true, false]
include:
- mcu_family: ch32l003
target: riscv32imac-unknown-none-elf
- mcu_family: ch32v103
target: riscv32imac-unknown-none-elf
- mcu_family: ch32v203
target: riscv32imac-unknown-none-elf
- mcu_family: ch32v208
target: riscv32imac-unknown-none-elf
- mcu_family: ch32v303
target: riscv32imafc-unknown-none-elf
- mcu_family: ch32v305
target: riscv32imafc-unknown-none-elf
- mcu_family: ch32v307
target: riscv32imafc-unknown-none-elf
- mcu_family: ch32x033
target: riscv32imac-unknown-none-elf
- mcu_family: ch32x035
target: riscv32imac-unknown-none-elf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cargo-generate/cargo-generate-action@latest
with:
name: ${{ env.PROJECT_NAME }}
arguments: "--define mcu_family=${{ matrix.mcu_family }} --define embassy=${{ matrix.embassy }}"
# we need to move the generated project to a temp folder, away from the template project
# otherwise `cargo` runs would fail
# see https://github.com/rust-lang/cargo/issues/9922
- name: Move generated project to temp dir
run: |
mv $PROJECT_NAME ${{ runner.temp }}/
- name: Use nightly Rust
run: |
cd ${{ runner.temp }}/$PROJECT_NAME
rustup default nightly
rustup component add rust-src
rustup update
- name: Install ${{ matrix.target }} target
if: ${{ matrix.target }}
run: |
cd ${{ runner.temp }}/$PROJECT_NAME
rustup target add ${{ matrix.target }}
- name: Build for ${{ matrix.mcu_family }}
run: |
cd ${{ runner.temp }}/$PROJECT_NAME
cargo build --release