Actions: Report to CodeCov (#101499)

* feat: report to codecov

* fix: use webhook domain

* chore: force coverage check

* fix: use token

* fix: pass in token from workflow

* feat: remove codecov coverage force
This commit is contained in:
Mariell Hoversholm
2025-03-06 09:43:47 -07:00
committed by GitHub
parent a93a05aebd
commit 3247105d6a
2 changed files with 20 additions and 5 deletions
+15 -1
View File
@@ -8,6 +8,9 @@ inputs:
integration-cov-path:
description: 'Path to integration test coverage file'
required: true
codecov-token:
description: 'Token for CodeCov'
required: true
runs:
using: "composite"
@@ -43,4 +46,15 @@ runs:
echo '# Coverage' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
grep 'total:' backend-funcs.log | tr '\t' ' ' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Report coverage to CodeCov
uses: codecov/codecov-action@v5
with:
files: backend.cov
flags: unified-backend
name: backend
slug: grafana/grafana
# This URL doesn't use the Google auth, but is much more locked down. As such, it requires OIDC or a CodeCov-provided token to do anything.
url: https://codecov-webhook.grafana-dev.net
token: ${{ inputs.codecov-token }}
+5 -4
View File
@@ -25,17 +25,17 @@ jobs:
name: Test Backend
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.7'
cache: true
- name: Install dependencies
run: |
sudo apt-get update
@@ -61,7 +61,7 @@ jobs:
run: |
echo "Event: ${{ github.event_name }}"
echo "Ref: ${{ github.ref }}"
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "PR changed files:"
files=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files --jq '.[].filename')
@@ -100,6 +100,7 @@ jobs:
with:
unit-cov-path: unit.cov
integration-cov-path: integration.cov
codecov-token: ${{ secrets.CODECOV_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}