Add PG17 to docker workflows #156
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: Smoke Test Docker Image | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
env: | |
ORG: timescaledev | |
TS_VERSION: main | |
PLATFORM: linux/amd64 | |
jobs: | |
smoketest: | |
name: PG${{ matrix.pg }}-${{ matrix.type }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
pg: [14, 15, 16, 17] | |
type: ['normal', 'repmgr-bitnami', 'bitnami'] | |
steps: | |
- name: Check out the source | |
uses: actions/checkout@v4 | |
- name: Build Docker Image for TimescaleDB | |
run: | | |
if [ ${{ matrix.type }} == bitnami ] | |
then | |
cd bitnami | |
make image PG_BASE_IMAGE=postgresql PG_VER=pg${{ matrix.pg }} TAG_VERSION=smoketest-image BETA=1 | |
elif [ ${{ matrix.type }} == repmgr-bitnami ] | |
then | |
cd bitnami | |
make image PG_BASE_IMAGE=postgresql-repmgr PG_VER=pg${{ matrix.pg }} TAG_VERSION=smoketest-image BETA=1 | |
else | |
make image PG_VER=pg${{ matrix.pg }} TAG_VERSION=smoketest-image BETA=1 | |
fi | |
- name: Install psql | |
run: sudo apt install postgresql-client | |
- name: Run the smoke test | |
run: | | |
set -eu | |
export PGHOST=localhost | |
export PGUSER=postgres | |
export PGPASSWORD=test1234 | |
docker container stop smoketest-container || true | |
docker container rm smoketest-container || true | |
docker run -d -p 5432:5432 \ | |
-e POSTGRES_PASSWORD=${PGPASSWORD} \ | |
-e REPMGR_PASSWORD=${PGPASSWORD} \ | |
-e REPMGR_PRIMARY_HOST=localhost \ | |
-e REPMGR_PRIMARY_PORT=5432 \ | |
-e REPMGR_PARTNER_NODES=pg-0,pg-1 \ | |
-e REPMGR_NODE_NAME=pg-0 \ | |
-e REPMGR_NODE_NETWORK_NAME=localhost \ | |
-e REPMGR_PORT_NUMBER=5432 \ | |
--name smoketest-container smoketest-image | |
for _ in {1..120} | |
do | |
if [ -z "$(docker container ls -q --filter name=smoketest-container)" ] | |
then | |
echo "Smoketest container is not running" | |
exit 1 | |
fi | |
if psql -c "select 1" | |
then | |
break | |
fi | |
sleep 1 | |
done | |
if ! psql -c "select 1" | |
then | |
echo "Cannot connect to PostgreSQL" | |
exit 1 | |
fi | |
- name: Show the logs | |
if: always() | |
run: | | |
docker logs smoketest-container |