Skip to content

Commit

Permalink
Add postgres service
Browse files Browse the repository at this point in the history
  • Loading branch information
mawandm committed Apr 4, 2024
1 parent 60f004d commit 697f35c
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@ on:
# - "nesis/api/core/requirements*"

jobs:
services:
postgres:
image: ametnes/postgresql:16-debian-12
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: nesis
ports:
- 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
memcached:
image: bitnami/memcached:1.6.19
ports:
- 11211:11211
format:
runs-on: ubuntu-latest
name: Check API code format
Expand All @@ -25,7 +44,6 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'poetry'
test:
runs-on: ubuntu-latest
name: Test API
Expand All @@ -44,5 +62,10 @@ jobs:
python -m pip install --upgrade pip
pip install -r nesis/api/requirements.txt -r nesis/api/requirements-test.txt
- name: Run unit tests
env:
NESIS_API_DATABASE_URL: "postgresql://postgres:password@postgres:5432/nesis"
NESIS_ADMIN_EMAIL: "[email protected]"
NESIS_ADMIN_PASSWORD: "password"
NESIS_MEMCACHE_HOSTS: memcached:11211
run: |
pytest nesis/api/tests/

0 comments on commit 697f35c

Please sign in to comment.