Skip to content

Commit

Permalink
Update CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
hugorodgerbrown committed Sep 19, 2023
1 parent 91806b7 commit 6c05352
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 43 deletions.
72 changes: 37 additions & 35 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
tox
test:
name: Run tests (SQLite)
name: Run tests
runs-on: ubuntu-latest

strategy:
Expand All @@ -58,37 +58,39 @@ jobs:
pip install tox
tox
test-pg:
name: Run tests (PostgreSQL)
runs-on: ubuntu-latest

services:
postgres:
image: postgres
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
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
env:
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres

steps:
- name: Check out the repository
uses: actions/checkout@v3

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install tox
run: pip install tox

- name: Run tox (pg-only)
run: tox -e pg-only
# HRB: no longer required (SQLite supports UUID generation), but keeping
# around for future self.
# test-pg:
# name: Run tests (PostgreSQL)
# runs-on: ubuntu-latest

# services:
# postgres:
# image: postgres
# env:
# POSTGRES_DB: postgres
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
# 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

# env:
# DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres

# steps:
# - name: Check out the repository
# uses: actions/checkout@v3

# - name: Set up Python 3.11
# uses: actions/setup-python@v4
# with:
# python-version: "3.11"

# - name: Install tox
# run: pip install tox

# - name: Run tox (pg-only)
# run: tox -e pg-only
9 changes: 1 addition & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ envlist =
[testenv]
deps =
coverage
dj_database_url
pytest
pytest-cov
pytest-django
Expand All @@ -22,14 +23,6 @@ deps =
commands =
pytest --cov=anonymiser --verbose --ds={env:DJANGO_SETTINGS_MODULE} tests/

[testenv:pg-only]
deps =
dj_database_url
pytest
pytest-django
psycopg2-binary
django

commands =
pytest --verbose -s --ds=tests.settings_postgres tests/

Expand Down

0 comments on commit 6c05352

Please sign in to comment.