forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (99 loc) · 2.79 KB
/
go.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Go
on:
push:
branches: [master]
pull_request:
jobs:
complete:
if: always()
needs: [check, build, test]
runs-on: ubuntu-22.04
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
check:
strategy:
matrix:
os: [ubuntu-22.04]
go: ["1.21"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
# For pull requests, build and test the PR head not a merge of the PR with the destination.
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- uses: ./.github/actions/setup-go
with:
go-version: ${{ matrix.go }}
- run: ./gomod.sh
- run: ./gofmt.sh
- run: ./gogenerate.sh
- run: ./govet.sh
- run: ./staticcheck.sh
build:
strategy:
matrix:
os: [ubuntu-22.04]
go: ["1.20", "1.21"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
# For pull requests, build and test the PR head not a merge of the PR with the destination.
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- uses: ./.github/actions/setup-go
with:
go-version: ${{ matrix.go }}
- run: go build ./...
- name: Build binaries
run: go run ./support/scripts/build_release_artifacts/main.go
test:
strategy:
matrix:
os: [ubuntu-22.04]
go: ["1.19", "1.20"]
pg: [12]
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres:${{ matrix.pg }}
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: postgres
REDIS_HOST: localhost
REDIS_PORT: 6379
steps:
- uses: actions/checkout@v3
with:
# For pull requests, build and test the PR head not a merge of the PR with the destination.
ref: ${{ github.event.pull_request.head.sha || github.ref }}
# We need to full history for git-restore-mtime to know what modification dates to use.
# Otherwise, the Go test cache will fail (due to the modification time of fixtures changing).
fetch-depth: '0'
- uses: ./.github/actions/setup-go
with:
go-version: ${{ matrix.go }}
- run: go test -race -cover ./...