Skip to content

Commit

Permalink
feat: introduce github actions and badges
Browse files Browse the repository at this point in the history
Prior to this change, there was no automated checks on pull requests and
we didn't promote the quality of the project.

This change introduces github actions to test, vet and report on code
coverage.  Also, we link to the go reference page and show badges for
code quality and coverage in the README.
  • Loading branch information
au-phiware committed Dec 19, 2023
1 parent b64f8b0 commit 0e5cd36
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5

- name: Format
run: gofmt -s -w . && git diff --exit-code

- name: Tidy
run: go mod tidy && git diff --exit-code

- name: Test
run: go test -v ./...

- name: Coverage report
uses: ncruces/go-coverage-report@v0
with:
report: true
chart: true
amend: true
if: |
github.event_name == 'push'
continue-on-error: true
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# `mock` module

[![Go Reference](https://pkg.go.dev/badge/image)](https://pkg.go.dev/github.com/Versent/go-mock)
[![Go Report](https://goreportcard.com/badge/github.com/Versent/go-mock)](https://goreportcard.com/report/github.com/Versent/go-mock)
[![Go Coverage](https://github.com/Versent/go-mock/wiki/coverage.svg)](https://github.com/Versent/go-mock/wiki/Test-coverage-report)

Tired of mocking libraries with cumbersome APIs? Frustrated with numerous and complicated options?
Looking for a mock that works well with a composite of small interfaces or loves high ordered
functions?
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
require (
github.com/google/subcommands v1.2.0
golang.org/x/tools v0.16.0
rsc.io/script v0.0.1
rsc.io/script v0.0.2-0.20231205190631-334f6c18cff3
)

require golang.org/x/mod v0.14.0 // indirect
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM=
golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
rsc.io/script v0.0.1 h1:t8dtrXAUACmR2OV0OXuQ9otT/5x2F/QqsnssYhtcziM=
rsc.io/script v0.0.1/go.mod h1:CQ30lgzFbVimcUVFHfewSNOAv0ag6UQ0b0nIWeN22Fc=
rsc.io/script v0.0.2-0.20231205190631-334f6c18cff3 h1:2vM6uMBq2/Dou/Wzu2p+yUFkuI3lgMbX0UYfVnzh0ck=
rsc.io/script v0.0.2-0.20231205190631-334f6c18cff3/go.mod h1:cKBjCtFBBeZ0cbYFRXkRoxP+xGqhArPa9t3VWhtXfzU=

0 comments on commit 0e5cd36

Please sign in to comment.