Skip to content

Commit

Permalink
[pgmoneta#9]Add CI to trigger Github actions
Browse files Browse the repository at this point in the history
Based on a patch by [email protected]
  • Loading branch information
Jubilee101 committed Jun 8, 2024
1 parent 8774e89 commit 1fd30d3
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit 1fd30d3

Please sign in to comment.