-
Notifications
You must be signed in to change notification settings - Fork 153
185 lines (178 loc) · 5.54 KB
/
Copy pathci.yaml
File metadata and controls
185 lines (178 loc) · 5.54 KB
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
name: CI
on:
push:
branches:
- master
- "v*.*"
pull_request:
branches:
- master
- "v*.*"
schedule:
- cron: "0 0 * * 0"
jobs:
lock:
name: Cargo.lock
runs-on: ubuntu-latest
steps:
- name: Checkout the Repository
uses: actions/checkout@v4
- name: Install the Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- name: Generate the minimum version lockfile
run: |
cargo update -Z minimal-versions -Z direct-minimal-versions
mv Cargo.lock Cargo.lock.min
- name: Generate the current version lockfile
run: cargo update
- name: Upload the Cargo lockfiles
uses: actions/upload-artifact@v4
with:
name: Cargo.lock
path: |
Cargo.lock
Cargo.lock.min
check:
name: Check (${{ matrix.rust }}${{ matrix.lock == '"Cargo.lock.min"' && ' (Cargo.lock.min)' || ''}})
runs-on: ubuntu-latest
needs: lock
strategy:
matrix:
rust: [1.64.0, stable, nightly]
lock: ["Cargo.lock", "Cargo.lock.min"]
exclude:
- rust: 1.64.0
lock: "Cargo.lock"
steps:
- uses: actions/checkout@v4
- name: Download the Cargo lockfiles
uses: actions/download-artifact@v4
with:
name: Cargo.lock
- name: Rename ${{ matrix.lock }} to Cargo.lock
run: mv ${{ matrix.lock }} Cargo.lock
if: ${{ matrix.lock != 'Cargo.lock' }}
- uses: ./.github/actions/setup
with:
key: test-${{ matrix.rust }}-${{ matrix.lock }}
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
components: clippy
override: true
- uses: taiki-e/install-action@cargo-hack
- name: Check
run: |
cargo hack check --feature-powerset --no-dev-deps
- name: Clean
run: |
cargo clean
- name: Clippy
run: |
cargo hack clippy --feature-powerset --no-dev-deps -- -D warnings -A unknown-lints
# Clippy will report lints that cannot be acted on without increasing MSRV on later versions of Rust
if: ${{ matrix.rust == '1.64.0' }}
- name: Clean
run: |
cargo clean
- name: Test
run: |
cargo hack test --feature-powerset --clean-per-run
clippy-fuzz:
name: "Clippy: Fuzzer"
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
key: clippy-fuzz
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy
override: true
- run: cd fuzz && cargo clippy --all -- -D warnings
rustfmt:
name: "Format: stable"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
key: rustfmt-stable
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt
override: true
- run: cargo fmt --all -- --check
- run: cd fuzz && cargo fmt --all -- --check
coverage:
name: "Coverage: stable"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
key: coverage
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: llvm-tools-preview
override: true
- name: Download grcov
run: |
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.18/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf -
chmod +x ./grcov
- name: Generate the coverage data
run: |
cargo clean
cargo test --all-targets
cargo test --features integer128 --all-targets
cargo test --features indexmap --all-targets
cargo test --all-features --all-targets
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: -Cinstrument-coverage
RUSTDOCFLAGS: -Cinstrument-coverage
LLVM_PROFILE_FILE: coverage/coverage-%p-%m.profraw
- name: Generate the coverage reports
run: |
./grcov . -s . --binary-path ./target/debug/deps \
-t lcov -o coverage.lcov --branch \
--keep-only "src/*" \
--keep-only "tests/*" \
--ignore-not-existing \
--excl-line GRCOV_EXCL_LINE \
--excl-start GRCOV_EXCL_START \
--excl-stop GRCOV_EXCL_STOP
./grcov . -s . --binary-path ./target/debug/deps \
-t html --branch \
--keep-only "src/*" \
--keep-only "tests/*" \
--ignore-not-existing \
--excl-line GRCOV_EXCL_LINE \
--excl-start GRCOV_EXCL_START \
--excl-stop GRCOV_EXCL_STOP
rm -rf html/badges
# - name: Upload the coverage report to codecov.io
# uses: codecov/codecov-action@v1
# with:
# files: coverage.lcov
# fail_ci_if_error: true
- name: Deploy the code coverage report
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./html
destination_dir: coverage
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'