Skip to content

Commit 745b812

Browse files
authored
ci: Update codecove config (#565)
* Update codecove config * Comment failing tests * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * adjust config * Add lcov gitignore * Add lcov gitignore * Use container with more ressources * temporarly comment failing tests * Remove temporary config and commented failing test * Increase container ressources * Remove test ai_ and add new one * remove dev-lcov.info
1 parent 276ea86 commit 745b812

File tree

4 files changed

+121
-41
lines changed

4 files changed

+121
-41
lines changed

.github/codecov.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
1-
---
21
coverage:
3-
range: 90..100
2+
precision: 2
43
round: down
5-
precision: 1
4+
range: 70..100
5+
66
status:
77
project:
88
default:
9-
target: 80%
10-
threshold: 1%
11-
flags:
12-
- integration
13-
- properties
14-
- unittests
9+
target: 85%
10+
threshold: 2%
1511
patch:
1612
default:
17-
target: 90%
13+
target: auto
1814
threshold: 1%
15+
16+
flags:
17+
ai:
18+
paths:
19+
- "src/"
20+
carryforward: true
21+
22+
dev:
23+
paths:
24+
- "src/"
25+
carryforward: true
26+
27+
comment:
28+
layout: "flags, diff, files"
29+
require_changes: false
30+
behavior: default
31+
1932
ignore:
20-
- tests/**/*
33+
- "tests/*"
34+
- "target/*"

.github/workflows/ci.yaml

Lines changed: 70 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ on:
1111
- ready_for_review
1212
paths-ignore:
1313
- docs/**
14-
- '**.md'
14+
- "**.md"
1515
- .github/**
1616
- .gitignore
1717
push:
1818
branches:
1919
- main
2020
paths-ignore:
2121
- docs/**
22-
- '**.md'
22+
- "**.md"
2323
- .github/**
2424
# run concurrency group for the workflow
2525
concurrency:
@@ -38,14 +38,14 @@ jobs:
3838
steps:
3939
# Checkout the repository
4040
- name: Harden the runner (Audit all outbound calls)
41-
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
41+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
4242
with:
4343
egress-policy: audit
4444
- name: Checkout Code
45-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
45+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4646
- name: Get changed files
4747
id: changed-files-yaml
48-
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47.0.0
48+
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47.0.0
4949
with:
5050
files_yaml: |
5151
code:
@@ -65,6 +65,7 @@ jobs:
6565
- '**/*.rs'
6666
- tests/**/*.json
6767
ci:
68+
timeout-minutes: 150
6869
if: ${{ github.event.pull_request.draft == false && always() }}
6970
permissions:
7071
contents: none
@@ -73,10 +74,10 @@ jobs:
7374
- msrv
7475
- rustfmt
7576
- clippy
76-
runs-on: ubuntu-latest
77+
runs-on: ubuntu-22.04-oz-8core
7778
steps:
7879
- name: Harden the runner (Audit all outbound calls)
79-
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
80+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
8081
with:
8182
egress-policy: audit
8283
- name: Failed
@@ -89,11 +90,11 @@ jobs:
8990
steps:
9091
# Checkout the repository
9192
- name: Harden the runner (Audit all outbound calls)
92-
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
93+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
9394
with:
9495
egress-policy: audit
9596
- name: Checkout Code
96-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
97+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
9798
- name: Prepare
9899
id: init
99100
uses: ./.github/actions/prepare
@@ -102,7 +103,7 @@ jobs:
102103
- name: Get cache-hit output
103104
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
104105
- name: Install cargo hack
105-
uses: taiki-e/install-action@92e6dd1c202153a204d471a3c509bf1e03dcfa44 # v2.62.61
106+
uses: taiki-e/install-action@92e6dd1c202153a204d471a3c509bf1e03dcfa44 # v2.62.61
106107
with:
107108
tool: cargo-hack
108109

@@ -116,11 +117,11 @@ jobs:
116117
steps:
117118
# Checkout the repository
118119
- name: Harden the runner (Audit all outbound calls)
119-
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
120+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
120121
with:
121122
egress-policy: audit
122123
- name: Checkout Code
123-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
124+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
124125
- name: Prepare
125126
id: init
126127
uses: ./.github/actions/prepare
@@ -139,11 +140,11 @@ jobs:
139140
steps:
140141
# Checkout the repository
141142
- name: Harden the runner (Audit all outbound calls)
142-
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
143+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
143144
with:
144145
egress-policy: audit
145146
- name: Checkout Code
146-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
147+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
147148
- name: Prepare
148149
id: init
149150
uses: ./.github/actions/prepare
@@ -163,13 +164,13 @@ jobs:
163164
| sarif-fmt
164165
continue-on-error: true
165166
- name: upload sarif artifact
166-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
167+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
167168
with:
168169
name: clippy-results.sarif
169170
path: clippy-results.sarif
170171
retention-days: 1
171172
- name: Upload
172-
uses: github/codeql-action/upload-sarif@fe4161a26a8629af62121b670040955b330f9af2 # v3.29.5
173+
uses: github/codeql-action/upload-sarif@fe4161a26a8629af62121b670040955b330f9af2 # v3.29.5
173174
with:
174175
sarif_file: clippy-results.sarif
175176
wait-for-processing: true
@@ -181,19 +182,19 @@ jobs:
181182
contents: read
182183
needs:
183184
- changed_files
184-
runs-on: ubuntu-latest
185+
runs-on: ubuntu-22.04-oz-8core
185186
steps:
186187
# Checkout the repository
187188
- name: Harden the runner (Audit all outbound calls)
188-
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
189+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
189190
with:
190191
egress-policy: audit
191192
- name: Checkout Code
192-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
193+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
193194
- name: Setup Node.js
194-
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
195+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
195196
with:
196-
node-version: '20'
197+
node-version: "20"
197198
- name: Install pnpm and plugin dependencies
198199
run: |
199200
npm install -g pnpm
@@ -226,7 +227,7 @@ jobs:
226227
- name: Get cache-hit output
227228
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
228229
- name: Install cargo hack and cargo-llvm-cov
229-
uses: taiki-e/install-action@92e6dd1c202153a204d471a3c509bf1e03dcfa44 # v2.62.61
230+
uses: taiki-e/install-action@92e6dd1c202153a204d471a3c509bf1e03dcfa44 # v2.62.61
230231
with:
231232
tool: cargo-hack,cargo-llvm-cov
232233
- name: Build
@@ -255,9 +256,29 @@ jobs:
255256
RUST_TEST_THREADS: 1
256257
run: cargo hack llvm-cov --locked --ignore-filename-regex "(src/api/routes/docs/.*_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path properties-lcov.info --test properties
257258

259+
- name: Run Developer Tests (excluding AI) and Generate Coverage Report
260+
id: dev_coverage
261+
timeout-minutes: 45
262+
env:
263+
LLVM_PROFILE_FILE: dev-%p-%m.profraw
264+
RUSTFLAGS: -Cinstrument-coverage
265+
RUST_TEST_THREADS: 1
266+
run: |
267+
cargo hack llvm-cov --locked --lib --ignore-filename-regex "(src/api/routes/docs/.*_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path dev-lcov.info --tests -- --skip ai_
268+
269+
- name: Run AI Tests and Generate Coverage Report
270+
id: ai_coverage
271+
timeout-minutes: 45
272+
env:
273+
LLVM_PROFILE_FILE: ai-%p-%m.profraw
274+
RUSTFLAGS: -Cinstrument-coverage
275+
RUST_TEST_THREADS: 1
276+
run: |
277+
cargo hack llvm-cov --locked --lib --ignore-filename-regex "(src/api/routes/docs/.*_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path ai-lcov.info --tests -- ai_
278+
258279
# Upload unit coverage
259280
- name: Upload Unit Coverage to Codecov
260-
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
281+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
261282
with:
262283
token: ${{ secrets.CODECOV_TOKEN }}
263284
name: unit-coverage
@@ -267,7 +288,7 @@ jobs:
267288

268289
# Upload integration coverage
269290
- name: Upload Integration Coverage to Codecov
270-
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
291+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
271292
with:
272293
token: ${{ secrets.CODECOV_TOKEN }}
273294
name: integration-coverage
@@ -277,13 +298,32 @@ jobs:
277298

278299
# Upload properties coverage
279300
- name: Upload Properties Coverage to Codecov
280-
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
301+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
281302
with:
282303
token: ${{ secrets.CODECOV_TOKEN }}
283304
name: properties-coverage
284305
files: properties-lcov.info
285306
flags: properties
286307
fail_ci_if_error: true
308+
309+
- name: Upload AI Coverage to Codecov
310+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
311+
with:
312+
token: ${{ secrets.CODECOV_TOKEN }}
313+
name: ai-coverage
314+
files: ai-lcov.info
315+
flags: ai
316+
fail_ci_if_error: true
317+
318+
- name: Upload Developer Coverage to Codecov
319+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
320+
with:
321+
token: ${{ secrets.CODECOV_TOKEN }}
322+
name: dev-coverage
323+
files: dev-lcov.info
324+
flags: dev
325+
fail_ci_if_error: true
326+
287327
docker-scan:
288328
runs-on: ubuntu-latest
289329
needs:
@@ -294,23 +334,23 @@ jobs:
294334
steps:
295335
# Checkout the repository
296336
- name: Harden the runner (Audit all outbound calls)
297-
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
337+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
298338
with:
299339
egress-policy: audit
300340
- name: Checkout Code
301-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
341+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
302342
- name: Set up Docker Buildx
303-
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
343+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
304344
- name: Build local container
305-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
345+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
306346
with:
307347
tags: openzeppelin-relayer-dev:${{ github.sha }}
308348
push: false
309349
load: true
310350
file: Dockerfile.development
311351
platforms: linux/amd64
312352
- name: Scan image
313-
uses: anchore/scan-action@40a61b52209e9d50e87917c5b901783d546b12d0 # v7.2.1
353+
uses: anchore/scan-action@40a61b52209e9d50e87917c5b901783d546b12d0 # v7.2.1
314354
with:
315355
image: openzeppelin-relayer-dev:${{ github.sha }}
316356
fail-build: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ node_modules
4545

4646
# Exclude generated OpenAPI files from the docs directory
4747
!./openapi.json
48+
49+
**/*lcov.info

src/bootstrap/config_processor.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,6 +1599,30 @@ mod tests {
15991599
Ok(())
16001600
}
16011601

1602+
#[tokio::test]
1603+
async fn ai_process_config_file_skips_when_redis_populated() -> Result<()> {
1604+
let config = create_minimal_test_config();
1605+
let server_config = Arc::new(create_test_server_config_with_settings(
1606+
RepositoryStorageType::Redis,
1607+
false,
1608+
));
1609+
1610+
let app_state = ThinData(create_test_app_state());
1611+
1612+
app_state
1613+
.relayer_repository
1614+
.create(create_mock_relayer("existing-relayer".to_string(), false))
1615+
.await?;
1616+
1617+
process_config_file(config, server_config, &app_state).await?;
1618+
1619+
let stored_relayers = app_state.relayer_repository.list_all().await?;
1620+
assert_eq!(stored_relayers.len(), 1);
1621+
assert_eq!(stored_relayers[0].id, "existing-relayer");
1622+
1623+
Ok(())
1624+
}
1625+
16021626
#[tokio::test]
16031627
async fn test_should_not_process_config_file_redis_storage_populated_repositories() -> Result<()>
16041628
{

0 commit comments

Comments
 (0)