From c9552ad211513931ec6ebad63594a5c066f6175d Mon Sep 17 00:00:00 2001 From: Vladyslav Kuksiuk Date: Thu, 9 Jul 2026 13:20:25 +0200 Subject: [PATCH 1/3] Provide codecov flow. --- .github/workflows/coverage.yml | 35 ++++++++++++++++++++++++++++++++++ PROJECT.md | 2 ++ README.md | 2 ++ codecov.yml | 8 ++++++++ 4 files changed, 47 insertions(+) create mode 100644 .github/workflows/coverage.yml create mode 100644 codecov.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..5e0ca3e --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,35 @@ +name: Coverage + +on: + pull_request: + +permissions: + contents: read + +jobs: + coverage: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + + steps: + - name: Checkout Repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Set Up Go Environment + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - name: Generate Test Coverage + run: go test ./... -covermode=atomic -coverpkg=./... -coverprofile=cover.out + + - name: Upload Coverage + uses: codecov/codecov-action@v5 + with: + files: ./cover.out + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/PROJECT.md b/PROJECT.md index ad07a74..107261e 100644 --- a/PROJECT.md +++ b/PROJECT.md @@ -57,6 +57,8 @@ This repository is configured with these GitHub workflows: - `check`: runs linting, the normal Go test suite, and the showcase end-to-end tests across supported platforms. +- `coverage`: uploads Go coverage to Codecov, where `codecov.yml` requires + 90% patch coverage for pull requests. - `release-binaries`: reads `VERSION`, builds Linux, macOS, and Windows binaries, signs and notarizes the macOS ARM64 and x64 ZIPs, and creates the matching GitHub Release on pushes to `master`. It runs on a self-hosted macOS diff --git a/README.md b/README.md index 614d546..ff149d7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Embed Code +[![Coverage](https://codecov.io/gh/SpineEventEngine/embed-code-go/branch/master/graph/badge.svg)](https://codecov.io/gh/SpineEventEngine/embed-code-go) + Embed Code is a Go command-line tool that keeps documentation snippets in sync with source files. It scans Markdown and HTML documents for `` instructions, resolves the requested source content, and manages the following diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..886a1c5 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,8 @@ +coverage: + status: + project: off + patch: + default: + target: 90% + threshold: 0% + only_pulls: true From dbc645e9aa7fe6e35fa52130b137aaafdaf726c4 Mon Sep 17 00:00:00 2001 From: Vladyslav Kuksiuk Date: Thu, 9 Jul 2026 13:43:01 +0200 Subject: [PATCH 2/3] Update codecov version. --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 5e0ca3e..cd86e21 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -28,7 +28,7 @@ jobs: run: go test ./... -covermode=atomic -coverpkg=./... -coverprofile=cover.out - name: Upload Coverage - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@v7 with: files: ./cover.out fail_ci_if_error: true From 176413f918c3f0c4d852f02bd3ac5d30d51660bf Mon Sep 17 00:00:00 2001 From: Vladyslav Kuksiuk Date: Thu, 9 Jul 2026 14:00:03 +0200 Subject: [PATCH 3/3] Add on-push trigger. --- .github/workflows/coverage.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index cd86e21..5d7e5ed 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -2,6 +2,9 @@ name: Coverage on: pull_request: + push: + branches: + - master permissions: contents: read