-
Notifications
You must be signed in to change notification settings - Fork 275
57 lines (55 loc) · 2.52 KB
/
test.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
name: test
on: [push, pull_request]
jobs:
test:
name: Node v${{ matrix.node }} on PostgreSQL v${{ matrix.postgres }}
strategy:
fail-fast: false
matrix:
node: ['12', '14', '16', '18', '20']
postgres: ['12', '13', '14', '15', '16']
runs-on: ubuntu-latest
services:
postgres:
image: postgres:${{ matrix.postgres }}
env:
POSTGRES_USER: postgres
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5433:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- run: |
date
sudo apt purge postgresql-14
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-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 -y install "postgresql-${{ matrix.postgres }}"
sudo cp ./tests/pg_hba.conf /etc/postgresql/${{ matrix.postgres }}/main/pg_hba.conf
sudo sed -i 's/.*wal_level.*/wal_level = logical/' /etc/postgresql/${{ matrix.postgres }}/main/postgresql.conf
sudo sed -i 's/.*max_prepared_transactions.*/max_prepared_transactions = 100/' /etc/postgresql/${{ matrix.postgres }}/main/postgresql.conf
sudo sed -i 's/.*ssl = .*/ssl = on/' /etc/postgresql/${{ matrix.postgres }}/main/postgresql.conf
openssl req -new -x509 -nodes -days 365 -text -subj "/CN=localhost" -extensions v3_req -config <(cat /etc/ssl/openssl.cnf <(printf "\n[v3_req]\nbasicConstraints=critical,CA:TRUE\nkeyUsage=nonRepudiation,digitalSignature,keyEncipherment\nsubjectAltName=DNS:localhost")) -keyout server.key -out server.crt
sudo cp server.key /etc/postgresql/${{ matrix.postgres }}/main/server.key
sudo cp server.crt /etc/postgresql/${{ matrix.postgres }}/main/server.crt
sudo chmod og-rwx /etc/postgresql/${{ matrix.postgres }}/main/server.key
sudo systemctl start postgresql.service
sudo systemctl status postgresql.service
pg_isready
sudo -u postgres psql -c "SHOW hba_file;"
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: npm test
env:
PGUSER: postgres
PGSOCKET: /var/run/postgresql