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

Update CI workflow #18

Merged
merged 2 commits into from
Jul 5, 2022
Merged
Changes from 1 commit
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
Next Next commit
Update CI worklflow
  • Loading branch information
fatih committed Jul 5, 2022
commit e172da3cb1f7e5266a8edca1b44d5938b5c49415
29 changes: 23 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: build
on:
push:
branches:
- master
- main
tags:
- 'v*'
Expand All @@ -18,18 +17,36 @@ jobs:
steps:

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ^1.16.1
go-version: '>=1.18.0'

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Run go mod tidy
run: |
set -e
go mod tidy
output=$(git status -s)
if [ -z "${output}" ]; then
exit 0
fi
echo 'We wish to maintain a tidy state for go mod. Please run `go mod tidy` on your branch, commit and push again.'
echo 'Running `go mod tidy` on this CI test yields with the following changes:'
echo "$output"
exit 1

- name: Test
run: |
go mod tidy -v
go test -race ./...

- name: Lint
uses: dominikh/staticcheck-action@v1.2.0
with:
version: "2022.1.1"
install-go: false

- name: Build
run: go build ./...

Expand All @@ -38,7 +55,7 @@ jobs:
# only release on tags
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: v0.156.1
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.ERRWRAP_ACTIONS_BOT_TOKEN }}