-
Notifications
You must be signed in to change notification settings - Fork 4
203 lines (157 loc) · 5.02 KB
/
ci.yml
File metadata and controls
203 lines (157 loc) · 5.02 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
# Cancel in-progress runs when new commits are pushed
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: line-tables-only
RUSTFLAGS: "-Dwarnings"
RUST_BACKTRACE: 1
jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install just
uses: extractions/setup-just@v4
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: Run tests (Unix)
if: runner.os != 'Windows'
run: just test
- name: Install OpenSSL (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
echo "Installing OpenSSL via vcpkg..."
vcpkg integrate install
vcpkg install openssl:x64-windows-static-md
$opensslDir = "$env:VCPKG_INSTALLATION_ROOT\installed\x64-windows-static-md"
echo "OPENSSL_DIR=$opensslDir" >> $env:GITHUB_ENV
echo "OPENSSL_LIB_DIR=$opensslDir\lib" >> $env:GITHUB_ENV
echo "OPENSSL_INCLUDE_DIR=$opensslDir\include" >> $env:GITHUB_ENV
- name: Run tests (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
cargo build
echo "Running tests with cargo nextest..."
SKIP_INTEGRATION_TESTS=1 cargo nextest run --lib
echo "Running safe integration tests..."
SKIP_INTEGRATION_TESTS=1 cargo nextest run --test analyzer_tests \
--test complexity_tests --test core_metrics_tests \
--test debt_tests --test entropy_tests
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install SARIF tools
run: cargo install clippy-sarif sarif-fmt --locked
- name: Run Clippy with SARIF output
run: >
cargo clippy --workspace --all-features --all-targets --message-format=json
| clippy-sarif
| tee clippy-results.sarif
| sarif-fmt
continue-on-error: true
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: clippy-results.sarif
wait-for-processing: true
- name: Check for errors
run: cargo clippy --all-targets --all-features -- -D warnings
msrv:
name: Check MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Check MSRV
run: cargo hack check --each-feature --locked --rust-version --workspace --all-targets --keep-going
minimal-versions:
name: Minimal versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Generate minimal lockfile
run: cargo +nightly generate-lockfile -Z minimal-versions
- name: Check with minimal versions
run: cargo +stable check --workspace --all-features --locked
feature-combinations:
name: Feature combinations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Test each feature combination
run: cargo hack check --each-feature --workspace --keep-going
# Aggregation job that reports overall CI status
ci:
name: CI
needs: [test, lint, clippy, msrv, minimal-versions, feature-combinations]
runs-on: ubuntu-latest
if: always()
steps:
- name: Failed
run: exit 1
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')