-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (68 loc) · 1.8 KB
/
Copy pathci.yml
File metadata and controls
80 lines (68 loc) · 1.8 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
name: CI
on:
push:
branches: ["main", "master"]
pull_request:
permissions:
contents: read
jobs:
test:
name: Test (Go ${{ matrix.go-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: ["1.22.x", "1.23.x"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Verify formatting
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "The following files need gofmt:"
gofmt -l .
exit 1
fi
- name: Vet
run: go vet ./...
- name: Test
run: go test ./... -count=1 -covermode=atomic -coverprofile=coverage.out
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-go-${{ matrix.go-version }}
path: coverage.out
postgres-integration:
name: Postgres integration
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: dbx
POSTGRES_PASSWORD: dbx
POSTGRES_DB: dbx_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U dbx -d dbx_test"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DBX_PG_DSN: postgres://dbx:dbx@localhost:5432/dbx_test?sslmode=disable
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23.x"
cache: true
- name: Run Postgres integration tests
run: go test ./... -count=1 -run PostgresIntegration