-
Notifications
You must be signed in to change notification settings - Fork 7
260 lines (247 loc) · 8.05 KB
/
ci.yaml
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
name: ci
on:
push:
branches:
- 'main'
pull_request:
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Dwarnings"
CARGO_UNSTABLE_SPARSE_REGISTRY: true
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: r7kamura/rust-problem-matchers@v1
- run: cargo fmt --all -- --check
- uses: xt0rted/markdownlint-problem-matcher@v2
- uses: DavidAnson/markdownlint-cli2-action@v11
with:
globs: "**/*.md"
deny:
strategy:
matrix:
check:
- advisories
- bans licenses sources
runs-on: ubuntu-22.04
needs:
- "lint"
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.check }}
sort:
runs-on: ubuntu-22.04
needs:
- "lint"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo install cargo-sort
- run: cargo sort --workspace --check >/dev/null
clippy:
runs-on: ubuntu-22.04
needs:
- "lint"
strategy:
matrix:
rust:
- stable
- beta
# Prevent beta warnings from causing CI failure
continue-on-error: ${{ matrix.rust == 'beta' }}
steps:
- uses: actions/checkout@v3
- uses: mobilecoinfoundation/actions/dcap-libs@main
with:
version: 1.16.100.2-jammy1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: clippy
- uses: r7kamura/rust-problem-matchers@v1
- run: cargo +${{ matrix.rust }} clippy --all --all-features -- -D warnings
build:
runs-on: ubuntu-22.04
needs:
- "lint"
strategy:
matrix:
rust:
- stable
- beta
- nightly-2022-12-13
steps:
- uses: actions/checkout@v3
- uses: mobilecoinfoundation/actions/sgxsdk@main
with:
version: 2.19.100.3
- uses: mobilecoinfoundation/actions/dcap-libs@main
with:
version: 1.16.100.2-jammy1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: r7kamura/rust-problem-matchers@v1
- run: cargo +${{ matrix.rust }} build --release --locked
build-all-features:
runs-on: ubuntu-22.04
needs:
- "lint"
strategy:
matrix:
rust:
- stable
- beta
- nightly-2022-12-13
steps:
- uses: actions/checkout@v3
- uses: mobilecoinfoundation/actions/sgxsdk@main
with:
version: 2.19.100.3
- uses: mobilecoinfoundation/actions/dcap-libs@main
with:
version: 1.16.100.2-jammy1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: r7kamura/rust-problem-matchers@v1
- run: cargo +${{ matrix.rust }} build --release --locked --all-features
test:
runs-on: ubuntu-22.04
needs:
- "lint"
strategy:
matrix:
rust:
- stable
- beta
- nightly-2022-12-13
steps:
- uses: actions/checkout@v3
- uses: mobilecoinfoundation/actions/sgxsdk@main
with:
version: 2.19.100.3
- uses: mobilecoinfoundation/actions/dcap-libs@main
with:
version: 1.16.100.2-jammy1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: r7kamura/rust-problem-matchers@v1
- name: Run tests
# For some reason `SGX_AESM_ADDR` is set to 1 in the github runners.
# Not seeing it documented here, https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md
# We can't just set to 0 or "" as the SGX code looks for it being set, not what the value is :(
run: unset SGX_AESM_ADDR && cargo +${{ matrix.rust }} test --release --features "sim alloc" --locked
doc:
runs-on: ubuntu-22.04
needs:
- "lint"
strategy:
matrix:
rust:
- stable
- beta
# Prevent beta warnings from causing CI failure
continue-on-error: ${{ matrix.rust == 'beta' }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: r7kamura/rust-problem-matchers@v1
- run: cargo +${{ matrix.rust }} doc --release --no-deps --features sim
coverage:
runs-on: ubuntu-22.04
needs:
- "lint"
steps:
- uses: actions/checkout@v3
- uses: mobilecoinfoundation/actions/sgxsdk@main
with:
version: 2.19.100.3
- uses: mobilecoinfoundation/actions/dcap-libs@main
with:
version: 1.16.100.2-jammy1
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Run tests with coverage
# For some reason `SGX_AESM_ADDR` is set to 1 in the github runners.
# Not seeing it documented here, https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md
# We can't just set to 0 or "" as the SGX code looks for it being set, not what the value is :(
# The FFI bindings crates always report 100% because they have no code
run: unset SGX_AESM_ADDR && cargo llvm-cov --locked --features sim --ignore-filename-regex '\/sys/src/lib\.rs' --workspace --lcov --output-path lcov.info
- uses: codecov/codecov-action@v3
with:
files: lcov.info
# This job ensures that the specified crates are able to build without alloc. By proxy this also ensures that the
# build with no_std
build-no-alloc:
runs-on: ubuntu-22.04
needs:
- "lint"
strategy:
matrix:
target:
- thumbv6m-none-eabi
- thumbv7m-none-eabi
- thumbv8m.main-none-eabi
- aarch64-linux-android
- aarch64-apple-ios
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-12-13
targets: ${{ matrix.target }},x86_64-unknown-linux-gnu
components: rust-src
- uses: r7kamura/rust-problem-matchers@v1
- name: Build types with no alloc crate on various platfroms
# Some notes on this build command:
# - The vendored headers are used to get the necessary DCAP headers
# - The vendored `tlibc` is used to get a compilable `time.h` for the target.
# - In the unlikely event that the target was installed with rustup, this would error out with
# duplicate core symbols due to `-Z build-std=core`.
run: |
cargo metadata --no-deps --format-version=1 | \
jq -r '.packages[].name' | \
grep -e types | \
xargs -n1 sh -c 'CFLAGS="-isystem${GITHUB_WORKSPACE}/core/build/headers -isystem${GITHUB_WORKSPACE}/core/build/headers/tlibc" cargo +nightly-2022-12-13 build -Z build-std=core --target ${{ matrix.target }} -p $0 --locked || exit 255'
notify:
runs-on: ubuntu-latest
if: failure() && ${{ github.event_name }} == 'push'
needs:
- "lint"
- "deny"
- "sort"
- "clippy"
- "build"
- "build-no-alloc"
- "test"
- "doc"
- "coverage"
steps:
- name: Notify Discord on failure
uses: sarisia/actions-status-discord@v1
with:
username: "Github Actions"
status: Failure
nodetail: true
title: "Workflow: ${{ github.workflow }}"
url: ${{ github.repository_url }}/actions/runs/${{ github.run_id }}
description: |
[@${{ github.pusher }}](${{ github.url }}/${{ github.pusher }}] was the last one to touch ${{ github.repository }}, is all I'm saying...
avatar_url: "https://media0.giphy.com/media/oe33xf3B50fsc/200.gif"
webhook: ${{ secrets.DISCORD_WEBHOOK }}