-
Notifications
You must be signed in to change notification settings - Fork 32
230 lines (214 loc) · 7.35 KB
/
parallel-build.yml
File metadata and controls
230 lines (214 loc) · 7.35 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# This is a workflow file to run, build, and test all crates used as part of `rust-exercises`.
# It is cached with Swatinem/rust-cache@v2 and setup so that no jobs depend on any other jobs,
# EXCEPT for the last `deploy` job, which pulls in artifacts-producing jobs in the `needs:` field.
# The brunt of the work is defined in `build_fns.sh` where the actual build/testing logic is defined.
name: rust-exercises
env:
CARGO_TERM_COLOR: always # We want colors in our CI output
CARGO_INCREMENTAL: 0 # Don't waste time writing out incremental build files
CARGO_PROFILE_TEST_DEBUG: 0 # These are thrown away anyways, don't produce them
# Runs CI on pushing tags and pulls, but not both. Since we have branch protection on, these are our only cases to handle.
on:
push:
tags:
- "*"
pull_request:
merge_group:
# * All jobs defined here run independently of each other EXCEPT for `deploy`.
# * Jobs that have a `matrix` field will setup up a job per entry in said
# `matrix`.
#
# If you add any jobs that produce artifacts, make sure to add them to the
# `needs:` field of the `deploy` job, since that ensures `deploy` will run
# last and can pull said artifacts
#
# ========== TEMPLATE ===========
# my_cool_new_job:
# runs-on: ubuntu-24.04
# steps:
# - uses: actions/checkout@v4 # This is what downloads a fresh clone of the repo and cd's into it
# - uses: ./.github/actions/setup
# with:
# cache: dir_where_I_want_results_cached
# - uses: taiki-e/install-action@v2 # For adding arbitrary binaries as tools
# with:
# tool: name_of_binary_tool@v1.0
# - run: just do-thing
# =========== END TEMPLATE ========
#
# And then you'd add `my_cool_new_job` to the `needs` field of `deploy`.
jobs:
test-build-mdbook:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
cache: exercise-book
- uses: taiki-e/install-action@v2
with:
tool: mdbook@0.4,mdbook-mermaid@0.12
- run: just test-mdbook
- run: just build-mdbook
- uses: actions/upload-artifact@v4
with:
name: mdbook-dir
path: exercise-book/book/
if-no-files-found: error
test-exercise-templates:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
cache: exercise-templates
- run: just test-exercise-templates
test-exercise-solutions:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
cache: exercise-solutions
- run: just test-exercise-solutions
test-connected-mailbox:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: just test-connected-mailbox
test-multi-threaded-mailbox:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: just test-multi-threaded-mailbox
build-qemu-uart-driver:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
cache: qemu-code/uart-driver
target: armv8r-none-eabihf
channel: nightly
- run: just build-qemu-uart-driver
build-radio-app:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
cache: nrf52-code/radio-app
target: thumbv7em-none-eabihf
- uses: taiki-e/install-action@v2
with:
tool: flip-link@0.1.10
- run: just build-radio-app
build-usb-app:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
cache: nrf52-code/usb-app
target: thumbv7em-none-eabihf
- uses: taiki-e/install-action@v2
with:
tool: flip-link@0.1.10
- run: just build-usb-app
test-usb-lib:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
cache: nrf52-code/usb-lib
target: thumbv7em-none-eabihf
- run: just test-usb-lib
build-puzzle-fw:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
cache: nrf52-code/puzzle-fw
target: thumbv7em-none-eabihf
- uses: taiki-e/install-action@v2
with:
tool: flip-link@0.1.10
- run: just build-puzzle-fw
env:
CI_BUILD: "1"
HIDDEN_MESSAGE: ${{ secrets.HIDDEN_MESSAGE }}
- uses: actions/upload-artifact@v4
with:
name: puzzle-fw
path: nrf52-code/puzzle-fw/target/thumbv7em-none-eabihf/release/puzzle-fw
if-no-files-found: error
build-loopback-fw:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
cache: nrf52-code/loopback-fw
target: thumbv7em-none-eabihf
- uses: taiki-e/install-action@v2
with:
tool: flip-link@0.1.10
- run: just build-loopback-fw
- uses: actions/upload-artifact@v4
with:
name: loopback-fw
path: nrf52-code/loopback-fw/target/thumbv7em-none-eabihf/release/loopback-fw
if-no-files-found: error
format-check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: just format-check
# This is the last job, and waits (`needs:`) only on those that pass artifacts to it.
# It the necessary resulting builds as artifacts, zips them, and uploads with a tag if necessary.
deploy:
runs-on: ubuntu-24.04
# Notice that because our repo expects all checks to pass, we don't need to include every other job
# as a dependency of the `deploy` job.
needs: [test-build-mdbook, build-puzzle-fw, build-loopback-fw]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
# Download the produced artifacts
- uses: actions/download-artifact@v4
with:
# Move the mdbook `book` dir to where we expect it to be
name: mdbook-dir
path: ./exercise-book/book
- uses: actions/download-artifact@v4
with:
name: puzzle-fw
path: ./nrf52-code/puzzle-fw/target/thumbv7em-none-eabihf/release/
- uses: actions/download-artifact@v4
with:
name: loopback-fw
path: ./nrf52-code/loopback-fw/target/thumbv7em-none-eabihf/release/
- run: |
slug=$(./describe.sh "${GITHUB_REF}")
echo "Building with slug '${slug}'"
echo "slug=${slug}" >> "${GITHUB_ENV}"
- run: just assemble ${{ env.slug }}
- uses: actions/upload-artifact@v4
if: ${{success()}}
with:
name: Artifacts
if-no-files-found: error
path: |
./rust-exercises-*
- if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: "./rust-exercises-${{ env.slug }}.zip,./rust-exercises-${{ env.slug }}/nrf52-code/boards/dongle-fw/*-fw"
allowUpdates: true
updateOnlyUnreleased: true