Update tests_in_docker.yml #9
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 PostgreSQL Matrix | ||
run-name: ${{ github.actor }} is running the test schedules. | ||
on: | ||
push: | ||
branches: | ||
- GH_actions_test | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: python:3.10 # Use a Python Docker image for the job | ||
options: --network host # Use host networking to allow PostgreSQL access | ||
services: | ||
postgres: | ||
image: postgres:${{ matrix.postgres-version }} | ||
ports: | ||
- 6432:5432 | ||
- 6433:5433 | ||
- 6434:5434 | ||
- 6435:5435 | ||
- 6436:5436 | ||
- 6437:5437 | ||
- 6438:5438 | ||
- 6439:5439 | ||
env: | ||
POSTGRES_USER: lcusr | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: lcdb | ||
options: >- | ||
--health-cmd "pg_isready -U lcusr -d lcdb" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
strategy: | ||
matrix: | ||
pgver: [14, 15, 16, 17] # PostgreSQL versions | ||
os: [ubuntu-22.04] | ||
services: | ||
postgres: | ||
image: postgres:${{ matrix.pgver }} | ||
ports: | ||
- 6432:5432 | ||
- 6433:5433 | ||
- 6434:5434 | ||
- 6435:5435 | ||
- 6436:5436 | ||
- 6437:5437 | ||
- 6438:5438 | ||
- 6439:5439 | ||
env: | ||
POSTGRES_USER: lcusr | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: lcdb | ||
options: >- | ||
--health-cmd "pg_isready -U lcusr -d lcdb" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- name: Checkout snowflake | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.ref }} | ||
- name: Add permissions | ||
run: | | ||
echo "adding permissions" | ||
sudo chmod -R a+w ~/work/snowflake/snowflake | ||
- name: Setup the PGDG APT repo on Linux | ||
if: ${{ matrix.os == 'ubuntu-22.04' }} | ||
run: | | ||
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | ||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | ||
- name: Install PostgreSQL ${{ matrix.pgver }} and its dependencies | ||
run: | | ||
sudo apt -y update | ||
sudo apt install -y postgresql-${{ matrix.pgver }} \ | ||
postgresql-server-dev-${{ matrix.pgver }} \ | ||
postgresql-client-${{ matrix.pgver }} \ | ||
autoconf \ | ||
automake \ | ||
libgeos-dev \ | ||
libproj-dev \ | ||
libgdal-dev \ | ||
libjson-c-dev \ | ||
gettext \ | ||
libxml2-dev \ | ||
libprotobuf-c-dev \ | ||
libprotoc-dev \ | ||
protobuf-c-compiler \ | ||
g++ \ | ||
libpq-dev \ | ||
python3-dev \ | ||
build-essential \ | ||
python3-psycopg2 \ | ||
python3-dotenv | ||
# Start Postgres | ||
- name: start PostgreSQL ${{ matrix.pgver }} | ||
run: | | ||
sudo systemctl start postgresql.service | ||
sudo systemctl status postgresql.service | ||
sudo pg_isready | ||
sudo -u postgres createuser -s -w -e lcusr | ||
sudo -u postgres psql -U postgres -c '\du' | ||
ls -l /usr/lib/postgresql/${{matrix.pgver}}/bin | ||
- name: Build Snowflake | ||
run: | | ||
USE_PGXS=1 make | ||
sudo USE_PGXS=1 make install | ||
# Run Test Harness | ||
- name: Run Test Harness (runner.py) | ||
run: | | ||
python test/runner.py -c test/t/lib/${{ matrix.pgver }}config.env -s test/schedule_files/script_file -k | ||
# Publish Test Logs to Artifacts | ||
- name: Upload Test Log | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.pgver }}latest-log | ||
path: ${{ matrix.pgver }}latest.log |