Skip to content

Commit

Permalink
.testing: Codecov upload uses Github Actions token
Browse files Browse the repository at this point in the history
Anonymous uploads to Codecov are throttled (though it is not clear if
this is happening on the Codecov or the GitHub Actions side).
Regardless, the advice to get around this throttling seems to be to use
the Codecov token associated with the project.

The .testing Makefile was modified to use this token if provided, and
the GitHub Actions environment now attempts to fetch this from the
secrets of the repository.

Hopefully individual groups can set this for their own projects, and it
will fall back to anonymous upload if unset, but I guess we'll have to
see how this plays out.
  • Loading branch information
marshallward authored and adcroft committed Oct 5, 2023
1 parent 13f2603 commit a41d0a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ jobs:
- name: Report coverage to CI (PR)
if: github.event_name == 'pull_request'
run: make report.cov REQUIRE_COVERAGE_UPLOAD=true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Report coverage to CI (Push)
if: github.event_name != 'pull_request'
run: make report.cov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
10 changes: 9 additions & 1 deletion .testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -571,13 +571,21 @@ endef

# Upload coverage reports
CODECOV_UPLOADER_URL ?= https://uploader.codecov.io/latest/linux/codecov
CODECOV_TOKEN ?=

ifdef CODECOV_TOKEN
CODECOV_TOKEN_ARG = -t $(CODECOV_TOKEN)
else
CODECOV_TOKEN_ARG =
endif

codecov:
curl -s $(CODECOV_UPLOADER_URL) -o $@
chmod +x codecov

.PHONY: report.cov
report.cov: run.cov codecov
./codecov -R build/cov -Z -f "*.gcov" \
./codecov $(CODECOV_TOKEN_ARG) -R build/cov -Z -f "*.gcov" \
> build/cov/codecov.out \
2> build/cov/codecov.err \
&& echo -e "${MAGENTA}Report uploaded to codecov.${RESET}" \
Expand Down

0 comments on commit a41d0a0

Please sign in to comment.