-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Jamstah/coverage
- Loading branch information
Showing
6 changed files
with
65 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.go text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,49 @@ | ||
name: test | ||
on: [push, pull_request] | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
TESTFLAGS: -v | ||
BUILDFLAGS: -v | ||
|
||
jobs: | ||
test: | ||
build: | ||
strategy: | ||
matrix: | ||
go-version: [1.20.x, 1.21.x] | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- uses: actions/checkout@v3 | ||
- name: Test | ||
run: go test -v ./... | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Build | ||
run: | | ||
make build | ||
- name: lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.53 | ||
args: --print-resources-usage --timeout=10m --verbose | ||
|
||
- name: Test | ||
run: | | ||
make coverage | ||
- name: Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
directory: ./ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Cover profiles | ||
*.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Project packages. | ||
PACKAGES=$(shell go list ./...) | ||
|
||
# Flags passed to `go test` | ||
BUILDFLAGS ?= | ||
TESTFLAGS ?= | ||
|
||
.PHONY: all build test coverage | ||
.DEFAULT: all | ||
|
||
all: build | ||
|
||
build: ## no binaries to build, so just check compilation suceeds | ||
go build ${BUILDFLAGS} ./... | ||
|
||
test: ## run tests | ||
go test ${TESTFLAGS} ./... | ||
|
||
coverage: ## generate coverprofiles from the unit tests | ||
rm -f coverage.txt | ||
go test ${TESTFLAGS} -cover -coverprofile=cover.out ./... | ||
|
||
.PHONY: help | ||
help: | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_\/%-]+:.*?##/ { printf " \033[36m%-27s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters