Skip to content

Commit

Permalink
github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
calebdoxsey committed Mar 21, 2022
1 parent 010ac6e commit 0bf6573
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
jobs:
golangci:
name: Go
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: latest
53 changes: 53 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test
on:
push:
tags:
- v*
branches:
- main
pull_request:
jobs:
test:
name: Go
runs-on: ubuntu-latest
steps:
- name: Install go
uses: actions/setup-go@v3
with:
go-version: "1.18"

- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- name: Checkout
uses: actions/checkout@v3

- name: Cache go build
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build

- name: Cache go modules
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mod-
- name: Download go modules
run: |
go mod download
- name: Run tests
run: |
go test -race -covermode atomic -coverprofile=covprofile ./...
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
go run github.com/mattn/goveralls -coverprofile=covprofile -service=github

0 comments on commit 0bf6573

Please sign in to comment.