-
Notifications
You must be signed in to change notification settings - Fork 10
186 lines (158 loc) · 5.43 KB
/
coverage.yml
File metadata and controls
186 lines (158 loc) · 5.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#
# Keep coverage generation separate from Codecov upload.
# Mirrors Monty's CI shape so upload uses the existing CODECOV_TOKEN secret
# without mixing tokened steps into the report-generation job.
# Rust unit coverage still comes from tarpaulin; Python and Node binding jobs
# add Rust coverage exercised through those language integrations via
# cargo-llvm-cov.
name: Coverage
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
LLVM_COV_IGNORE_FILENAME_REGEX: "(tests/|test_cases/|/tests\\.rs$)"
jobs:
coverage:
name: Generate Rust Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install cargo-tarpaulin
uses: taiki-e/install-action@cargo-tarpaulin
- name: Generate coverage report
run: |
cargo tarpaulin --features http_client \
--workspace \
--exclude bashkit-python \
--out xml \
--out html \
--output-dir coverage \
--exclude-files "crates/bashkit-bench/*" \
--exclude-files "crates/bashkit-cli/*" \
--exclude-files "crates/bashkit-python/*" \
--timeout 300 \
--skip-clean \
--engine llvm
- name: Upload coverage artifacts
uses: actions/upload-artifact@v7
with:
name: rust-coverage-report
path: coverage/
retention-days: 30
python-coverage:
name: Generate Python Binding Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@v7
- name: Generate Python-driven Rust coverage
run: |
set -euxo pipefail
mkdir -p coverage
eval "$(cargo llvm-cov show-env --export-prefix)"
cargo llvm-cov clean --workspace
uv venv
uv pip install maturin pytest pytest-asyncio langchain-core langgraph fastapi httpx
uv run maturin develop --release -m crates/bashkit-python/Cargo.toml
uv run pytest crates/bashkit-python/tests -v
cargo llvm-cov report \
--release \
--codecov \
--output-path coverage/python-rust-coverage.json \
--ignore-filename-regex "$LLVM_COV_IGNORE_FILENAME_REGEX"
- name: Upload Python coverage artifact
uses: actions/upload-artifact@v7
with:
name: python-rust-coverage-report
path: coverage/python-rust-coverage.json
retention-days: 30
node-coverage:
name: Generate Node Binding Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
- name: Install dependencies
run: npm install
working-directory: crates/bashkit-js
- name: Generate Node-driven Rust coverage
working-directory: crates/bashkit-js
run: |
set -euxo pipefail
mkdir -p "$GITHUB_WORKSPACE/coverage"
eval "$(cargo llvm-cov show-env --export-prefix)"
cargo llvm-cov clean --workspace
cargo build -p bashkit-js --release
npm run build
npm test
node --test __test__/runtime-compat/*.test.mjs
cargo llvm-cov report \
--release \
--codecov \
--output-path "$GITHUB_WORKSPACE/coverage/node-rust-coverage.json" \
--ignore-filename-regex "$LLVM_COV_IGNORE_FILENAME_REGEX"
- name: Upload Node coverage artifact
uses: actions/upload-artifact@v7
with:
name: node-rust-coverage-report
path: coverage/node-rust-coverage.json
retention-days: 30
coverage-upload:
name: Upload Coverage
needs: [coverage, python-coverage, node-coverage]
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- uses: actions/download-artifact@v8
with:
pattern: "*-coverage-report"
merge-multiple: true
path: coverage
- name: List coverage artifacts
run: ls -lh coverage
- name: Upload coverage to Codecov
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/cobertura.xml,coverage/python-rust-coverage.json,coverage/node-rust-coverage.json
disable_search: true
flags: unittests
fail_ci_if_error: false
verbose: true