-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uploading code coverage currently fails with the following error: Rate limit reached. Please upload with the Codecov repository upload token to resolve issue. This patch replaces the codecov Makefile target, that was used to upload the coverage files, with a GitHub CI workflow [1]. This change allows us to specify a Codecov token [2] to authorize report uploads. In addition, this patch updates the version of Go used for coverage to 1.22 and configures the CI build to fail if Codecov encounters an error during upload. [1] https://github.com/codecov/codecov-action [2] https://docs.codecov.com/docs/github-2-getting-a-codecov-account-and-uploading-coverage Signed-off-by: Radostin Stoyanov <[email protected]>
- Loading branch information
Showing
4 changed files
with
59 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Codecov | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
if: ${{ github.repository == 'checkpoint-restore/go-criu' }} | ||
runs-on: ubuntu-latest | ||
name: Code coverage | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
# needed for codecov | ||
fetch-depth: 0 | ||
|
||
- name: Build CRIU criu-dev | ||
run: | | ||
sudo apt-get install -y libprotobuf-dev libprotobuf-c-dev protobuf-c-compiler protobuf-compiler python3-protobuf libnl-3-dev libnet-dev libcap-dev curl unzip | ||
git clone --depth=1 --single-branch -b criu-dev https://github.com/checkpoint-restore/criu.git | ||
make -j"$(nproc)" -C criu | ||
sudo make -C criu install-criu PREFIX=/usr | ||
- name: Install Go 1.22.x | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.x | ||
|
||
- name: Install protoc-gen-go | ||
run: sudo env "GOBIN=/usr/bin" go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | ||
|
||
- name: Run tests and collect coverage | ||
run: | | ||
sudo -E make test | ||
sudo -E make -C scripts/magic-gen test | ||
# First update protobuf. It is too old in the Ubuntu image. | ||
curl -Lo protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protoc-23.4-linux-x86_64.zip | ||
sudo unzip -o protoc.zip -d /usr | ||
# We need to use the protobuf definitions from the criu-dev | ||
# branch as it might have changed. | ||
sudo -E make -C scripts/proto-gen proto-update GIT_BRANCH=criu-dev | ||
sudo -E make -C scripts/proto-gen | ||
sudo -E make -C crit clean bin/crit | ||
sudo -E make -C crit unit-test | ||
sudo -E make -C test crit-test | ||
# Run actual test as root as it uses CRIU. | ||
sudo -E make coverage | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
fail_ci_if_error: true | ||
file: test/.coverage/coverage.out | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters