Skip to content

Commit

Permalink
➕ added postgres service to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dsaad68 committed Oct 20, 2023
1 parent 8197df5 commit d66e9e4
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,27 @@ jobs:
matrix:
python-version: ['3.10', '3.11']

# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:alpine3.18
# Provide the password for postgres
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: another!!22TEST
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -30,7 +51,6 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run tests with pytest
run: |
docker run --name some-postgres -e POSTGRES_PASSWORD="another!!22TEST" -e POSTGRES_USER="postgres" -e POSTGRES_DB="postgres" -p 5432:5432 postgres:alpine3.18
pytest
- name: Run ruff
uses: chartboost/ruff-action@v1

0 comments on commit d66e9e4

Please sign in to comment.