-
Notifications
You must be signed in to change notification settings - Fork 6
158 lines (137 loc) · 4.4 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
name: CI
on:
push:
branches:
- master
pull_request:
# Daily
schedule:
- cron: "0 4 1/20 * *"
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
RUST_LOG: info
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
test:
name: Test ${{ matrix.rust }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable, nightly]
steps:
# setup
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
- uses: taiki-e/install-action@nextest
# tests
- name: Library Tests | Default Features
run: cargo nextest run --profile ci-default-features --tests --examples --verbose
- name: Library Tests | All Features
run: cargo nextest run --profile ci-all-features --tests --examples --verbose --all-features
- name: Library Tests | All Features (Release)
run: cargo nextest run --profile ci-all-features-release --tests --examples --verbose --all-features --release
- name: Doc Tests
run: cargo test --doc --verbose --all-features
# upload test results
- uses: actions/upload-artifact@v3
if: success() || failure() # run this step even if previous step failed
with:
name: test-results-${{ matrix.rust }}-${{ matrix.os }}
path: target/nextest/**/junit-*.xml
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly
- name: Cargo Check
run: cargo check --all-targets --all-features
clippy:
name: Clippy
runs-on: ubuntu-latest
env:
RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
components: clippy
- run: cargo clippy --all-targets --all-features --verbose -- -D warnings
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly
components: rustfmt
- run: cargo fmt -p cstree -- --check
rustdoc:
name: Check doc links
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings --cfg doc_cfg
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly
- run: cargo doc --all-features --document-private-items --no-deps
miri-test:
name: Miri ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly
components: miri
env:
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance
- run: cargo miri test --verbose --all-features
sanitizers:
name: ${{ matrix.sanitizer }} sanitizer
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sanitizer: [address, memory, thread, leak]
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly
components: rust-src
- name: Test with sanitizer
env:
RUSTFLAGS: -Zsanitizer=${{ matrix.sanitizer }}
RUSTDOCFLAGS: -Zsanitizer=${{ matrix.sanitizer }}
# only needed by asan
ASAN_OPTIONS: detect_stack_use_after_return=1
# Asan's leak detection occasionally complains
# about some small leaks if backtraces are captured,
# so ensure they're not
RUST_BACKTRACE: 0
run: |
cargo test -Zbuild-std --verbose --target=x86_64-unknown-linux-gnu --all-features