Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage CI job #15

Merged
merged 3 commits into from
Jan 5, 2024
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
47 changes: 47 additions & 0 deletions .github/workflows/unit-test-on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,50 @@ jobs:
- name: Run Benchmarks
run: |
GOMAXPROCS=100 make bench

coverage:
name: Coverage
runs-on: ubuntu-latest
strategy:
fail-fast: true
max-parallel: 2
matrix:
go: ["stable"]
permissions:
contents: write
steps:
- name: Set up Go ${{matrix.go}}
uses: actions/setup-go@v4
with:
go-version: ${{matrix.go}}
check-latest: true
id: go
- name: Check out
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Build
run: |
go install
- name: Run Coverage
run: |
go test -v -cover ./... -coverprofile coverage.out -coverpkg ./...
go tool cover -func coverage.out -o coverage.out # Replaces coverage.out with the analysis of coverage.out

- name: Go Coverage Badge
uses: tj-actions/coverage-badge-go@v1
# if: ${{ runner.os == 'Linux' && matrix.go == '1.17' }} # Runs this on only one of the ci builds.
with:
green: 80
filename: coverage.out

# - name: Pull in remote changes
# run: git pull --rebase

- uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit-action
with:
commit_message: Apply Code Coverage Badge
skip_fetch: true
skip_checkout: true
file_pattern: ./README.md
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Go Reference](https://pkg.go.dev/badge/github.com/elastic/go-freelru.svg)](https://pkg.go.dev/github.com/elastic/go-freelru)
![Coverage](https://img.shields.io/badge/Coverage-93.5%25-brightgreen)
[![Go Report Card](https://goreportcard.com/badge/github.com/elastic/go-freelru)](https://goreportcard.com/report/github.com/elastic/go-freelru)

# FreeLRU - A GC-less, fast and generic LRU hashmap library for Go
Expand Down
Loading