diff --git a/tests_in_docker.yml b/tests_in_docker.yml index 99df5b5..d960c4f 100644 --- a/tests_in_docker.yml +++ b/tests_in_docker.yml @@ -1,30 +1,23 @@ -name: Test PostgreSQL Matrix with Python -run-name: ${{ github.actor }} is running the test schedules. +name: Test PostgreSQL in Docker + on: push: branches: - - GH_actions_test + - main jobs: test: runs-on: ubuntu-latest - strategy: - matrix: - pgver: [14, 15, 16, 17] # PostgreSQL versions to test + 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.pgver }} + image: postgres:${{ matrix.postgres-version }} ports: - - 6432:5432 - - 6433:5433 - - 6434:5434 - - 6435:5435 - - 6436:5436 - - 6437:5437 - - 6438:5438 - - 6439:5439 + - 5432:5432 env: POSTGRES_USER: lcusr POSTGRES_PASSWORD: password @@ -35,48 +28,44 @@ jobs: --health-timeout 5s --health-retries 5 - steps: - # Step 1: Checkout Code - - name: Checkout code - uses: actions/checkout@v4 - - # Step 2: Set up Python - - name: Set up Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: 3.10 + strategy: + matrix: + postgres-version: [14, 15, 16, 17] - # Step 3: Install Dependencies + steps: + # Step 1: Install Dependencies - name: Install Python Dependencies run: | - python -m pip install --upgrade pip + apt-get update + apt-get install -y build-essential + pip install --upgrade pip pip install psycopg psycopg2 - # Step 4: Verify PostgreSQL Connection + # Step 2: Verify PostgreSQL Connection - name: Verify PostgreSQL Connection run: | - echo "Testing connection to PostgreSQL (Version: ${{ matrix.pgver }})..." + echo "Testing connection to PostgreSQL (Version: ${{ matrix.postgres-version }})..." python -c " - import psycopg2 - conn = psycopg2.connect( - dbname='lcdb', - user='lcusr', - password='password', - host='localhost', - port=6432 - ) -print('Successfully connected to PostgreSQL version ${{ matrix.pgver }}!') +import psycopg2 +conn = psycopg2.connect( + dbname='lcdb', + user='lcusr', + password='password', + host='localhost', + port=5432 +) +print('Successfully connected to PostgreSQL version ${{ matrix.postgres-version }}!') conn.close() " - # Step 5: Run Test Harness + # Step 3: Run Test Harness - name: Run Test Harness (runner.py) run: | - python runner.py -c test/t/lib/${{ matrix.pgver }}config.env -s test/schedule_files/script_file -k + python runner.py - # Step 6: Publish Test Logs to Artifacts + # Step 4: Publish Test Logs - name: Upload Test Log uses: actions/upload-artifact@v3 with: - name: latest-test-log-${{ matrix.pgver }} + name: latest-test-log-${{ matrix.postgres-version }} path: latest.log