-
-
Notifications
You must be signed in to change notification settings - Fork 104
141 lines (124 loc) · 3.91 KB
/
ci.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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: CI
on: [push, pull_request]
env:
CI: true
PGUSER: postgres
PGPASSWORD: postgres
PGHOST: "127.0.0.1"
PGPORT: 5432
NODE_OPTIONS: "--disable-proto=delete"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
postgres-version: [12, 13, 14, 15]
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: graphile_worker_test
ports:
- "0.0.0.0:5432:5432"
# needed because the postgres container does not provide a healthcheck
options:
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
- run: yarn prepack
- run: yarn test:setupdb
- run: yarn test:only --ci
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
- run: yarn lint
altschema:
runs-on: ubuntu-latest
env:
GRAPHILE_WORKER_SCHEMA: custom_schema
strategy:
matrix:
node-version: [20.x]
postgres-version: [12]
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: graphile_worker_test
ports:
- "0.0.0.0:5432:5432"
# needed because the postgres container does not provide a healthcheck
options:
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
- run: yarn prepack
- run: yarn test:setupdb
- run: yarn test:only --ci
database_updated:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
postgres-version: [12]
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: graphile_worker_test
ports:
- "0.0.0.0:5432:5432"
# needed because the postgres container does not provide a healthcheck
options:
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
- name: Install pg_dump
run: |
sudo bash -c "echo deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main >> /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -yqq install postgresql-client-11
- name: "Build code"
run: |
yarn prepack
ln -s .. node_modules/graphile-worker || true
- name: "Check schema hasn't changed"
run: |
yarn db:dump
git update-index -q --refresh
git diff-index --quiet HEAD -- || (git diff && echo "^^^ The database schema has changed, please run 'yarn db:dump'" && exit 1)