Skip to content

Add CI for PG 14 and master branches. #10

Add CI for PG 14 and master branches.

Add CI for PG 14 and master branches. #10

Workflow file for this run

name: 'PostgreSQL 15 - Basic tests'
env:
# Use it just for a report
PG_MAJOR_VERSION: 15
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# Trigger it each time on push or pull request. It seems redundant
# most of the time, but external pull-request checks shouldn't be missed out.
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Define PostreSQL major version"
run: |
echo "The action workflow is triggered by the $BRANCH_NAME"
sudo apt install libipc-run-perl libreadline-dev libxml2-utils xsltproc libxslt1-dev fop
git config --global user.email "ci@danolivo.com"
git config --global user.name "CI"
echo "PG_MAJOR_VERSION=$PG_MAJOR_VERSION" >> $GITHUB_ENV
branch_name="REL_${PG_MAJOR_VERSION}_STABLE"
echo "PG_BRANCH=$branch_name" >> $GITHUB_ENV
- name: "Set master branch name, if needed"
if: env.PG_MAJOR_VERSION == ''
run: |
branch_name="master"
echo "PG_BRANCH=$branch_name" >> $GITHUB_ENV
# Create workspace directory and environment variable.
# It is the second step because on the first we define versions and branches
- name: "Initial dir"
run: |
git clone -b $PG_BRANCH --depth=1 --single-branch https://github.com/postgres/postgres.git $GITHUB_WORKSPACE/../pg
# Invent variable with full path to PG directory just because github
# actions don't like relative paths ...
cd $GITHUB_WORKSPACE/../pg
echo PG_DIR=`pwd` >> $GITHUB_ENV
- name: "Prepare PG Env"
run: |
cd $PG_DIR
cp -r ../pg_index_stats contrib/pg_index_stats
echo "COPT=-Werror" >> $GITHUB_ENV
echo "CONFIGURE_OPTS=--prefix=`pwd`/tmp_install --enable-tap-tests --enable-cassert --with-zstd" >> $GITHUB_ENV
- name: "Compile Postgres"
run: |
cd $PG_DIR
./configure $CONFIGURE_OPTS > /dev/null
make -j4 > /dev/null
make install
# Now, we can enable PGXS to compile & install the extension
echo "USE_PGXS=1" >> $GITHUB_ENV
echo "$PG_DIR/tmp_install/bin:$PG_DIR/tmp_install/share:" >> $GITHUB_PATH
# Instance-related environment
echo "LD_LIBRARY_PATH=$PG_DIR/tmp_install/lib" >> $GITHUB_ENV
echo `pwd`/contrib/pg_index_stats/.github/scripts/ >> $GITHUB_PATH
# Just for debug
- name: "Environment (debug output)"
if: ${{ always() }}
run: |
echo "PG_MAJOR_VERSION: $PG_MAJOR_VERSION"
echo "PG_DIR: $PG_DIR"
echo "PG_BRANCH: $PG_BRANCH"
echo "USE_PGXS: $USE_PGXS"
echo "PATHS: $PATH"
export
ls -la $PG_DIR
ls -la $PG_DIR/contrib/pg_index_stats
ls -la /home/runner/work/pg_index_stats/pg/tmp_install/
- name: "Launch an instance"
run: |
cd $PG_DIR/contrib/pg_index_stats
make
make install
# Launch an instance with the extension
cd $PG_DIR
instance_launch.sh
- name: "Extension make installcheck"
run: |
cd $PG_DIR/contrib/pg_index_stats
pg_config
pg_config --pgxs
make installcheck
- name: Archive artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: make_check_logs
path: |
${{ env.PG_DIR }}/contrib/pg_index_stats/regression.diffs
${{ env.PG_DIR }}/contrib/pg_index_stats/log
${{ env.PG_DIR }}/contrib/pg_index_stats/tmp_check/log
retention-days: 7
- name: "whole make installcheck"
run: |
cd $PG_DIR/
# Zero limit shouldn't impact tests at all
psql -c "ALTER SYSTEM SET pg_index_stats.columns_limit = 0"
psql -c "SELECT pg_reload_conf()"
make installcheck