-
Notifications
You must be signed in to change notification settings - Fork 312
121 lines (103 loc) · 3.18 KB
/
Copy pathci.yml
File metadata and controls
121 lines (103 loc) · 3.18 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
120
121
name: CI
on:
push:
branches:
- master
pull_request:
jobs:
test:
runs-on: ubuntu-22.04
services:
pg:
image: postgres:${{ matrix.pg.version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 5432:5432
volumes:
- /var/run/postgresql:/var/run/postgresql
strategy:
fail-fast: false
matrix:
pg:
- version: "9.4"
skip_wal: skip_wal
- version: "9.5"
skip_wal: skip_wal
- version: "9.6"
skip_wal: skip_wal
- version: "10"
- version: "11"
- version: "12"
- version: "13"
- version: "14"
- version: "15"
- version: "16"
- version: "17"
- version: "18"
pair:
- elixir: "1.15"
otp: "25"
include:
- pg:
version: "18"
pair:
elixir: "1.19"
otp: "28"
lint: lint
env:
MIX_ENV: test
steps:
- name: "Set PG settings"
run: |
PG_ID=${{ job.services.pg.id }}
# PG 18 config path is different from previous versions
# - /var/lib/postgresql/18/docker/postgresql.conf (PG 18)
# - /var/lib/postgresql/data/postgresql.conf (PG 17 and below)
# Dynamically find the path to postgresql.conf using psql
# We use the credentials from the service environment
CONFIG_FILE=$(docker exec $PG_ID psql -U postgres -d postgres -t -A -c 'SHOW config_file;')
# Trim whitespace and ensure the path is valid
CONFIG_FILE=$(echo $CONFIG_FILE | xargs)
if [ -z "$CONFIG_FILE" ]; then
echo "Error: Could not determine postgresql.conf path dynamically."
exit 1
fi
echo "Found config file at: $CONFIG_FILE"
# Use the discovered path to append the setting and restart the database
docker exec $PG_ID sh -c 'echo "wal_level=logical" >> '"$CONFIG_FILE"
docker restart $PG_ID
if: ${{ matrix.pg.skip_wal }} != 'skip_wal'
- uses: actions/checkout@v5
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.pair.otp}}
elixir-version: ${{matrix.pair.elixir}}
- uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{matrix.pair.elixir}}-${{matrix.pair.otp}}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-
- run: mix deps.get
- run: mix format --check-formatted
if: ${{ matrix.lint }}
- run: mix deps.unlock --check-unused
if: ${{ matrix.lint }}
- run: mix deps.compile
- run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}
- run: mix test
env:
PGUSER: postgres
PGPASSWORD: postgres
PG_SOCKET_DIR: /var/run/postgresql