-
Notifications
You must be signed in to change notification settings - Fork 70
80 lines (68 loc) · 1.83 KB
/
check.yml
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
78
79
80
name: Check
on:
# run tests on push to main, but not when other branches are pushed to
push:
branches:
- main
# run tests for all pull requests
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22.x
id: go
- name: Checkout code
uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55
args: --verbose --timeout 5m
- name: Check go.mod/go.sum
run: |
echo "check if go.mod and go.sum are up to date"
go mod tidy
git diff --exit-code go.mod go.sum
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22.x
id: go
- name: Checkout code
uses: actions/checkout@v3
- name: Run tests
run: |
go test ./...
build:
strategy:
matrix:
go-version:
- 1.22.x
runs-on: ubuntu-latest
name: Build with Go ${{ matrix.go-version }}
env:
GOPROXY: https://proxy.golang.org
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Checkout code
uses: actions/checkout@v3
- name: Build
run: |
GOOS=linux GOARCH=amd64 go build -o pretender_linux_amd64
GOOS=linux GOARCH=arm64 go build -o pretender_linux_arm64
GOOS=windows GOARCH=amd64 go build -o pretender_windows
GOOS=darwin GOARCH=amd64 go build -o pretender_macos_amd64
GOOS=darwin GOARCH=arm64 go build -o pretender_linux_arm64