To support PostgreSQL v16 #215
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: "0 1 * * SUN" # only master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
PGVERSION: # TODO: build with master branch | |
- "16.1" | |
- "15.5" | |
- "14.10" | |
- "13.13" | |
- "12.17" | |
- "11.22" | |
- "10.23" | |
- "9.6.24" | |
env: | |
CACHE_VERSION: 20221222 # to identify cache version | |
steps: | |
- name: cat version | |
shell: bash -xe {0} | |
run: | | |
cat /etc/os-release | |
uname -a | |
- name: get current branch name | |
shell: bash -xe {0} | |
run: | | |
if [ ${{ github.event_name }} = "pull_request" ]; then | |
echo "BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV | |
else # push | |
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
fi | |
- name: set build postgresql version | |
shell: bash -xe {0} | |
run: | | |
echo "PGVERSION=${{ matrix.PGVERSION }}" >> $GITHUB_ENV | |
- name: cache builded resources | |
id: cache-postgresql-core | |
uses: actions/cache@v2 | |
with: | |
path: "~/pgsql/${{ env.PGVERSION }}" | |
key: ${{ env.PGVERSION }}-${{ env.CACHE_VERSION }} | |
- name: build postgresql | |
if: steps.cache-postgresql-core.outputs.cache-hit != 'true' | |
shell: bash -xe {0} | |
run: | | |
# set environment variables | |
export PGHOME=~/pgsql/${{ env.PGVERSION }} | |
# install | |
sudo apt-get update -qq | |
sudo apt-get -y install bc libpam-dev libedit-dev | |
wget -q https://ftp.postgresql.org/pub/source/v${{ env.PGVERSION }}/postgresql-${{ env.PGVERSION }}.tar.gz | |
tar xzf postgresql-${{ env.PGVERSION }}.tar.gz | |
# TODO: if test with master branch | |
# git clone --single-branch --branch ${{ env.PGVERSION }} \ | |
# https://github.com/postgres/postgres.git ${{ env.PGVERSION }} | |
cd postgresql-${{ env.PGVERSION }} | |
./configure --prefix=$PGHOME --enable-cassert | |
gcc -v | |
LOGFILE=~/make.log | |
make -j 4 2>&1 | tee $LOGFILE | |
make install 2>&1 | tee -a $LOGFILE | |
- name: show build warning | |
if: steps.cache-postgresql-core.outputs.cache-hit != 'true' | |
shell: bash -xe {0} | |
run: | | |
LOGFILE=~/make.log # TODO: though I want to remove duplicated vars... | |
grep -C 1 warning $LOGFILE || exit 0 # ok if warning doesn't exists (= status code is 1) | |
- name: create database directory | |
shell: bash -xe {0} | |
run: | | |
export PGHOME=~/pgsql/${{ env.PGVERSION }} | |
export PGDATA=~/pgdata/${{ env.PGVERSION }} | |
export ARCHIVEDIR=~/pgdata/arc | |
export PATH=$PGHOME/bin:$PATH: | |
mkdir -p $PGDATA | |
initdb --no-locale -D $PGDATA | |
echo "local all postgres trust" > $PGDATA/pg_hba.conf | |
echo "local all all trust" >> $PGDATA/pg_hba.conf | |
echo "host all all 127.0.0.1/32 trust" >> $PGDATA/pg_hba.conf | |
echo "host all all ::1/128 trust" >> $PGDATA/pg_hba.conf | |
echo "wal_level = hot_standby" >> $PGDATA/postgresql.conf # mapped to "replica" from PG9.6 | |
echo "archive_mode = on" >> $PGDATA/postgresql.conf | |
echo "archive_command = 'cp %p $ARCHIVEDIR/%f'" >> $PGDATA/postgresql.conf | |
pg_ctl -V | |
pg_ctl -D $PGDATA start | |
- name: show postgresql configuration | |
shell: bash -xe {0} | |
run: | | |
export PGHOME=~/pgsql/${{ env.PGVERSION }} | |
export PGDATA=~/pgdata/${{ env.PGVERSION }} | |
export PATH=$PGHOME/bin:$PATH: | |
pg_config --version | |
cat $PGDATA/postgresql.conf | |
- uses: actions/checkout@v2 | |
- name: make install | |
shell: bash -xe {0} | |
run: | | |
export PGHOME=~/pgsql/${{ env.PGVERSION }} | |
export PATH=$PGHOME/bin:$PATH: | |
LOGFILE=~/make.log | |
make install 2>&1 | tee $LOGFILE | |
- name: show build warning | |
shell: bash -xe {0} | |
run: | | |
LOGFILE=~/make.log | |
grep -C 1 warning $LOGFILE || exit 0 # ok if warning doesn't exists (= status code is 1) | |
- name: make installcheck | |
shell: bash -xe {0} | |
run: | | |
export PGHOME=~/pgsql/${{ env.PGVERSION }} | |
export PATH=$PGHOME/bin:$PATH: | |
make installcheck | |
- name: show the result if the regression test failed | |
if: failure() | |
shell: bash -xe {0} | |
run: | | |
cat bin/regression.diffs \ | |
&& exit 1 # notify fail |