From eb9e9e59192966ffa444997463835916b0cde03a Mon Sep 17 00:00:00 2001 From: gnacho Date: Mon, 28 Sep 2026 22:30:19 +0200 Subject: [PATCH] ci: add coverage workflow with Codecov upload Runs the Go test suite with a coverage profile on pushes to main and pull requests, uploads the report to Codecov when the CODECOV_TOKEN secret is configured, and adds a coverage badge to the READMEs. The Codecov upload step is skipped while the secret is missing, so CI stays green until the repository owner connects the Codecov app. Ref #417 --- .github/workflows/coverage.yml | 36 ++++++++++++++++++++++++++++++++++ README.es.md | 1 + README.md | 1 + 3 files changed, 38 insertions(+) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..616c518 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,36 @@ +name: coverage + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + coverage: + name: Test coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-go@v6 + with: + go-version-file: go.mod + cache: true + + - name: Build frontend + working-directory: app + run: npm ci && npm run build + + - name: Run tests with coverage + run: go test -count=1 -coverprofile=coverage.txt -covermode=atomic ./... + + - name: Upload coverage to Codecov + if: ${{ secrets.CODECOV_TOKEN != '' }} + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.txt + fail_ci_if_error: false diff --git a/README.es.md b/README.es.md index ab5c3af..f8a9cbc 100644 --- a/README.es.md +++ b/README.es.md @@ -10,6 +10,7 @@ Demo en vivo Release Licencia + Cobertura

diff --git a/README.md b/README.md index 52598de..d71af57 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Live demo Release License + Coverage