-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (70 loc) · 2.31 KB
/
main.yaml
File metadata and controls
77 lines (70 loc) · 2.31 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
name: "go"
on:
push:
branches:
- "master"
pull_request:
branches:
- "master"
jobs:
quality-check:
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
- uses: "actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c" # v6.4.0
with:
go-version: "1.26"
- uses: "actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7" # v5.0.4
with:
path: "~/.cache/go-build"
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- run: "go vet ./..."
- run: "staticcheck ./..."
- run: "golangci-lint run ./..."
- run: |
diff=$(goimports -d .)
if [ -n "$diff" ]; then
echo "$diff"
exit 1
fi
test:
runs-on: "ubuntu-24.04"
services:
postgres:
image: "postgres:16"
env:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
ports:
- "5432:5432"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
- uses: "actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c" # v6.4.0
with:
go-version: "1.26"
- uses: "actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7" # v5.0.4
with:
path: "~/.cache/go-build"
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: "Setup test database"
run: |
PGPASSWORD=postgres psql -h localhost -U postgres <<-EOF
CREATE USER kit WITH SUPERUSER PASSWORD 'kit';
CREATE DATABASE kit_test;
GRANT ALL PRIVILEGES ON DATABASE kit_test TO kit;
EOF
PGPASSWORD=kit psql -h localhost -U kit -d kit_test -c "ALTER SCHEMA public OWNER TO kit;"
- run: "go test -v -count=1 ./..."