-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (66 loc) · 1.75 KB
/
build.yaml
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
name: Continuous Integration
on:
push:
branches: '**'
paths-ignore:
- 'doc/**'
tags-ignore:
- '*.*'
pull_request:
branches: '**'
paths-ignore:
- 'doc/**'
jobs:
unit:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.19', '1.20' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run unit tests
run: go test -race ./...
working-directory: .
integration:
runs-on: ubuntu-latest
services:
postgres15:
image: postgres:15
env:
POSTGRES_DB: cep
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secret
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run migrations
run: psql -f migrations/schema.sql postgresql://postgres:secret@localhost:5432/cep?sslmode=disable
- name: Run integration tests
working-directory: storage/postgres
run: go test -race -count=2 ./...
env:
TEST_DATABASE_URL: postgresql://postgres:secret@localhost:5432/cep?sslmode=disable