Skip to content

Commit c0c82fe

Browse files
committed
Add github actions
1 parent 237836e commit c0c82fe

File tree

1 file changed

+161
-0
lines changed

1 file changed

+161
-0
lines changed

.github/workflows/build.yml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
- staging
8+
- trying
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
13+
jobs:
14+
# Run cargo fmt --check, includes macros/
15+
style:
16+
name: style
17+
runs-on: ubuntu-20.04
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: Install Rust
23+
uses: actions-rs/toolchain@v1
24+
with:
25+
profile: minimal
26+
toolchain: stable
27+
override: true
28+
components: rustfmt
29+
30+
- name: cargo fmt --check
31+
uses: actions-rs/cargo@v1
32+
with:
33+
command: fmt
34+
args: --all -- --check
35+
36+
# Compilation
37+
build:
38+
name: build
39+
runs-on: ubuntu-20.04
40+
strategy:
41+
matrix:
42+
target:
43+
- x86_64-unknown-linux-gnu
44+
toolchain:
45+
- stable
46+
features:
47+
- stm32f107,smi
48+
- stm32f407,smi
49+
- stm32f417,smi
50+
- stm32f427,smi
51+
- stm32f429,smi
52+
- stm32f437,smi
53+
- stm32f439,smi
54+
- stm32f469,smi
55+
- stm32f479,smi
56+
- stm32f429,smi
57+
- stm32f745,smi
58+
- stm32f746,smi
59+
- stm32f756,smi
60+
- stm32f765,smi
61+
- stm32f767,smi
62+
- stm32f769,smi
63+
- stm32f777,smi
64+
- stm32f778,smi
65+
- stm32f779,smi
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v3
69+
70+
- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
71+
uses: actions-rs/toolchain@v1
72+
with:
73+
toolchain: ${{ matrix.toolchain }}
74+
target: ${{ matrix.target }}
75+
override: true
76+
77+
- name: cargo build
78+
uses: actions-rs/cargo@v1
79+
with:
80+
use-cross: false
81+
command: build
82+
args: --target=${{ matrix.target }} --features ${{ matrix.features }}
83+
84+
# Examples
85+
examples:
86+
name: examples
87+
runs-on: ubuntu-20.04
88+
strategy:
89+
matrix:
90+
target:
91+
- thumbv7m-none-eabi
92+
toolchain:
93+
- stable
94+
steps:
95+
- name: Checkout
96+
uses: actions/checkout@v3
97+
98+
- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
99+
uses: actions-rs/toolchain@v1
100+
with:
101+
toolchain: ${{ matrix.toolchain }}
102+
target: ${{ matrix.target }}
103+
override: true
104+
105+
- name: cargo build f4 example pktgen
106+
uses: actions-rs/cargo@v1
107+
with:
108+
use-cross: false
109+
command: build
110+
args: --target=${{ matrix.target }} --example pktgen --features stm32f429,smi
111+
112+
- name: cargo build f4 example ip
113+
uses: actions-rs/cargo@v1
114+
with:
115+
use-cross: false
116+
command: build
117+
args: --target=${{ matrix.target }} --example ip --features stm32f429,smoltcp-phy,log,smoltcp/socket-tcp,smoltcp/socket-icmp,smoltcp/log,smoltcp/verbose
118+
119+
- name: cargo build f4 example arp
120+
uses: actions-rs/cargo@v1
121+
with:
122+
use-cross: false
123+
command: build
124+
args: --target=${{ matrix.target }} --example arp --features stm32f407,smi
125+
126+
- name: cargo build f4 example arp-smoltcp
127+
uses: actions-rs/cargo@v1
128+
with:
129+
use-cross: false
130+
command: build
131+
args: --target=${{ matrix.target }} --example arp-smoltcp --features stm32f407,smi,smoltcp-phy,smoltcp/socket-icmp
132+
133+
- name: cargo build f1 example ip
134+
uses: actions-rs/cargo@v1
135+
with:
136+
use-cross: false
137+
command: build
138+
args: --target=${{ matrix.target }} --example ip-f107 --features stm32f107,smoltcp-phy,log,smoltcp/socket-tcp,smoltcp/socket-icmp,smoltcp/log,smoltcp/verbose
139+
140+
- name: cargo build f1
141+
uses: actions-rs/cargo@v1
142+
with:
143+
use-cross: false
144+
command: build
145+
args: --target=${{ matrix.target }} --features ${{ matrix.feaures }}
146+
147+
# Refs: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
148+
#
149+
# ALL THE PREVIOUS JOBS NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
150+
151+
ci-success:
152+
name: ci
153+
if: github.event_name == 'push' && success()
154+
needs:
155+
- style
156+
- build
157+
- examples
158+
runs-on: ubuntu-20.04
159+
steps:
160+
- name: Mark the job as a success
161+
run: exit 0

0 commit comments

Comments
 (0)