Skip to content

Commit 3fdbfc2

Browse files
authored
fix(.github/workflows): add coverage reporting to all workflows (#4699)
Our code coverage appeared low because not all test results were being uploaded to Codecov. The language-specific CI workflows were running tests but not collecting or uploading coverage. This change adds coverage flags to go test and uploads coverage from each language workflow so Codecov can correctly merge results from the tests that actually run. For #4664
1 parent 358944e commit 3fdbfc2

5 files changed

Lines changed: 25 additions & 5 deletions

File tree

.github/workflows/dart.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,8 @@ jobs:
3939
- name: Run internal/sidekick/dart tests
4040
run: go test -race ./internal/sidekick/dart
4141
- name: Run internal/librarian/dart tests
42-
run: go test -race ./internal/librarian/dart
42+
run: go test -race -coverprofile=coverage.out -covermode=atomic ./internal/librarian/dart
43+
- name: Upload coverage report
44+
uses: codecov/codecov-action@v5
45+
with:
46+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/java.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,8 @@ jobs:
4545
test -x "$(which protoc-gen-java_grpc)"
4646
test -x "$(which protoc-gen-java_gapic)"
4747
- name: Run internal/librarian/java tests
48-
run: go test -race ./internal/librarian/java
48+
run: go test -race -coverprofile=coverage.out -covermode=atomic ./internal/librarian/java
49+
- name: Upload coverage report
50+
uses: codecov/codecov-action@v5
51+
with:
52+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/nodejs.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,8 @@ jobs:
5353
run: |
5454
pip install gcp-synthtool@git+https://github.com/googleapis/synthtool@5aa438a342707842d11fbbb302c6277fbf9e4655
5555
- name: Run internal/librarian/nodejs tests
56-
run: go test -race ./internal/librarian/nodejs
56+
run: go test -race -coverprofile=coverage.out -covermode=atomic ./internal/librarian/nodejs
57+
- name: Upload coverage report
58+
uses: codecov/codecov-action@v5
59+
with:
60+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/python.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,8 @@ jobs:
5454
- name: Verify git is available
5555
run: git --version
5656
- name: Run internal/librarian/python tests
57-
run: go test -race ./internal/librarian/python
57+
run: go test -race -coverprofile=coverage.out -covermode=atomic ./internal/librarian/python
58+
- name: Upload coverage report
59+
uses: codecov/codecov-action@v5
60+
with:
61+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/rust.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ jobs:
4343
- name: Run sidekick tests
4444
run: go test -race ./internal/sidekick/...
4545
- name: Run internal/librarian/rust tests
46-
run: go test -race ./internal/librarian/rust
46+
run: go test -race -coverprofile=coverage.out -covermode=atomic ./internal/librarian/rust
47+
- name: Upload coverage report
48+
uses: codecov/codecov-action@v5
49+
with:
50+
token: ${{ secrets.CODECOV_TOKEN }}
4751
integration:
4852
runs-on: ubuntu-24.04
4953
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

0 commit comments

Comments
 (0)