1
1
---
2
2
name : CI
3
-
4
3
on :
5
4
pull_request :
6
- branches :
7
- - main
5
+ branches : [main]
8
6
types : [opened, synchronize, reopened, ready_for_review]
9
7
push :
10
8
branches :
11
9
- main
12
-
13
10
# run concurrency group for the workflow
14
11
concurrency :
15
12
group : ${{ github.workflow }}-${{ github.ref }}
16
13
cancel-in-progress : true
17
-
18
14
jobs :
19
15
changed_files :
20
16
if : ${{ github.event.pull_request.draft == false }}
21
17
runs-on : ubuntu-latest
22
18
name : Test changed-files
23
19
outputs :
24
20
changed-rust-files : ${{ steps.changed-files-yaml.outputs.code_any_changed }}
25
- changed-lockfile-files : ${{ steps.changed-files-yaml.outputs.lockfile_any_changed
26
- }}
27
- changed-docker-files : ${{ steps.changed-files-yaml.outputs.docker_any_changed
28
- }}
29
- changed-tests-files : ${{ steps.changed-files-yaml.outputs.tests_any_changed
30
- }}
21
+ changed-lockfile-files : ${{ steps.changed-files-yaml.outputs.lockfile_any_changed }}
22
+ changed-docker-files : ${{ steps.changed-files-yaml.outputs.docker_any_changed }}
23
+ changed-tests-files : ${{ steps.changed-files-yaml.outputs.tests_any_changed }}
31
24
steps :
32
25
# Checkout the repository
33
26
- name : Checkout Code
34
27
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35
-
36
28
- name : Get changed files
37
29
id : changed-files-yaml
38
30
uses : tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
52
44
tests:
53
45
- '**/*.rs'
54
46
- tests/**/*.json
55
-
56
47
ci :
57
48
if : ${{ github.event.pull_request.draft == false && always() }}
58
49
permissions :
@@ -64,48 +55,37 @@ jobs:
64
55
- name : Failed
65
56
run : exit 1
66
57
if : contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
67
-
68
58
msrv :
69
59
if : |
70
- ${{ github.event.pull_request.draft == false
71
- && github.event_name != 'push'
72
- && ( needs.changed_files.outputs.changed-rust-files == 'true' || needs.changed_files.outputs.changed-lockfile-files == 'true')
73
- }}
60
+ ${{ github.event.pull_request.draft == false && github.event_name != 'push' && ( needs.changed_files.outputs.changed-rust-files == 'true' || needs.changed_files.outputs.changed-lockfile-files == 'true') }}
74
61
runs-on : ubuntu-latest
75
62
needs : changed_files
76
63
steps :
77
64
# Checkout the repository
78
65
- name : Checkout Code
79
66
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
80
-
81
67
- name : Prepare
82
68
id : init
83
69
uses : ./.github/actions/prepare
84
70
85
71
# Get the output of the prepare composite action
86
72
- name : Get cache-hit output
87
73
run : ' echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
88
-
89
74
- name : Install cargo hack
90
75
uses : taiki-e/install-action@cargo-hack
91
76
92
77
# Check the minimum supported Rust version
93
78
- name : Default features
94
79
run : cargo hack check --feature-powerset --locked --rust-version --all-targets
95
-
96
80
lockfile :
97
81
if : |
98
- ${{ github.event.pull_request.draft == false
99
- && github.event_name != 'push'
100
- && needs.changed_files.outputs.changed-lockfile-files == 'true'
101
- }}
82
+ ${{ github.event.pull_request.draft == false && github.event_name != 'push' && needs.changed_files.outputs.changed-lockfile-files == 'true' }}
102
83
needs : changed_files
103
84
runs-on : ubuntu-latest
104
85
steps :
105
86
# Checkout the repository
106
87
- name : Checkout Code
107
88
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
108
-
109
89
- name : Prepare
110
90
id : init
111
91
uses : ./.github/actions/prepare
@@ -117,21 +97,15 @@ jobs:
117
97
# Check the lockfile
118
98
- name : Validate lockfile updates
119
99
run : cargo update --locked
120
-
121
100
rustfmt :
122
101
if : |
123
- ${{
124
- github.event.pull_request.draft == false
125
- && github.event_name != 'push'
126
- && needs.changed_files.outputs.changed-rust-files == 'true'
127
- }}
102
+ ${{ github.event.pull_request.draft == false && github.event_name != 'push' && needs.changed_files.outputs.changed-rust-files == 'true' }}
128
103
needs : changed_files
129
104
runs-on : ubuntu-latest
130
105
steps :
131
106
# Checkout the repository
132
107
- name : Checkout Code
133
108
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
134
-
135
109
- name : Prepare
136
110
id : init
137
111
uses : ./.github/actions/prepare
@@ -144,63 +118,30 @@ jobs:
144
118
- name : Check formatting
145
119
run : cargo fmt --all -- --check
146
120
121
+ # lint checks
147
122
clippy :
148
123
if : |
149
- ${{ github.event.pull_request.draft == false
150
- && github.event_name != 'push'
151
- && needs.changed_files.outputs.changed-rust-files == 'true'
152
- }}
124
+ ${{ github.event.pull_request.draft == false && github.event_name != 'push' && needs.changed_files.outputs.changed-rust-files == 'true' }}
153
125
needs : changed_files
154
126
runs-on : ubuntu-latest
155
127
steps :
156
128
# Checkout the repository
157
129
- name : Checkout Code
158
130
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
159
-
160
131
- name : Prepare
161
132
id : init
162
133
uses : ./.github/actions/prepare
163
134
164
135
# Get the output of the prepare composite action
165
136
- name : Get cache-hit output
166
137
run : ' echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
167
-
168
- - name : Install SARIF tools
169
- run : cargo install clippy-sarif --locked
170
-
171
- - name : Install SARIF tools
172
- run : cargo install sarif-fmt --locked
173
-
174
138
- name : Check
175
- run : >
176
- cargo clippy --all-features --all-targets --message-format=json
177
- | clippy-sarif
178
- | tee clippy-results.sarif
179
- | sarif-fmt
180
- continue-on-error : true
181
-
182
- - name : upload sarif artifact
183
- uses : actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
184
- with :
185
- name : clippy-results.sarif
186
- path : clippy-results.sarif
187
- retention-days : 1
188
-
189
- - name : Upload
190
- uses : github/codeql-action/upload-sarif@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3.28.3
191
- with :
192
- sarif_file : clippy-results.sarif
193
- wait-for-processing : true
194
-
195
- # - name: Report status
196
- # run: cargo clippy --all-features --all-targets -- -D warnings --allow deprecated
197
- # --locked
139
+ run : cargo clippy --all-features --all-targets -- -D warnings
198
140
141
+ # Run tests
199
142
test :
200
143
if : |
201
- ${{ github.event.pull_request.draft == false
202
- && needs.changed_files.outputs.changed-tests-files == 'true'
203
- }}
144
+ ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-tests-files == 'true' }}
204
145
permissions :
205
146
contents : read
206
147
needs : changed_files
@@ -209,63 +150,44 @@ jobs:
209
150
# Checkout the repository
210
151
- name : Checkout Code
211
152
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
212
-
213
153
- name : Prepare
214
154
id : init
215
155
uses : ./.github/actions/prepare
216
156
217
157
# Get the output of the prepare composite action
218
158
- name : Get cache-hit output
219
159
run : ' echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
220
-
221
160
- name : Setup Rust
222
161
uses : actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
223
162
with :
224
163
toolchain : stable
225
164
components : llvm-tools-preview
226
165
rustflags : ' '
227
-
228
166
- name : Install cargo hack
229
167
uses : taiki-e/install-action@cargo-hack
230
-
231
168
- name : Install cargo-llvm-cov
232
169
uses : taiki-e/install-action@cargo-llvm-cov
233
-
234
170
- name : Build
235
171
run : cargo test --no-run --locked
236
172
237
173
# Unit tests coverage
238
- - name : Run Unit Tests
174
+ - name : Generate Unit Coverage Report
239
175
env :
240
176
LLVM_PROFILE_FILE : unit-%p-%m.profraw
241
177
RUSTFLAGS : -Cinstrument-coverage
242
- run : cargo hack llvm-cov --no-report --feature-powerset --locked --lib
243
-
244
- - name : Generate Unit Coverage Report
245
- run : RUST_TEST_THREADS=1 cargo llvm-cov --locked --lcov --output-path unit-lcov.info
246
- --lib
178
+ run : RUST_TEST_THREADS=1 cargo hack llvm-cov --locked --lcov --output-path unit-lcov.info --lib
247
179
248
180
# Integration tests coverage
249
- - name : Run Integration Tests
181
+ - name : Generate Integration Coverage Report
250
182
env :
251
183
LLVM_PROFILE_FILE : integration-%p-%m.profraw
252
184
RUSTFLAGS : -Cinstrument-coverage
253
- run : cargo hack llvm-cov --no-report --feature-powerset --locked --test integration
254
-
255
- - name : Generate Integration Coverage Report
256
- run : RUST_TEST_THREADS=1 cargo llvm-cov --locked --lcov --output-path integration-lcov.info
257
- --test integration
258
-
259
- # Properties tests coverage
260
- - name : Run Properties Tests
185
+ run : RUST_TEST_THREADS=1 cargo hack llvm-cov --locked --lcov --output-path integration-lcov.info --test integration
186
+ - name : Generate Properties Coverage Report
261
187
env :
262
188
LLVM_PROFILE_FILE : properties-%p-%m.profraw
263
189
RUSTFLAGS : -Cinstrument-coverage
264
- run : cargo hack llvm-cov --no-report --feature-powerset --locked --test properties
265
-
266
- - name : Generate Properties Coverage Report
267
- run : RUST_TEST_THREADS=1 cargo llvm-cov --locked --lcov --output-path properties-lcov.info
268
- --test properties
190
+ run : RUST_TEST_THREADS=1 cargo hack llvm-cov --locked --lcov --output-path properties-lcov.info --test properties
269
191
270
192
# Upload unit coverage
271
193
- name : Upload Unit Coverage to Codecov
@@ -296,23 +218,17 @@ jobs:
296
218
files : properties-lcov.info
297
219
flags : properties
298
220
fail_ci_if_error : false
299
-
300
221
docker-scan :
301
222
runs-on : ubuntu-latest
302
223
needs : [changed_files, ci]
303
224
if : |
304
- ${{
305
- github.event.pull_request.draft == false
306
- && needs.changed_files.outputs.changed-docker-files == 'true'
307
- }}
225
+ ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-docker-files == 'true' }}
308
226
steps :
309
227
# Checkout the repository
310
228
- name : Checkout Code
311
229
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
312
-
313
230
- name : Set up Docker Buildx
314
231
uses : docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
315
-
316
232
- name : Build local container
317
233
uses : docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
318
234
with :
@@ -321,7 +237,6 @@ jobs:
321
237
load : true
322
238
file : Dockerfile.development
323
239
platforms : linux/amd64
324
-
325
240
- name : Scan image
326
241
uses : anchore/scan-action@7c05671ae9be166aeb155bad2d7df9121823df32 # v6.1.0
327
242
with :
0 commit comments