Skip to content

Commit 9e56872

Browse files
committed
feat(ci): add BATS coverage artifacts
Run the existing BATS unit tests under kcov and upload the generated report alongside TAP output. Document the new artifact in the CI skill. Assisted-by: goose
1 parent 7d6d320 commit 9e56872

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

.github/workflows/pr-validation.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,26 +79,46 @@ jobs:
7979
needs: [check-base-branch]
8080
if: always() && (needs.check-base-branch.result == 'success' || needs.check-base-branch.result == 'skipped')
8181
runs-on: ubuntu-latest
82-
timeout-minutes: 5
82+
timeout-minutes: 15
8383
permissions:
8484
contents: read
8585
steps:
8686
- name: Checkout
8787
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
8888

89-
- name: Install bats
90-
run: sudo apt-get install -y bats
89+
- name: Install unit test tools
90+
run: sudo apt-get install -y bats kcov
9191

9292
- name: Run unit tests
9393
run: bats --formatter tap tests/unit/ | tee results.tap
9494

95+
- name: Generate BATS coverage report
96+
env:
97+
INCLUDE_PATHS: ${{ github.workspace }}/build_files,${{ github.workspace }}/system_files
98+
EXCLUDE_PATHS: ${{ github.workspace }}/tests,${{ github.workspace }}/.github
99+
run: |
100+
mkdir -p coverage/kcov
101+
kcov \
102+
--bash-method=DEBUG \
103+
--include-path="${INCLUDE_PATHS}" \
104+
--exclude-path="${EXCLUDE_PATHS}" \
105+
coverage/kcov \
106+
bats tests/unit/
107+
95108
- name: Upload TAP results
96109
if: always()
97110
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
98111
with:
99112
name: bats-tap-results
100113
path: results.tap
101114

115+
- name: Upload BATS coverage report
116+
if: always()
117+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
118+
with:
119+
name: bats-kcov-report
120+
path: coverage/kcov
121+
102122
- name: Run Python unit tests
103123
run: python3 -m unittest discover -s tests -p 'test_*.py'
104124

docs/skills/ci/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ gh run rerun RUN_ID --repo projectbluefin/bluefin --failed-only
3333

3434
Read the actual workflow before describing or changing its behavior. Shared
3535
logic belongs in the reusable workflow that owns it; callers should stay thin.
36+
The `unit-tests` job in `pr-validation.yml` runs BATS with kcov and publishes
37+
`bats-tap-results` plus `bats-kcov-report` artifacts for shell-test visibility.
3638

3739
Every open Bluefin PR is discovered by the lab's five-minute PR poller. The lab
3840
runs smoke QA against `bluefin:testing` and sends bounded

0 commit comments

Comments
 (0)