Add CI pipeline #2
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
name: GoURN CI | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.20.x | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.x | |
cache-dependency-path: go.sum | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: go-fmt | |
run: | | |
if [ -n "$(gofmt -s -l .)" ]; then | |
echo "Go code is not formatted, run 'gofmt -s -w .'" | |
exit 1 | |
fi | |
- name: go-vet | |
run: go vet ./... | |
- name: revive | |
run: | | |
go install github.com/mgechev/[email protected] | |
revive -config .revive.toml -formatter friendly ./... | |
test: | |
name: Test | |
needs: check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up Go 1.20.x | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.x | |
cache-dependency-path: go.sum | |
- name: Test GoURN | |
run: go test -v -covermode=count -coverprofile=coverage.out ./... |