-
-
Notifications
You must be signed in to change notification settings - Fork 62
268 lines (257 loc) · 10 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
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
name: CI
permissions:
contents: read
on:
pull_request:
push:
branches:
- main
- dev
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
env:
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10
CARGO_LLVM_COV_DENY_WARNINGS: 1
defaults:
run:
shell: bash --noprofile --norc -CeEuxo pipefail {0}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
deny:
uses: taiki-e/github-actions/.github/workflows/deny.yml@main
miri:
uses: taiki-e/github-actions/.github/workflows/miri.yml@main
msrv:
uses: taiki-e/github-actions/.github/workflows/msrv.yml@main
with:
event_name: ${{ github.event_name }}
release-dry-run:
uses: taiki-e/github-actions/.github/workflows/release-dry-run.yml@main
tidy:
uses: taiki-e/github-actions/.github/workflows/tidy.yml@main
permissions:
contents: read
pull-requests: write # for gh pr edit --add-assignee
repository-projects: read # for gh pr edit --add-assignee
secrets: inherit
test:
strategy:
fail-fast: false
matrix:
include:
- rust: '1.81'
- rust: stable
- rust: beta
- rust: nightly
- rust: nightly
os: macos-latest
- rust: nightly
os: windows-latest
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
timeout-minutes: 60
steps:
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/github-actions/install-rust@main
with:
toolchain: ${{ matrix.rust }}
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-minimal-versions
- uses: taiki-e/install-action@nextest
- run: cargo test --workspace --all-features
# TODO: move this test to tests/test.rs
- run: cargo install --path . --debug
- name: Test cargo llvm-cov nextest
run: |
cargo llvm-cov nextest --text --fail-under-lines 50
cargo llvm-cov nextest --text --fail-under-lines 50 --profile default --cargo-profile dev
cargo llvm-cov nextest --text --fail-under-lines 50 --profile ci
cargo llvm-cov nextest --text --fail-under-lines 50 --profile ci --cargo-profile dev
cd -- ../real1
cargo llvm-cov nextest-archive --archive-file a.tar.zst
cargo llvm-cov nextest --archive-file a.tar.zst --text --fail-under-lines 70
cargo llvm-cov report --nextest-archive-file a.tar.zst --fail-under-lines 70
rm -- a.tar.zst
cargo clean
cargo llvm-cov nextest-archive --archive-file a.tar.zst --release
cargo llvm-cov nextest --archive-file a.tar.zst --text --fail-under-lines 70
cargo llvm-cov report --nextest-archive-file a.tar.zst --fail-under-lines 70
rm -- a.tar.zst
cargo clean
cargo llvm-cov nextest-archive --archive-file a.tar.zst --cargo-profile custom
cargo llvm-cov nextest --archive-file a.tar.zst --text --fail-under-lines 70
cargo llvm-cov report --nextest-archive-file a.tar.zst --fail-under-lines 70
rm -- a.tar.zst
cargo clean
host=$(rustc -vV | grep -E '^host:' | cut -d' ' -f2)
cargo llvm-cov nextest-archive --archive-file a.tar.zst --target "${host}"
cargo llvm-cov nextest --archive-file a.tar.zst --text --fail-under-lines 70
cargo llvm-cov report --nextest-archive-file a.tar.zst --fail-under-lines 70
working-directory: tests/fixtures/crates/bin_crate
- name: Test nightly-specific options, old Cargo compatibility, trybuild compatibility
run: |
retry() {
for i in {1..10}; do
if "$@"; then
return 0
else
sleep "${i}"
fi
done
"$@"
}
unset RUSTFLAGS
# Test nightly-specific options
retry git clone https://github.com/taiki-e/easytime.git
pushd -- easytime >/dev/null
git checkout 7ecb6e6
cargo llvm-cov test --doctests --text --fail-under-lines 30
popd >/dev/null
pushd -- tests/fixtures/crates/cargo_config >/dev/null
# TODO: --fail-under-branches?
cargo llvm-cov test --branch --text --fail-under-lines 80
cargo llvm-cov test --mcdc --text --fail-under-lines 80
popd >/dev/null
pushd -- easytime >/dev/null
cargo llvm-cov test --branch --doctests --text --fail-under-lines 30
cargo llvm-cov test --mcdc --doctests --text --fail-under-lines 30
popd >/dev/null
# Test minimum runnable Cargo version.
retry rustup toolchain add 1.60 --no-self-update
pushd -- easytime >/dev/null
cargo +1.60 llvm-cov test --text --fail-under-lines 30
popd >/dev/null
# Test trybuild compatibility.
retry git clone --depth 1 https://github.com/taiki-e/easy-ext.git
pushd -- easy-ext >/dev/null
cargo llvm-cov --text --test compiletest --fail-under-lines 70
popd >/dev/null
if: startsWith(matrix.rust, 'nightly')
- run: cargo hack build --workspace --no-private --feature-powerset --no-dev-deps
- run: cargo minimal-versions build --workspace --no-private --detach-path-deps=skip-exact --all-features
test-llvm:
strategy:
fail-fast: false
matrix:
# LLVM version table:
# - LLVM 14: 1.60-1.64
# - LLVM 15: 1.65-1.69
# - LLVM 16: 1.70-1.72
# - LLVM 17: 1.73-1.77
# - LLVM 18: 1.78-1.81
# - LLVM 19: 1.82-
# Minimum external LLVM version table:
# - LLVM 12 1.58-1.64
# - LLVM 13 1.65-1.68
# - LLVM 14 1.69-1.72
# - LLVM 15 1.73-1.75
# - LLVM 16 1.76-1.78
# - LLVM 17 1.79-1.82
# - LLVM 18 1.83-
llvm:
# - '12'
# - '13'
- '14'
- '15'
- '16'
- '17'
- '18'
- '19'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/github-actions/install-rust@stable
- name: Install LLVM
run: |
retry() {
for i in {1..10}; do
if "$@"; then
return 0
else
sleep "${i}"
fi
done
"$@"
}
if type -P clang-"${{ matrix.llvm }}" &>/dev/null; then
exit 0
fi
codename=$(grep -E '^VERSION_CODENAME=' /etc/os-release | cut -d= -f2)
sudo mkdir -pm755 -- /etc/apt/keyrings
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused https://apt.llvm.org/llvm-snapshot.gpg.key \
| gpg --dearmor \
| sudo tee -- /etc/apt/keyrings/llvm-snapshot.gpg >/dev/null
sudo tee -- "/etc/apt/sources.list.d/llvm-toolchain-${codename}-${{ matrix.llvm }}.list" >/dev/null \
<<<"deb [signed-by=/etc/apt/keyrings/llvm-snapshot.gpg] http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${{ matrix.llvm }} main"
retry sudo apt-get -o Acquire::Retries=10 -qq update
apt_packages=(
clang-"${{ matrix.llvm }}"
libc++-"${{ matrix.llvm }}"-dev
libc++abi-"${{ matrix.llvm }}"-dev
libclang-"${{ matrix.llvm }}"-dev
lld-"${{ matrix.llvm }}"
llvm-"${{ matrix.llvm }}"
llvm-"${{ matrix.llvm }}"-dev
)
if ! sudo apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends "${apt_packages[@]}"; then
retry sudo apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 upgrade -y
retry sudo apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends "${apt_packages[@]}"
fi
- run: cargo install --path . --debug
- name: Test
run: |
retry() {
for i in {1..10}; do
if "$@"; then
return 0
else
sleep "${i}"
fi
done
"$@"
}
export CC="clang-${{ matrix.llvm }}"
export CXX="clang++-${{ matrix.llvm }}"
export LLVM_COV="llvm-cov-${{ matrix.llvm }}"
export LLVM_PROFDATA="llvm-profdata-${{ matrix.llvm }}"
case "${{ matrix.llvm }}" in
1[0-7])
retry rustup toolchain add 1.60 1.65 1.70 1.73 1.77 --no-self-update
cargo clean
cargo +1.60 llvm-cov test --text --include-ffi --fail-under-lines 70 -vv
cargo clean
cargo +1.65 llvm-cov test --text --include-ffi --fail-under-lines 70 -vv
cargo clean
cargo +1.70 llvm-cov test --text --include-ffi --fail-under-lines 70 -vv
cargo clean
cargo +1.73 llvm-cov test --text --include-ffi --fail-under-lines 70 -vv
cargo clean
cargo +1.77 llvm-cov test --text --include-ffi --fail-under-lines 70 -vv
;;
18)
retry rustup toolchain add 1.78 1.81 --no-self-update
cargo clean
cargo +1.78 llvm-cov test --text --include-ffi --fail-under-lines 70 -vv
cargo clean
cargo +1.81 llvm-cov test --text --include-ffi --fail-under-lines 70 -vv
;;
*)
retry rustup toolchain add 1.82 beta nightly --no-self-update
cargo clean
cargo +1.82 llvm-cov test --text --include-ffi --fail-under-lines 70 -vv
cargo clean
cargo +beta llvm-cov test --text --include-ffi --fail-under-lines 70 -vv
cargo clean
cargo +nightly llvm-cov test --text --include-ffi --fail-under-lines 70 -vv
;;
esac
working-directory: tests/fixtures/crates/ffi