1
1
---
2
2
name : CI
3
-
4
3
on :
5
4
pull_request :
6
5
branches :
7
6
- main
8
- types : [opened, synchronize, reopened, ready_for_review]
7
+ types :
8
+ - opened
9
+ - synchronize
10
+ - reopened
11
+ - ready_for_review
9
12
push :
10
13
branches :
11
14
- main
12
-
13
15
# run concurrency group for the workflow
14
16
concurrency :
15
17
group : ${{ github.workflow }}-${{ github.ref }}
16
18
cancel-in-progress : true
17
-
18
19
jobs :
19
20
changed_files :
20
21
if : ${{ github.event.pull_request.draft == false }}
21
22
runs-on : ubuntu-latest
22
23
name : Test changed-files
23
24
outputs :
24
25
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
- }}
26
+ changed-lockfile-files : ${{ steps.changed-files-yaml.outputs.lockfile_any_changed }}
27
+ changed-docker-files : ${{ steps.changed-files-yaml.outputs.docker_any_changed }}
28
+ changed-tests-files : ${{ steps.changed-files-yaml.outputs.tests_any_changed }}
31
29
steps :
32
30
# Checkout the repository
33
31
- name : Checkout Code
34
32
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35
-
36
33
- name : Get changed files
37
34
id : changed-files-yaml
38
35
uses : tj-actions/changed-files@b74df86ccb65173a8e33ba5492ac1a2ca6b216fd # v46.0.4
@@ -52,55 +49,50 @@ jobs:
52
49
tests:
53
50
- '**/*.rs'
54
51
- tests/**/*.json
55
-
56
52
ci :
57
53
if : ${{ github.event.pull_request.draft == false && always() }}
58
54
permissions :
59
55
contents : none
60
56
name : CI
61
- needs : [msrv, lockfile, rustfmt, clippy]
57
+ needs :
58
+ - msrv
59
+ - lockfile
60
+ - rustfmt
61
+ - clippy
62
62
runs-on : ubuntu-latest
63
63
steps :
64
64
- name : Failed
65
65
run : exit 1
66
66
if : contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
67
-
68
67
msrv :
69
- if : ${{ github.event.pull_request.draft == false && github.event_name != 'push'
70
- && (needs.changed_files.outputs.changed-rust-files == 'true' || needs.changed_files.outputs.changed-lockfile-files
71
- == 'true') }}
68
+ if : ${{ 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') }}
72
69
runs-on : ubuntu-latest
73
70
needs : changed_files
74
71
steps :
75
72
# Checkout the repository
76
73
- name : Checkout Code
77
74
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
78
-
79
75
- name : Prepare
80
76
id : init
81
77
uses : ./.github/actions/prepare
82
78
83
79
# Get the output of the prepare composite action
84
80
- name : Get cache-hit output
85
81
run : ' echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
86
-
87
82
- name : Install cargo hack
88
83
uses : taiki-e/install-action@cargo-hack
89
84
90
85
# Check the minimum supported Rust version
91
86
- name : Default features
92
87
run : cargo hack check --feature-powerset --locked --rust-version --all-targets
93
-
94
88
lockfile :
95
- if : ${{ github.event.pull_request.draft == false && github.event_name != 'push'
96
- && needs.changed_files.outputs.changed-lockfile-files == 'true' }}
89
+ if : ${{ github.event.pull_request.draft == false && github.event_name != 'push' && needs.changed_files.outputs.changed-lockfile-files == 'true' }}
97
90
needs : changed_files
98
91
runs-on : ubuntu-latest
99
92
steps :
100
93
# Checkout the repository
101
94
- name : Checkout Code
102
95
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
103
-
104
96
- name : Prepare
105
97
id : init
106
98
uses : ./.github/actions/prepare
@@ -112,17 +104,14 @@ jobs:
112
104
# Check the lockfile
113
105
- name : Validate lockfile updates
114
106
run : cargo update --locked
115
-
116
107
rustfmt :
117
- if : ${{ github.event.pull_request.draft == false && github.event_name != 'push'
118
- && needs.changed_files.outputs.changed-rust-files == 'true' }}
108
+ if : ${{ github.event.pull_request.draft == false && github.event_name != 'push' && needs.changed_files.outputs.changed-rust-files == 'true' }}
119
109
needs : changed_files
120
110
runs-on : ubuntu-latest
121
111
steps :
122
112
# Checkout the repository
123
113
- name : Checkout Code
124
114
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
125
-
126
115
- name : Prepare
127
116
id : init
128
117
uses : ./.github/actions/prepare
@@ -134,87 +123,89 @@ jobs:
134
123
# Check the formatting of the code
135
124
- name : Check formatting
136
125
run : cargo fmt --all -- --check
137
-
138
126
clippy :
139
- if : ${{ github.event.pull_request.draft == false && github.event_name != 'push'
140
- && needs.changed_files.outputs.changed-rust-files == 'true' }}
127
+ if : ${{ github.event.pull_request.draft == false && github.event_name != 'push' && needs.changed_files.outputs.changed-rust-files == 'true' }}
141
128
needs : changed_files
142
129
runs-on : ubuntu-latest
143
130
steps :
144
131
# Checkout the repository
145
132
- name : Checkout Code
146
133
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
147
-
148
134
- name : Prepare
149
135
id : init
150
136
uses : ./.github/actions/prepare
151
137
152
138
# Get the output of the prepare composite action
153
139
- name : Get cache-hit output
154
140
run : ' echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
155
-
156
141
- name : Install SARIF tools
157
142
run : cargo install clippy-sarif --locked
158
-
159
143
- name : Install SARIF tools
160
144
run : cargo install sarif-fmt --locked
161
-
162
145
- name : Check
163
146
run : >
164
147
cargo clippy --all-features --all-targets --message-format=json
165
148
| clippy-sarif
166
149
| tee clippy-results.sarif
167
150
| sarif-fmt
168
151
continue-on-error : true
169
-
170
152
- name : upload sarif artifact
171
153
uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
172
154
with :
173
155
name : clippy-results.sarif
174
156
path : clippy-results.sarif
175
157
retention-days : 1
176
-
177
158
- name : Upload
178
159
uses : github/codeql-action/upload-sarif@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3.28.3
179
160
with :
180
161
sarif_file : clippy-results.sarif
181
162
wait-for-processing : true
182
-
183
163
- name : Report status
184
164
run : cargo clippy --all-features --all-targets -- -D warnings --allow deprecated
185
165
test :
186
- if : ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-tests-files
187
- == 'true' }}
166
+ if : ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-tests-files == 'true' }}
188
167
permissions :
189
168
contents : read
190
- needs : changed_files
169
+ needs :
170
+ - changed_files
171
+ - ci
191
172
runs-on : ubuntu-latest
192
173
steps :
193
174
# Checkout the repository
194
175
- name : Checkout Code
195
176
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
196
-
177
+ - name : Get disk space
178
+ run : df -h
179
+ continue-on-error : true
180
+ - name : free disk space
181
+ run : |
182
+ sudo swapoff -a
183
+ sudo rm -f /swapfile
184
+ sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
185
+ sudo apt clean
186
+ if [[ $(docker image ls -aq) ]]; then
187
+ docker rmi $(docker image ls -aq)
188
+ else
189
+ echo "No Docker images found to remove"
190
+ fi
191
+ df -h
197
192
- name : Prepare
198
193
id : init
199
194
uses : ./.github/actions/prepare
200
195
201
196
# Get the output of the prepare composite action
202
197
- name : Get cache-hit output
203
198
run : ' echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
204
-
205
199
- name : Setup Rust
206
200
uses : actions-rust-lang/setup-rust-toolchain@9399c7bb15d4c7d47b27263d024f0a4978346ba4 # v1.11.0
207
201
with :
208
202
toolchain : stable
209
203
components : llvm-tools-preview
210
204
rustflags : ' '
211
-
212
205
- name : Install cargo hack
213
206
uses : taiki-e/install-action@cargo-hack
214
-
215
207
- name : Install cargo-llvm-cov
216
208
uses : taiki-e/install-action@cargo-llvm-cov
217
-
218
209
- name : Build
219
210
run : cargo test --no-run --locked
220
211
@@ -224,26 +215,23 @@ jobs:
224
215
LLVM_PROFILE_FILE : unit-%p-%m.profraw
225
216
RUSTFLAGS : -Cinstrument-coverage
226
217
RUST_TEST_THREADS : 1
227
- run : cargo hack llvm-cov --locked --lib --ignore-filename-regex ".*/relayer_docs\.rs$"
228
- --lcov --output-path unit-lcov.info
218
+ run : cargo hack llvm-cov --locked --lib --ignore-filename-regex ".*/relayer_docs\.rs$" --lcov --output-path unit-lcov.info
229
219
230
220
# Integration tests coverage
231
221
- name : Run Integration Tests and Generate Coverage Report
232
222
env :
233
223
LLVM_PROFILE_FILE : integration-%p-%m.profraw
234
224
RUSTFLAGS : -Cinstrument-coverage
235
225
RUST_TEST_THREADS : 1
236
- run : cargo hack llvm-cov --locked --ignore-filename-regex ".*/relayer_docs\.rs$"
237
- --lcov --output-path integration-lcov.info --test integration
226
+ run : cargo hack llvm-cov --locked --ignore-filename-regex ".*/relayer_docs\.rs$" --lcov --output-path integration-lcov.info --test integration
238
227
239
228
# Properties tests coverage
240
229
- name : Run Properties Tests
241
230
env :
242
231
LLVM_PROFILE_FILE : properties-%p-%m.profraw
243
232
RUSTFLAGS : -Cinstrument-coverage
244
233
RUST_TEST_THREADS : 1
245
- run : cargo hack llvm-cov --locked --ignore-filename-regex ".*/relayer_docs\.rs$"
246
- --lcov --output-path properties-lcov.info --test properties
234
+ run : cargo hack llvm-cov --locked --ignore-filename-regex ".*/relayer_docs\.rs$" --lcov --output-path properties-lcov.info --test properties
247
235
248
236
# Upload unit coverage
249
237
- name : Upload Unit Coverage to Codecov
@@ -274,19 +262,19 @@ jobs:
274
262
files : properties-lcov.info
275
263
flags : properties
276
264
fail_ci_if_error : true
277
-
278
265
docker-scan :
279
266
runs-on : ubuntu-latest
280
- needs : [changed_files, ci]
267
+ needs :
268
+ - changed_files
269
+ - ci
270
+ - test
281
271
if : ${{ needs.changed_files.outputs.changed-docker-files == 'true' }}
282
272
steps :
283
273
# Checkout the repository
284
274
- name : Checkout Code
285
275
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
286
-
287
276
- name : Set up Docker Buildx
288
277
uses : docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
289
-
290
278
- name : Build local container
291
279
uses : docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
292
280
with :
@@ -295,7 +283,6 @@ jobs:
295
283
load : true
296
284
file : Dockerfile.development
297
285
platforms : linux/amd64
298
-
299
286
- name : Scan image
300
287
uses : anchore/scan-action@7c05671ae9be166aeb155bad2d7df9121823df32 # v6.1.0
301
288
with :
0 commit comments