-
Notifications
You must be signed in to change notification settings - Fork 18
267 lines (249 loc) · 7.86 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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "00 01 * * *"
env:
RUST_BACKTRACE: short
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
jobs:
# Test on stable and MSRV
test:
name: Test Rust - ${{ matrix.build }}
runs-on: ${{ matrix.os }}
env:
CARGO: cargo
TARGET: ""
strategy:
fail-fast: false
matrix:
build:
- macos
- linux
- linux32
- win64-msvc
- win64-gnu
- win32-msvc
- win32-gnu
# - msrv
- beta
- nightly
- arm32
- arm64
- mips32
- mips64
include:
- build: linux
os: ubuntu-latest
rust: stable
- build: macos
os: macos-latest
rust: stable
- build: win64-msvc
os: windows-2019
rust: stable
- build: win64-gnu
os: windows-2019
rust: stable-x86_64-gnu
- build: win32-msvc
os: windows-2019
rust: stable-i686-msvc
- build: win32-gnu
os: windows-2019
rust: stable-i686-gnu
# TODO: re-enable this I guess. I get inscrutable errors like
# `error reading from the zlib stream; class=Zlib (5)` in CI
# that don't repro locally, and I'm tired of getting an email
# about this every day.
#
# - build: msrv
# os: ubuntu-latest
# rust: "1.43.0"
- build: beta
os: ubuntu-latest
rust: beta
- build: nightly
os: ubuntu-latest
rust: nightly
- build: linux32
os: ubuntu-latest
rust: stable
target: i686-unknown-linux-gnu
# These should prob. be more generic arm targets and not android.
- build: arm32
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-gnueabihf
- build: arm64
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
# Mips is big endian. Nothing currently in here cares... but will if I
# ever get around to that `key` stuff.
- build: mips32
os: ubuntu-latest
rust: stable
target: mips-unknown-linux-gnu
- build: mips64
os: ubuntu-latest
rust: stable
target: mips64-unknown-linux-gnuabi64
# Requested by a user not sure if it adds anything we aren't already
# testing but it's easy enough so *shrug*.
- build: riscv
os: ubuntu-latest
rust: stable
target: riscv64gc-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- uses: taiki-e/install-action@cross
if: matrix.target != ''
- if: matrix.target != ''
run: |
echo "CARGO=cross" >> $GITHUB_ENV
echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV
# We have some tests that make sure functionality not present in old
# versions behaves as expected (for example, `arcstr::format!("{foo}")`)
# To test this, we put them behind `#[cfg(not(msrv))]`.
- if: matrix.build == 'msrv'
run: echo "RUSTFLAGS=--cfg msrv" >> $GITHUB_ENV
- run: |
echo "cargo command is: ${{ env.CARGO }}"
echo "target flag is: ${{ env.TARGET }}"
echo "rustflags are: ${{ env.RUSTFLAGS }}"
- run: ${{ env.CARGO }} test --no-default-features --verbose ${{ env.TARGET }}
- run: ${{ env.CARGO }} test --verbose ${{ env.TARGET }}
- run: ${{ env.CARGO }} test --verbose --features="serde substr std" ${{ env.TARGET }}
- run: ${{ env.CARGO }} test --all-features --verbose ${{ env.TARGET }}
loom:
name: Loom tests
runs-on: ubuntu-latest
env:
RUSTFLAGS: --cfg loom -Dwarnings
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- run: cargo test --all-features --lib
- run: cargo test --no-default-features --lib
miri:
name: Miri
runs-on: ubuntu-latest
env:
MIRIFLAGS: -Zmiri-tag-raw-pointers
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: miri, rust-src
override: true
- run: cargo miri test --all-features
- run: cargo miri test --features="std serde substr"
- run: cargo miri test
cargo-clippy:
name: Lint
runs-on: ubuntu-latest
env:
RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
minimal: true
override: true
- run: cargo clippy --workspace --all-targets --verbose
- run: cargo clippy --workspace --all-targets --verbose --all-features
- run: cargo clippy --workspace --all-targets --verbose --features="serde std substr"
- run: cargo clippy --workspace --all-targets --verbose --no-default-features
# Ensure patch is formatted.
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
minimal: true
override: true
- run: cargo fmt --all -- --check
# Check doc reference links are all valid.
doc:
name: Doc check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
minimal: true
override: true
- run: cargo doc --features="serde std substr"
sanitizers:
name: Test sanitizer ${{ matrix.sanitizer }}
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: 0
# only used by asan, but we set it for all of them cuz its easy
ASAN_OPTIONS: detect_stack_use_after_return=1
strategy:
fail-fast: false
matrix:
sanitizer: [address, thread, memory]
# could do this instead of repeating 3x in the test invocation, but lets not be wasteful
# test_flags: ['--features="std serde substr"', '--no-default-features', '--all-features']
include:
- sanitizer: memory
extra_rustflags: "-Zsanitizer-memory-track-origins"
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rust-src
- name: Test with sanitizer
env:
RUSTFLAGS: -Zsanitizer=${{ matrix.sanitizer }} ${{ matrix.extra_rustflags }}
RUSTDOCFLAGS: -Zsanitizer=${{ matrix.sanitizer }} ${{ matrix.extra_rustflags }}
run: |
echo "note: RUSTFLAGS='$RUSTFLAGS'"
cargo -Zbuild-std test --target=x86_64-unknown-linux-gnu --features="std serde substr"
cargo -Zbuild-std test --target=x86_64-unknown-linux-gnu --all-features
cargo -Zbuild-std test --target=x86_64-unknown-linux-gnu --no-default-features
codecov:
name: Generate code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Run cargo-tarpaulin
uses: actions-rs/[email protected]
- name: Upload to codecov.io
uses: codecov/codecov-action@v1