Skip to content

Commit cb18a3d

Browse files
[actions] Add code coverage github action. (#1314)
Summary: Adds a github action to run code coverage on commits to main. Type of change: /kind test-infra Test Plan: Testing in this PR that the coverage runs (not testing the upload to codecov so I don't mess with the metrics). The code coverage output looked roughly the same as when I ran it locally, and numbers looked comparable to the main report. Will test the actual upload after landing, but it shouldn't be any different from on Jenkins. Signed-off-by: James Bartlett <jamesbartlett@pixielabs.ai>
1 parent f0036c2 commit cb18a3d

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

.github/workflows/build_and_test.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,30 @@ jobs:
4343
fi
4444
./ci/run_clang_tidy.sh -f "${diff_file}"
4545
# yamllint enable rule:indentation
46+
code-coverage:
47+
if: github.event_name == 'push'
48+
needs: get-dev-image
49+
runs-on: [self-hosted, nokvm]
50+
container:
51+
image: ${{ needs.get-dev-image.outputs.image-with-tag }}
52+
volumes:
53+
- /etc/bazelrc:/etc/bazelrc
54+
options: --cpus 16
55+
steps:
56+
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
57+
with:
58+
fetch-depth: 0
59+
- name: Add pwd to git safe dir
60+
run: git config --global --add safe.directory `pwd`
61+
- name: get bazel config
62+
uses: ./.github/actions/bazelrc
63+
with:
64+
dev: 'false'
65+
- name: Collect and upload coverage
66+
env:
67+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
68+
run: |
69+
./ci/collect_coverage.sh -u -b main -c "$(git rev-parse HEAD)" -r pixie-io/pixie
4670
generate-matrix:
4771
needs: get-dev-image
4872
runs-on: [self-hosted, nokvm]

0 commit comments

Comments
 (0)