-
Notifications
You must be signed in to change notification settings - Fork 212
201 lines (191 loc) · 6.53 KB
/
main.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
name: CI
on: [push, pull_request]
env:
RUSTDOCFLAGS: -Dwarnings
RUSTFLAGS: -Dwarnings
RUST_LLVM_VERSION: 19.1-2024-09-17
RUST_COMPILER_RT_ROOT: ./compiler-rt
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
rust: nightly
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
rust: nightly
- target: aarch64-pc-windows-msvc
os: windows-latest
rust: nightly
test_verbatim: 1
no_std: 1
- target: arm-unknown-linux-gnueabi
os: ubuntu-latest
rust: nightly
- target: arm-unknown-linux-gnueabihf
os: ubuntu-latest
rust: nightly
- target: i586-unknown-linux-gnu
os: ubuntu-latest
rust: nightly
- target: i686-unknown-linux-gnu
os: ubuntu-latest
rust: nightly
# MIPS targets disabled since they are dropped to tier 3.
# See https://github.com/rust-lang/compiler-team/issues/648
#- target: mips-unknown-linux-gnu
# os: ubuntu-latest
# rust: nightly
#- target: mips64-unknown-linux-gnuabi64
# os: ubuntu-latest
# rust: nightly
#- target: mips64el-unknown-linux-gnuabi64
# os: ubuntu-latest
# rust: nightly
#- target: mipsel-unknown-linux-gnu
# os: ubuntu-latest
# rust: nightly
- target: powerpc-unknown-linux-gnu
os: ubuntu-latest
rust: nightly
- target: powerpc64-unknown-linux-gnu
os: ubuntu-latest
rust: nightly
- target: powerpc64le-unknown-linux-gnu
os: ubuntu-latest
rust: nightly
- target: riscv64gc-unknown-linux-gnu
os: ubuntu-latest
rust: nightly
- target: thumbv6m-none-eabi
os: ubuntu-latest
rust: nightly
- target: thumbv7em-none-eabi
os: ubuntu-latest
rust: nightly
- target: thumbv7em-none-eabihf
os: ubuntu-latest
rust: nightly
- target: thumbv7m-none-eabi
os: ubuntu-latest
rust: nightly
- target: wasm32-unknown-unknown
os: ubuntu-latest
rust: nightly
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
rust: nightly
- target: x86_64-apple-darwin
os: macos-13
rust: nightly
- target: i686-pc-windows-msvc
os: windows-latest
rust: nightly
test_verbatim: 1
- target: x86_64-pc-windows-msvc
os: windows-latest
rust: nightly
test_verbatim: 1
- target: i686-pc-windows-gnu
os: windows-latest
rust: nightly-i686-gnu
- target: x86_64-pc-windows-gnu
os: windows-latest
rust: nightly-x86_64-gnu
steps:
- name: Print runner information
run: uname -a
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Rust (rustup)
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
shell: bash
- run: rustup target add ${{ matrix.target }}
- run: rustup component add llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Cache Docker layers
uses: actions/cache@v2
if: matrix.os == 'ubuntu-latest'
with:
path: /tmp/.buildx-cache
key: ${{ matrix.target }}-buildx-${{ github.sha }}
restore-keys: ${{ matrix.target }}-buildx-
- name: Cache compiler-rt
id: cache-compiler-rt
uses: actions/cache@v4
with:
path: compiler-rt
key: ${{ runner.os }}-compiler-rt-${{ env.RUST_LLVM_VERSION }}
- name: Download compiler-rt reference sources
if: steps.cache-compiler-rt.outputs.cache-hit != 'true'
run: |
curl -L -o code.tar.gz "https://github.com/rust-lang/llvm-project/archive/rustc/${RUST_LLVM_VERSION}.tar.gz"
tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-${RUST_LLVM_VERSION}/compiler-rt
shell: bash
# Non-linux tests just use our raw script
- run: ./ci/run.sh ${{ matrix.target }}
if: matrix.os != 'ubuntu-latest'
shell: bash
env:
NO_STD: ${{ matrix.no_std }}
TEST_VERBATIM: ${{ matrix.test_verbatim }}
# Configure buildx to use Docker layer caching
- uses: docker/setup-buildx-action@v3
if: matrix.os == 'ubuntu-latest'
# Otherwise we use our docker containers to run builds
- run: cargo generate-lockfile && ./ci/run-docker.sh ${{ matrix.target }}
if: matrix.os == 'ubuntu-latest'
# Workaround to keep Docker cache smaller
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move Docker cache
if: matrix.os == 'ubuntu-latest'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable `rustfmt`
run: rustup set profile minimal && rustup default stable && rustup component add rustfmt
- run: cargo fmt -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
# Unlike rustfmt, stable clippy does not work on code with nightly features.
# This acquires the most recent nightly with a clippy component.
- name: Install nightly `clippy`
run: |
rustup set profile minimal && rustup default "nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy)" && rustup component add clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy -- -D clippy::all
success:
needs:
- test
- rustfmt
- clippy
runs-on: ubuntu-latest
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
# dependencies fails.
if: always() # make sure this is never "skipped"
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: check if any dependency failed
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'