-
Notifications
You must be signed in to change notification settings - Fork 18
205 lines (192 loc) · 6.08 KB
/
ci.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
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
# Lovingly borrowed from mycelium's CI setup
name: CI
on:
# always run CI on pushes to PRs and to the `main` branch
pull_request:
push:
branches: ["main"]
# allow manually triggering CI.
workflow_dispatch:
# enable merge queue.
merge_group:
env:
# disable incremental compilation.
#
# incremental compilation is useful as part of an edit-build-test-edit cycle,
# as it lets the compiler avoid recompiling code that hasn't changed. however,
# on CI, we're not making small edits; we're almost always building the entire
# project from scratch. thus, incremental compilation on CI actually
# introduces *additional* overhead to support making future builds
# faster...but no future builds will ever occur in any given CI environment.
#
# see https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
# for details.
CARGO_INCREMENTAL: 0
# allow more retries for network requests in cargo (downloading crates) and
# rustup (installing toolchains). this should help to reduce flaky CI failures
# from transient network timeouts or other issues.
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUSTUP_MAX_RETRIES: 10
# don't emit giant backtraces in the CI logs.
RUST_BACKTRACE: short
jobs:
# dummy job to indicate everything has passed.
#
# this is used to gate merging branches, rather than requiring the individual
# checks in the GitHub branch protection UI. this allows us to declare which
# jobs gate merging in this file, rather than out of band in the UI.
all_systems_go:
name: "all systems go!"
runs-on: ubuntu-latest
needs:
- check
- clippy
- build-bins
- build-x86_64
- test
- test-host-miri
- docs
- rustfmt
- netlify_dryrun
steps:
- run: exit 0
# run `just check`
check:
name: just check
# needs: changed_paths
# if: needs.changed_paths.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: install libudev
run: sudo apt-get update && sudo apt-get install -y libudev-dev
- uses: actions/checkout@v2
- name: rust toolchain
run: rustup show
- uses: olix0r/cargo-action-fmt@ee1ef42932e44794821dab57ef1bf7a73df8b21f
- uses: extractions/setup-just@v1
- name: run just check
run: just check
# run `just clippy`
clippy:
name: just clippy
# needs: changed_paths
# if: needs.changed_paths.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: install libudev
run: sudo apt-get update && sudo apt-get install -y libudev-dev
- uses: actions/checkout@v2
- name: rust toolchain
run: rustup show
- uses: olix0r/cargo-action-fmt@ee1ef42932e44794821dab57ef1bf7a73df8b21f
- uses: extractions/setup-just@v1
- name: run just clippy
run: just clippy
# build bin targets
build-bins:
strategy:
matrix:
package: ["mnemos-d1", "mnemos-esp32c3-buddy", "mnemos-x86_64"]
name: cargo build ${{ matrix.package }}
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v2
- name: rust toolchain
run: rustup show
- uses: olix0r/cargo-action-fmt@ee1ef42932e44794821dab57ef1bf7a73df8b21f
# note that this actually *needs* to be `--release`, because the D1 platform
# impl apparently just Does Not Build in debug mode (debug builds fail with
# a pile of linker errors, what the heck...)
- run: cargo build --package ${{ matrix.package}} --release --all-features
# build x86_64 bootimage
build-x86_64:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v2
- name: rust toolchain
run: rustup show
- uses: extractions/setup-just@v1
- run: just build-x86
# run `just test`
test:
name: just test
needs: check # skip on commits that don't compile.
# needs: changed_paths
# if: needs.changed_paths.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: install libudev and libsdl2-dev
run: |
sudo apt-get update \
&& sudo apt-get install -y libudev-dev libsdl2-dev
- uses: actions/checkout@v2
- name: rust toolchain
run: rustup show
- name: install nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest@latest
- uses: extractions/setup-just@v1
- name: just test
run: just test
# (test-host forth3) - run miri tests
test-host-miri:
runs-on: ubuntu-latest
name: cargo miri test --package forth3 (host)
needs: check
# TODO(eliza): only run this if forth3 changed?
# needs: changed_paths
# if: needs.changed_paths.outputs.should_skip != 'true'
steps:
- uses: actions/checkout@v3
- name: rust toolchain
run: rustup show
- name: install Miri
run: |
rustup component add miri
cargo miri setup
- name: cargo miri test (forth3)
run: |
cargo miri test \
--package forth3 \
--all-features
# check code style with `rustfmt`
rustfmt:
# needs: changed_paths
# if: needs.changed_paths.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install rust toolchain
run: rustup show
- name: run rustfmt
run: cargo fmt --check
# check that RustDoc builds
#
# See `check` NOTE above for details regarding the excluded crate(s).
docs:
# needs: changed_paths
# if: needs.changed_paths.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: install libudev
run: sudo apt-get update && sudo apt-get install -y libudev-dev
- uses: actions/checkout@v2
- name: rust toolchain
run: rustup show
- uses: olix0r/cargo-action-fmt@ee1ef42932e44794821dab57ef1bf7a73df8b21f
- uses: extractions/setup-just@v1
- name: run rustdoc
run: just docs --document-private-items
# check that netlify CI should work
netlify_dryrun:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install netlify deps
run: ./scripts/install-ci-deps.sh
- name: run netlify ci
run: ./scripts/run-ci-build.sh