-
Notifications
You must be signed in to change notification settings - Fork 4
62 lines (50 loc) · 1.35 KB
/
ci.yml
File metadata and controls
62 lines (50 loc) · 1.35 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
name: Go Build
permissions:
contents: read
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
env:
GO_VERSION: '1.25'
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20
with:
version: latest
- name: Lint
run: golangci-lint run
- name: Format Check
run: |
go fmt ./...
if [ -n "$(git diff)" ]; then
echo "Code is not properly formatted. Please run 'go fmt ./...'"
exit 1
fi
build-and-test:
name: Build and Test
needs: lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...