forked from infratographer/load-balancer-api
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (43 loc) · 1.86 KB
/
test-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
---
name: Test - Golang
# Run for all pushes to main and pull requests when Go or YAML files change
on:
push:
pull_request:
jobs:
gotest:
name: test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ci-database: ["sqlite", "cockroach-v22.1", "cockroach-v22.2", "cockroach-latest", "postgres-14", "postgres-15", "postgres-latest"]
include:
- ci-database: "sqlite"
env-database-uri: "sqlite://file:ent?mode=memory&cache=shared&_fk=1"
- ci-database: "cockroach-v22.1"
env-database-uri: "docker://cockroach:latest-v22.1"
- ci-database: "cockroach-v22.2"
env-database-uri: "docker://cockroach:latest-v22.2"
- ci-database: "cockroach-latest"
env-database-uri: "docker://cockroach:latest"
- ci-database: "postgres-14"
env-database-uri: "docker://postgres:14-alpine"
- ci-database: "postgres-15"
env-database-uri: "docker://postgres:15-alpine"
- ci-database: "postgres-latest"
env-database-uri: "docker://postgres:alpine"
steps:
- name: Checkout code for ${{ matrix.ci-database }}
uses: actions/checkout@v4
- name: Set up Go for ${{ matrix.ci-database }}
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Install atlas for db migrations on ${{ matrix.ci-database }}
run: go install ariga.io/atlas/cmd/atlas@latest
# with one retry
- name: Run go tests for ${{ matrix.ci-database }}
run: |
LOADBALANCERAPI_TESTDB_URI="${{ matrix.env-database-uri }}" go test -race -coverprofile=coverage.txt -covermode=atomic -tags testtools ./... || \
LOADBALANCERAPI_TESTDB_URI="${{ matrix.env-database-uri }}" go test -race -coverprofile=coverage.txt -covermode=atomic -tags testtools ./...