Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Coverage

on:
push:
branches:
- main
tags:
- 'v*'

permissions:
contents: read

concurrency:
group: coverage-${{ github.ref }}
cancel-in-progress: true

jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Install mise
uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0

- name: Cache Go modules and build
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
restore-keys: go-${{ runner.os }}-

- name: Download Go dependencies
run: go mod download

- name: Run tests with coverage
run: make cover

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage.out
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
go.work
go.work.sum

# coverage output
coverage.out
coverage.html

# Local configuration files
*.local.*
*.local/
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ lint:
test:
go test -race -failfast ./...

.PHONY: cover
cover:
go test -race -covermode=atomic -coverprofile=coverage.out ./...
go tool cover -func=coverage.out

.PHONY: cover-html
cover-html: cover
go tool cover -html=coverage.out -o coverage.html

.PHONY: check-tidy
check-tidy:
go mod tidy -diff
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generic Sync Map

[![Go Reference](https://pkg.go.dev/badge/github.com/min0625/gsyncmap.svg)](https://pkg.go.dev/github.com/min0625/gsyncmap)
[![codecov](https://codecov.io/gh/min0625/gsyncmap/branch/main/graph/badge.svg)](https://codecov.io/gh/min0625/gsyncmap)

**English** | [繁體中文](./README.zh-TW.md)

Expand Down
1 change: 1 addition & 0 deletions README.zh-TW.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generic Sync Map

[![Go Reference](https://pkg.go.dev/badge/github.com/min0625/gsyncmap.svg)](https://pkg.go.dev/github.com/min0625/gsyncmap)
[![codecov](https://codecov.io/gh/min0625/gsyncmap/branch/main/graph/badge.svg)](https://codecov.io/gh/min0625/gsyncmap)

[English](./README.md) | **繁體中文**

Expand Down
Loading