-
Notifications
You must be signed in to change notification settings - Fork 448
239 lines (232 loc) · 8.14 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
name: CI
on: [push, pull_request]
env:
CARGO_INCREMENTAL: 0
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CC_ENABLE_DEBUG_OUTPUT: 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
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
msrv:
name: MSRV
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
rustup toolchain install 1.63.0 --no-self-update --profile minimal
rustup toolchain install nightly --no-self-update --profile minimal
rustup default 1.63.0
shell: bash
- name: Create Cargo.lock with minimal version
run: cargo +nightly update -Zminimal-versions
- name: Cache downloaded crates since 1.63 is really slow in fetching
uses: Swatinem/rust-cache@v2
- run: cargo check --lib -p cc --locked
- run: 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
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