-
Notifications
You must be signed in to change notification settings - Fork 3
97 lines (90 loc) · 2.58 KB
/
ci.yml
File metadata and controls
97 lines (90 loc) · 2.58 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.26'
check-latest: true
- name: Checkout code
uses: actions/checkout@v4
- name: Check diff between gofmt and code
run: diff <(gofmt -d .) <(echo -n)
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.26]
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: go test -v -race ./...
lint:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.26'
- name: Checkout code
uses: actions/checkout@v4
- name: Go vet
run: go vet -x ./...
- name: Golangci-lint
uses: golangci/golangci-lint-action@v8.0.0
audit:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.26'
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Audit
run: make audit
build:
runs-on: ubuntu-latest
needs: [format, test, lint, audit]
strategy:
matrix:
go-version: [1.26]
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: |
mkdir -p output/{linux,freebsd}
VERSION=$(git describe --tags 2>/dev/null || echo "dev")
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -X github.com/mkmccarty/TokenTimeBoostBot/version.GitHash=$(git describe --tags --always --long --dirty)" -o output/freebsd/boostbot-$VERSION-freebsd-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -X github.com/mkmccarty/TokenTimeBoostBot/version.GitHash=$(git describe --tags --always --long --dirty)" -o output/linux/boostbot-$VERSION-linux-amd64
- name: Upload linux
uses: actions/upload-artifact@v4
with:
name: boostbot-linux
path: output/linux
- name: Upload freebsd
uses: actions/upload-artifact@v4
with:
name: boostbot-freebsd
path: output/freebsd