Skip to content

pct960 is running the test schedules. #86

pct960 is running the test schedules.

pct960 is running the test schedules. #86

name: Run Python Schedules
run-name: ${{ github.actor }} is running the test schedules.
on:
push:
branches:
#- main
- GH_actions_test
jobs:
run-scripts:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
pgver: [14, 15, 16, 17]
runs-on: ${{ matrix.os }}
steps:
# Checkout the repository
- 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
# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
# Install pip dependencies
- name: Install pip dependencies
run: |
python -m pip install --upgrade pip
python -m pip install psycopg2-binary
# Update authentication for the tests
- name: Update pg_hba.conf
run: |
sudo sed -i "s/peer/trust/g" /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf
sudo sed -i "s/scram-sha-256/trust/g" /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf
echo "s/peer/trust/g" /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf"
sudo sed -i "s/md5/trust/g" /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf
echo "s/md5/trust/g" /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf"
echo "host all postgres 0.0.0.0/0 peer" | sudo tee -a /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf
echo "host all all 0.0.0.0/0 trust" | sudo tee -a /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf
sudo service postgresql restart
sudo cat /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf
echo "This is who I am: ${{ github.actor }}"
echo "This is where I am: $(pwd)"
# Run the tests here
- name: Run the test schedule
run: |
echo "This is where I am: $(pwd)"
echo "This is who I am: ${{ github.actor }}"
echo "Testing PostgreSQL Version ${{ matrix.pgver }}"
sudo chown postgres:postgres ~/work/snowflake/snowflake
python test/runner.py -c test/t/lib/${{ matrix.pgver }}config.env -s test/schedule_files/script_file -k
cp latest.log ${{ matrix.pgver }}latest.log
# Upload log file as artifact of run
- name: Upload Log File as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.pgver }}latest-log
path: ${{ matrix.pgver }}latest.log
# Verify output (GitHub Actions should fail the job if any script raises an error)
- name: Verify success
if: success()
run: echo "All scripts executed successfully. Pull request can be merged."