Skip to content

Commit

Permalink
feat: start measuring code coverage
Browse files Browse the repository at this point in the history
This diff adapts rbmk-project/common#29
to this repository and includes the fix to use `-short` to avoid
measuring the code coverage of integration tests, which was
added in rbmk-project/common#31.
  • Loading branch information
bassosimone committed Mar 1, 2025
1 parent ad1a9d1 commit 0b7ffa8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
branches: ["main"]

jobs:
build:
build_and_test:
strategy:
matrix:
goversion:
Expand All @@ -32,4 +32,25 @@ jobs:
run: go build ./...

- name: Test
run: go test -race -cover ./...
run: go test -race ./...

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
# Here we should use the current go version
go-version: "1.24"

- name: Measure Coverage
run: go test -short -race -covermode=atomic -coverprofile=coverage.out ./...

- name: Upload Coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.out
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Experimental libraries

[![GoDoc](https://pkg.go.dev/badge/github.com/rbmk-project/x)](https://pkg.go.dev/github.com/rbmk-project/x)
[![GoDoc](https://pkg.go.dev/badge/github.com/rbmk-project/x)](https://pkg.go.dev/github.com/rbmk-project/x) [![Build Status](https://github.com/rbmk-project/x/actions/workflows/go.yml/badge.svg)](https://github.com/rbmk-project/x/actions) [![codecov](https://codecov.io/gh/rbmk-project/x/branch/main/graph/badge.svg)](https://codecov.io/gh/rbmk-project/x)

This repository contains several experimental libraries
reused across different [rbmk](https://github.com/rbmk-project)
Expand Down

0 comments on commit 0b7ffa8

Please sign in to comment.