fix: automatically create release in GitHub Action #3
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: Dev CI | |
permissions: | |
contents: read | |
on: | |
push: | |
branches: [dev] | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
strategy: | |
matrix: | |
go: ['stable', 'oldstable'] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Cache Go Modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/go/bin | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Go Format | |
run: | | |
gofmt -s -w . | |
if [ -n "$(git diff --exit-code)" ]; then | |
echo "::warning::there are uncommitted changes after running go fmt" | |
fi | |
- name: Go Vet | |
run: go vet ./... | |
- name: Go Tidy | |
run: go mod tidy | |
- name: Go Mod Download | |
run: go mod download | |
- name: Go Mod Verify | |
run: go mod verify | |
- name: Go Generate | |
run: | | |
go generate ./... | |
if [ -n "$(git diff --exit-code)" ]; then | |
echo "::warning::there are uncommitted changes after running go generate" | |
fi | |
- name: Go Test | |
run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./... |