Skip to content

Commit 8db1d76

Browse files
committed
add twmq CI and coverage
1 parent bba47c8 commit 8db1d76

File tree

9 files changed

+919
-44
lines changed

9 files changed

+919
-44
lines changed

.config/nextest.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[profile.ci.junit] # this can be some other profile, too
2+
path = "junit.xml"

.github/workflows/ci-twmq.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: twmq Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "twmq/**"
8+
pull_request:
9+
branches: [main]
10+
paths:
11+
- "twmq/**"
12+
workflow_dispatch: # Allow manual triggering for testing (optional)
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
21+
services:
22+
redis:
23+
image: redis:7-alpine
24+
ports:
25+
- 6379:6379
26+
options: >-
27+
--health-cmd "redis-cli ping"
28+
--health-interval 10s
29+
--health-timeout 5s
30+
--health-retries 5
31+
32+
steps:
33+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #checkout@v4
34+
35+
- name: Install CI dependencies
36+
uses: taiki-e/install-action@ab3728c7ba6948b9b429627f4d55a68842b27f18
37+
with:
38+
tool: cargo-nextest
39+
40+
- name: Install CI dependencies
41+
uses: taiki-e/install-action@ab3728c7ba6948b9b429627f4d55a68842b27f18
42+
with:
43+
tool: cargo-nextest
44+
45+
- name: Cache
46+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
47+
with:
48+
path: |
49+
~/.cargo/registry
50+
~/.cargo/git
51+
target
52+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
53+
54+
- name: Build
55+
run: cargo build --verbose
56+
57+
- name: Run tests
58+
run: cargo nextest run -p vault-integration-tests --profile ci
59+
60+
- name: Test Report
61+
uses: dorny/test-reporter@6e6a65b7a0bd2c9197df7d0ae36ac5cee784230c # @v2
62+
if: success() || failure() # run this step even if previous step failed
63+
with:
64+
name: Integration Tests # Name of the check run which will be created
65+
path: target/nextest/ci/junit.xml # Path to test results
66+
reporter: java-junit # Format of test results

.github/workflows/coverage-twmq.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "twmq/**"
8+
pull_request:
9+
branches: [main]
10+
paths:
11+
- "twmq/**"
12+
workflow_dispatch: # Allow manual triggering for testing (optional)
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
coverage:
19+
runs-on: ubuntu-latest
20+
21+
services:
22+
redis:
23+
image: redis:7-alpine
24+
ports:
25+
- 6379:6379
26+
options: >-
27+
--health-cmd "redis-cli ping"
28+
--health-interval 10s
29+
--health-timeout 5s
30+
--health-retries 5
31+
32+
steps:
33+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #checkout@v4
34+
35+
- name: Install CI dependencies
36+
uses: taiki-e/install-action@ab3728c7ba6948b9b429627f4d55a68842b27f18
37+
with:
38+
tool: cargo-tarpaulin
39+
40+
- name: Cache
41+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
42+
with:
43+
path: |
44+
~/.cargo/registry
45+
~/.cargo/git
46+
target
47+
key: ${{ runner.os }}-cargo-tarpaulin-${{ hashFiles('**/Cargo.lock') }}
48+
49+
# Run coverage with tarpaulin
50+
- name: Run coverage
51+
run: cargo tarpaulin -p twmq --skip-clean --out Xml --out Html --output-dir coverage --exclude-files "aa-core/*" --exclude-files "core/*" --exclude-files "server/*"
52+
53+
# Upload coverage to Codecov
54+
# TODO: Uncomment once we have open-sourced the repo
55+
# - name: Upload coverage to Codecov
56+
# uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # @5.4.2
57+
# with:
58+
# files: coverage/cobertura.xml
59+
# fail_ci_if_error: false
60+
# flags: integration
61+
# name: integration-tests
62+
# verbose: true
63+
# env:
64+
# CODECOV_ENV: RUST,CARGO
65+
66+
# Archive coverage reports as artifacts
67+
- name: Archive code coverage results
68+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # @4.6.2
69+
with:
70+
name: code-coverage-report
71+
path: coverage/
72+
73+
- name: Code Coverage Summary Report
74+
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # @v1.3.0
75+
with:
76+
filename: coverage/cobertura.xml
77+
format: markdown
78+
output: both
79+
80+
- name: Add Coverage Summary to Job Summary
81+
# This step reads the generated markdown file and appends it to the
82+
# special GITHUB_STEP_SUMMARY file, which populates the job summary page.
83+
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY

Cargo.lock

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ tower = "0.5.2"
1616
tracing = "0.1.41"
1717
async-nats = "0.40.0"
1818
twmq = { version = "0.1.0", path = "../twmq" }
19+
uuid = { version = "1.17.0", features = ["v4"] }

core/src/execution_options/mod.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
1+
use serde::{Deserialize, Serialize};
12
pub mod aa;
3+
4+
#[derive(Debug, Clone, Serialize, Deserialize)]
5+
#[serde(rename_all = "camelCase")]
6+
pub struct BaseExecutionOptions {
7+
chain_id: u64,
8+
#[serde(default = "default_idempotency_key")]
9+
idempotency_key: String,
10+
}
11+
12+
fn default_idempotency_key() -> String {
13+
uuid::Uuid::new_v4().to_string()
14+
}
15+
16+
#[derive(Debug, Clone, Serialize, Deserialize)]
17+
#[serde(tag = "type")]
18+
pub enum SpecificExecutionOptions {
19+
ERC4337(aa::Erc4337ExecutionOptions),
20+
}
21+
22+
#[derive(Debug, Clone, Serialize, Deserialize)]
23+
pub struct ExecutionOptions {
24+
#[serde(flatten)]
25+
pub base: BaseExecutionOptions,
26+
#[serde(flatten)]
27+
pub specific: SpecificExecutionOptions,
28+
}

coverage/cobertura.xml

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

coverage/tarpaulin-report.html

Lines changed: 671 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)