Skip to content

Commit ad0f741

Browse files
authored
fix: Running duplicate tests (#181)
* fix: Duplicate tests * fix: Duplicate tests * fix: Duplicate tests
1 parent 11e11a1 commit ad0f741

File tree

2 files changed

+20
-105
lines changed

2 files changed

+20
-105
lines changed

.github/workflows/ci.yaml

+19-104
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,30 @@
11
---
22
name: CI
3-
43
on:
54
pull_request:
6-
branches:
7-
- main
5+
branches: [main]
86
types: [opened, synchronize, reopened, ready_for_review]
97
push:
108
branches:
119
- main
12-
1310
# run concurrency group for the workflow
1411
concurrency:
1512
group: ${{ github.workflow }}-${{ github.ref }}
1613
cancel-in-progress: true
17-
1814
jobs:
1915
changed_files:
2016
if: ${{ github.event.pull_request.draft == false }}
2117
runs-on: ubuntu-latest
2218
name: Test changed-files
2319
outputs:
2420
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 }}
3124
steps:
3225
# Checkout the repository
3326
- name: Checkout Code
3427
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35-
3628
- name: Get changed files
3729
id: changed-files-yaml
3830
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
@@ -52,7 +44,6 @@ jobs:
5244
tests:
5345
- '**/*.rs'
5446
- tests/**/*.json
55-
5647
ci:
5748
if: ${{ github.event.pull_request.draft == false && always() }}
5849
permissions:
@@ -64,48 +55,37 @@ jobs:
6455
- name: Failed
6556
run: exit 1
6657
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
67-
6858
msrv:
6959
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') }}
7461
runs-on: ubuntu-latest
7562
needs: changed_files
7663
steps:
7764
# Checkout the repository
7865
- name: Checkout Code
7966
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
80-
8167
- name: Prepare
8268
id: init
8369
uses: ./.github/actions/prepare
8470

8571
# Get the output of the prepare composite action
8672
- name: Get cache-hit output
8773
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
88-
8974
- name: Install cargo hack
9075
uses: taiki-e/install-action@cargo-hack
9176

9277
# Check the minimum supported Rust version
9378
- name: Default features
9479
run: cargo hack check --feature-powerset --locked --rust-version --all-targets
95-
9680
lockfile:
9781
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' }}
10283
needs: changed_files
10384
runs-on: ubuntu-latest
10485
steps:
10586
# Checkout the repository
10687
- name: Checkout Code
10788
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
108-
10989
- name: Prepare
11090
id: init
11191
uses: ./.github/actions/prepare
@@ -117,21 +97,15 @@ jobs:
11797
# Check the lockfile
11898
- name: Validate lockfile updates
11999
run: cargo update --locked
120-
121100
rustfmt:
122101
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' }}
128103
needs: changed_files
129104
runs-on: ubuntu-latest
130105
steps:
131106
# Checkout the repository
132107
- name: Checkout Code
133108
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
134-
135109
- name: Prepare
136110
id: init
137111
uses: ./.github/actions/prepare
@@ -144,63 +118,30 @@ jobs:
144118
- name: Check formatting
145119
run: cargo fmt --all -- --check
146120

121+
# lint checks
147122
clippy:
148123
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' }}
153125
needs: changed_files
154126
runs-on: ubuntu-latest
155127
steps:
156128
# Checkout the repository
157129
- name: Checkout Code
158130
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
159-
160131
- name: Prepare
161132
id: init
162133
uses: ./.github/actions/prepare
163134

164135
# Get the output of the prepare composite action
165136
- name: Get cache-hit output
166137
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-
174138
- 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
198140

141+
# Run tests
199142
test:
200143
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' }}
204145
permissions:
205146
contents: read
206147
needs: changed_files
@@ -209,63 +150,44 @@ jobs:
209150
# Checkout the repository
210151
- name: Checkout Code
211152
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
212-
213153
- name: Prepare
214154
id: init
215155
uses: ./.github/actions/prepare
216156

217157
# Get the output of the prepare composite action
218158
- name: Get cache-hit output
219159
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
220-
221160
- name: Setup Rust
222161
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
223162
with:
224163
toolchain: stable
225164
components: llvm-tools-preview
226165
rustflags: ''
227-
228166
- name: Install cargo hack
229167
uses: taiki-e/install-action@cargo-hack
230-
231168
- name: Install cargo-llvm-cov
232169
uses: taiki-e/install-action@cargo-llvm-cov
233-
234170
- name: Build
235171
run: cargo test --no-run --locked
236172

237173
# Unit tests coverage
238-
- name: Run Unit Tests
174+
- name: Generate Unit Coverage Report
239175
env:
240176
LLVM_PROFILE_FILE: unit-%p-%m.profraw
241177
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
247179

248180
# Integration tests coverage
249-
- name: Run Integration Tests
181+
- name: Generate Integration Coverage Report
250182
env:
251183
LLVM_PROFILE_FILE: integration-%p-%m.profraw
252184
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
261187
env:
262188
LLVM_PROFILE_FILE: properties-%p-%m.profraw
263189
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
269191

270192
# Upload unit coverage
271193
- name: Upload Unit Coverage to Codecov
@@ -296,23 +218,17 @@ jobs:
296218
files: properties-lcov.info
297219
flags: properties
298220
fail_ci_if_error: false
299-
300221
docker-scan:
301222
runs-on: ubuntu-latest
302223
needs: [changed_files, ci]
303224
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' }}
308226
steps:
309227
# Checkout the repository
310228
- name: Checkout Code
311229
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
312-
313230
- name: Set up Docker Buildx
314231
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
315-
316232
- name: Build local container
317233
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
318234
with:
@@ -321,7 +237,6 @@ jobs:
321237
load: true
322238
file: Dockerfile.development
323239
platforms: linux/amd64
324-
325240
- name: Scan image
326241
uses: anchore/scan-action@7c05671ae9be166aeb155bad2d7df9121823df32 # v6.1.0
327242
with:

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ tests/**/*.proptest-regressions
3737
coverage-*.profraw
3838
coverage-data/
3939
coverage/
40-
lcov.info*
40+
*-lcov.info
4141

4242
# docs
4343
docs/build/

0 commit comments

Comments
 (0)