-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (72 loc) · 2.33 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
types:
- opened
- reopened
- synchronize
- ready_for_review
workflow_dispatch:
permissions:
contents: write # Needed by semantic-release/github
pull-requests: write # Needed by semantic-release/github
issues: write # Needed by semantic-release/github
jobs:
ci:
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
id: setup-go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Verify dependencies
run: go mod verify
- name: Go fmt
run: gofmt -l .
- name: Build
run: go build -v ./...
- name: Run go vet
run: go vet ./...
- name: Run staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
- name: Run golint
run: |
go install golang.org/x/lint/golint@latest
golint ./...
- name: Run tests
run: go test -race -vet=off ./...
- name: Build cross platform binaries
env:
LINUX_OS_ARCH: 'linux/386 linux/amd64 linux/arm linux/arm64'
WINDOWS_OS_ARCH: 'windows/386 windows/amd64'
DARWIN_OS_ARCH: 'darwin/amd64 darwin/arm64'
run: |
go install github.com/mitchellh/gox@latest
# https://github.com/mitchellh/gox/issues/146#issuecomment-702096359
gox \
-osarch "${LINUX_OS_ARCH} ${WINDOWS_OS_ARCH} ${DARWIN_OS_ARCH}" \
-output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" ./...
- name: Semantic Release
if: |
( github.ref == 'refs/heads/main' && github.event_name == 'push' ) ||
github.event_name == 'workflow_dispatch'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm -g i \
semantic-release@^21 \
@semantic-release/commit-analyzer@^10 \
@semantic-release/release-notes-generator@^11 \
@semantic-release/changelog@^6 \
@semantic-release/git@^10 \
@semantic-release/github@^9 \
conventional-changelog-conventionalcommits@^5
npx semantic-release