-
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (106 loc) · 3.3 KB
/
Copy pathverify.yml
File metadata and controls
119 lines (106 loc) · 3.3 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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: verify
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
jobs:
path-filter:
name: Check Changed Paths
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- 'generator/**'
- 'cli/**'
- 'schema/**'
- 'integration/**'
- 'dbProviders/**'
- 'migration/**'
- 'benchmark/**'
- '*.go'
- 'go.mod'
- 'go.sum'
- '.github/workflows/**'
compiler-unit-tests:
needs: path-filter
if: ${{ needs.path-filter.outputs.code == 'true' }}
name: Unit Tests (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Run compiler unit tests
run: go test -race -v ./...
integration-tests:
needs: path-filter
if: ${{ needs.path-filter.outputs.code == 'true' }}
name: Run Database Integration Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpassword
POSTGRES_DB: phi_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Generate integration client
run: make integration-gen
- name: Run Formatter Check
run: make fmt-check
- name: Run Tidy Check
run: make tidy-check
- name: Vet packages
run: make vet
- name: Run SQLite Integration Tests
run: |
cp integration/schema.prisma integration/schema.prisma.bak
node integration/prepareSchema.js sqlite
rm -f integration/phi/migrations/*.sql
make integration-gen
cd integration
../bin/phi migrate -u "file:dev.db" init_sqlite
go test -race -tags sqlite -v ./...
mv schema.prisma.bak schema.prisma
- name: Run Postgres Integration Tests
run: |
PG_URL="${{ secrets.PG_DATABASE_URL }}"
if [ -z "$PG_URL" ]; then
PG_URL="postgres://testuser:testpassword@localhost:5432/phi_test?sslmode=disable"
else
PG_URL="${PG_URL/valkyrie_test/phi_test}"
PG_URL="${PG_URL/valk_test/phi_test}"
fi
cp integration/schema.prisma integration/schema.prisma.bak
node integration/prepareSchema.js postgres
rm -f integration/phi/migrations/*.sql
make integration-gen
cd integration
../bin/phi migrate -u "$PG_URL" init_pg
PG_DATABASE_URL="$PG_URL" go test -race -v ./...
mv schema.prisma.bak schema.prisma