-
Notifications
You must be signed in to change notification settings - Fork 446
313 lines (298 loc) · 10.6 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
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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
name: CI
on: [push, pull_request]
env:
CARGO_INCREMENTAL: 0
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CC_ENABLE_DEBUG_OUTPUT: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
[
stable,
beta,
nightly,
linux32,
macos,
aarch64-macos,
aarch64-ios,
win32,
win64,
mingw32,
mingw64,
windows-2019,
]
include:
- build: stable
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
- build: beta
os: ubuntu-latest
rust: beta
target: x86_64-unknown-linux-gnu
- build: nightly
os: ubuntu-latest
rust: nightly
target: x86_64-unknown-linux-gnu
- build: linux32
os: ubuntu-latest
rust: stable
target: i686-unknown-linux-gnu
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: aarch64-macos
os: macos-14
rust: stable
target: aarch64-apple-darwin
- build: aarch64-ios
os: macos-latest
rust: stable
target: aarch64-apple-ios
no_run: --no-run
- build: windows-aarch64
os: windows-latest
rust: stable
target: aarch64-pc-windows-msvc
no_run: --no-run
- build: win32
os: windows-2019
rust: stable-i686-msvc
target: i686-pc-windows-msvc
- build: win64
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
- build: mingw32
# windows-latest, a.k.a. windows-2022, runner is equipped with
# a newer mingw toolchain, which appears to produce unexecutable
# mixed-language binaries in debug builds. Fall back to
# windows-2019 for now and revisit it later...
os: windows-2019
rust: stable-i686-gnu
target: i686-pc-windows-gnu
- build: mingw64
os: windows-latest
rust: stable-x86_64-gnu
target: x86_64-pc-windows-gnu
- build: windows-2019
os: windows-2019
rust: stable-x86_64
target: x86_64-pc-windows-msvc
- build: windows-clang
os: windows-2019
rust: stable
target: x86_64-pc-windows-msvc
CC: clang
CXX: clang++
- build: windows-clang-cl
os: windows-2019
rust: stable
target: x86_64-pc-windows-msvc
CC: clang-cl
CXX: clang-cl
steps:
- uses: actions/checkout@v4
- name: Install Rust (rustup)
run: |
set -euxo pipefail
rustup toolchain install ${{ matrix.rust }} --no-self-update --profile minimal --target ${{ matrix.target }}
rustup default ${{ matrix.rust }}
shell: bash
- name: Install g++-multilib
run: |
set -e
# Remove the ubuntu-toolchain-r/test PPA, which is added by default.
# Some packages were removed, and this is causing the g++multilib
# install to fail. Similar issue:
# https://github.com/scikit-learn/scikit-learn/issues/13928.
sudo add-apt-repository --remove ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-multilib
if: matrix.build == 'linux32'
- name: add clang to path
if: startsWith(matrix.build, 'windows-clang')
run: |
echo "C:\msys64\mingw64\bin" >> "$GITHUB_PATH"
echo -e "AR=llvm-ar\nRUSTFLAGS=-Clinker=lld-link\nCC=${CC}\nCXX=${CXX}" >> "$GITHUB_ENV"
shell: bash
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
- name: setup dev environment
uses: ilammy/msvc-dev-cmd@v1
if: startsWith(matrix.build, 'windows-clang')
- uses: Swatinem/rust-cache@v2
- run: cargo test ${{ matrix.no_run }} --workspace --target ${{ matrix.target }}
- run: cargo test ${{ matrix.no_run }} --workspace --target ${{ matrix.target }} --release
- run: cargo test ${{ matrix.no_run }} --workspace --target ${{ matrix.target }} --features parallel
# This is separate from the matrix above because there is no prebuilt rust-std component for these targets.
check-tvos:
name: Test build-std
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [aarch64-tvos, aarch64-tvos-sim, x86_64-tvos]
include:
- build: aarch64-tvos
os: macos-latest
rust: nightly
target: aarch64-apple-tvos
no_run: --no-run
- build: aarch64-tvos-sim
os: macos-latest
rust: nightly
target: aarch64-apple-tvos-sim
no_run: --no-run
- build: x86_64-tvos
os: macos-latest
rust: nightly
target: x86_64-apple-tvos
no_run: --no-run
steps:
- uses: actions/checkout@v4
- name: Install Rust (rustup)
run: |
set -euxo pipefail
rustup toolchain install ${{ matrix.rust }} --no-self-update --profile minimal
rustup component add rust-src --toolchain ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
shell: bash
- uses: Swatinem/rust-cache@v2
- run: cargo test -Z build-std=std ${{ matrix.no_run }} --workspace --target ${{ matrix.target }}
- run: cargo test -Z build-std=std ${{ matrix.no_run }} --workspace --target ${{ matrix.target }} --release
- run: cargo test -Z build-std=std ${{ matrix.no_run }} --workspace --target ${{ matrix.target }} --features parallel
check-wasm:
name: Test wasm
runs-on: ubuntu-latest
strategy:
matrix:
target: [wasm32-unknown-unknown]
steps:
- uses: actions/checkout@v4
- name: Install Rust (rustup)
run: |
rustup target add ${{ matrix.target }}
shell: bash
- uses: Swatinem/rust-cache@v2
- run: cargo test --no-run --target ${{ matrix.target }}
- run: cargo test --no-run --target ${{ matrix.target }} --release
- run: cargo test --no-run --target ${{ matrix.target }} --features parallel
test-wasm32-wasip1-thread:
name: Test wasm32-wasip1-thread
runs-on: ubuntu-latest
env:
TARGET: wasm32-wasip1-threads
steps:
- uses: actions/checkout@v4
- name: Install Rust (rustup)
run: |
rustup toolchain install nightly --no-self-update --profile minimal --target $TARGET
- name: Get latest version of wasi-sdk
env:
REPO: WebAssembly/wasi-sdk
GH_TOKEN: ${{ github.token }}
run: |
set -euxo pipefail
VERSION="$(gh release list --repo $REPO -L 1 --json tagName --jq '.[]|.tagName')"
echo "WASI_TOOLCHAIN_VERSION=$VERSION" >> "$GITHUB_ENV"
- name: Install wasi-sdk
working-directory: /tmp
env:
REPO: WebAssembly/wasi-sdk
run: |
set -euxo pipefail
VERSION="$WASI_TOOLCHAIN_VERSION"
FILE="${VERSION}.0-x86_64-linux.deb"
wget "https://github.com/$REPO/releases/download/${VERSION}/${FILE}"
sudo dpkg -i "${FILE}"
WASI_SDK_PATH="/opt/wasi-sdk"
CC="${WASI_SDK_PATH}/bin/clang"
echo "WASI_SDK_PATH=$WASI_SDK_PATH" >> "$GITHUB_ENV"
echo "CC=$CC" >> "$GITHUB_ENV"
- uses: Swatinem/rust-cache@v2
with:
env-vars: "WASI_TOOLCHAIN_VERSION"
cache-all-crates: "true"
- name: Run tests
run: cargo +nightly build -p $TARGET-test --target $TARGET
cuda:
name: Test CUDA support
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Install cuda-minimal-build-11-8
shell: bash
run: |
# https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_network
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-minimal-build-11-8
- uses: Swatinem/rust-cache@v2
- name: Test 'cudart' feature
shell: bash
run: |
PATH="/usr/local/cuda/bin:$PATH" cargo test --manifest-path dev-tools/cc-test/Cargo.toml --features test_cuda
PATH="/usr/local/cuda/bin:$PATH" CXX=clang++ cargo test --manifest-path dev-tools/cc-test/Cargo.toml --features test_cuda
msrv:
name: MSRV
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
MSRV: 1.63.0
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
rustup toolchain install $MSRV --no-self-update --profile minimal
rustup toolchain install nightly --no-self-update --profile minimal
rustup default $MSRV
shell: bash
- name: Create Cargo.lock with minimal version
run: cargo +nightly update -Zminimal-versions
- uses: Swatinem/rust-cache@v2
- run: env -u CARGO_REGISTRIES_CRATES_IO_PROTOCOL cargo check --lib -p cc --locked
- run: env -u CARGO_REGISTRIES_CRATES_IO_PROTOCOL cargo check --lib -p cc --locked --all-features
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
rustup toolchain install stable --no-self-update --profile minimal --component rustfmt
rustup default stable
shell: bash
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --no-deps
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
rustup toolchain install stable --no-self-update --profile minimal --component rustfmt
rustup default stable
shell: bash
- uses: Swatinem/rust-cache@v2
- run: cargo fmt -- --check
semver-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2