forked from pgmoneta/pgmoneta_ext
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (54 loc) · 2.23 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
name: CI
on:
push:
branches:
- main
- actions
pull_request:
branches:
- main
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update system
run: sudo apt update -y
- name: Install dependencies
run: sudo apt install -y git gcc cmake make postgresql postgresql-server-dev-all
- name: Init database
run: |
version=$(pg_config --version | grep -Eo "[0-9]{1,2}" | head -1)
sudo -u postgres /usr/lib/postgresql/${version}/bin/initdb /tmp/pgsql
- name: Config postgres
run: |
sudo -u postgres sed -i 's/#password_encryption = scram-sha-256/password_encryption = scram-sha-256/' /tmp/pgsql/postgresql.conf
sudo -u postgres sed -i '/^host/d' /tmp/pgsql/pg_hba.conf
echo 'cat <<EOF >> /tmp/pgsql/pg_hba.conf
host postgres repl 127.0.0.1/32 scram-sha-256
host postgres repl ::1/128 scram-sha-256
host replication repl 127.0.0.1/32 scram-sha-256
host replication repl ::1/128 scram-sha-256
EOF
'| sudo -u postgres -s
- name: Setup postgres
run: |
version=$(pg_config --version | grep -Eo "[0-9]{1,2}" | head -1)
sudo -u postgres /usr/lib/postgresql/${version}/bin/pg_ctl start -D /tmp/pgsql
sudo -u postgres /usr/lib/postgresql/${version}/bin/psql -U postgres -c "CREATE ROLE repl WITH LOGIN REPLICATION PASSWORD 'secretpassword';"
- name: GCC/mkdir
run: mkdir build
working-directory: /home/runner/work/pgmoneta/pgmoneta_ext/
- name: GCC/cmake
run: export CC=/usr/bin/gcc && cmake -DCMAKE_BUILD_TYPE=Debug ..
working-directory: /home/runner/work/pgmoneta/pgmoneta_ext/build/
- name: GCC/make
run: make
working-directory: /home/runner/work/pgmoneta/pgmoneta_ext/build/
- name: rm -Rf
run: rm -Rf build/
working-directory: /home/runner/work/pgmoneta/pgmoneta_ext/
- name: Cleanup
run: |
version=$(pg_config --version | grep -Eo "[0-9]{1,2}" | head -1)
sudo -u postgres /usr/lib/postgresql/${version}/bin/pg_ctl stop -D /tmp/pgsql