-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #703 from drnlm/feature/rework_ci_yaml
Refactor into main workflow and reusable workflow for the tests
- Loading branch information
Showing
2 changed files
with
96 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Run tests against postgres and sqlite | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
python-version: | ||
required: true | ||
type: string | ||
django-version: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
run-postgres-tests: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
# Set health checks to wait until postgres has started | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
# Maps tcp port 5432 on service container to the host | ||
- 5432:5432 | ||
|
||
name: Postgres - Python ${{ inputs.python-version }}, Django ${{ inputs.django-version }} (Allowed Failures - ${{ inputs.django-version == 'main' }} ) | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
- name: Install Dependencies | ||
continue-on-error: ${{ inputs.django-version == 'main' }} | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt -r requirements-dev.txt | ||
- name: 'Install psycopg2' | ||
run: | | ||
pip install psycopg2 | ||
- name: Install Django Release | ||
run: | | ||
pip install django~=${{ inputs.django-version }} | ||
if: inputs.django-version != 'main' | ||
- name: Install Django Main | ||
continue-on-error: ${{ inputs.django-version == 'main' }} | ||
run: | | ||
pip install 'https://github.com/django/django/archive/main.tar.gz' | ||
if: inputs.django-version == 'main' | ||
- name: Run Tests | ||
continue-on-error: ${{ inputs.django-version == 'main' }} | ||
env: | ||
TESTDB: postgres | ||
run: | | ||
export PYTHONWARNINGS=always | ||
coverage run --source='wafer' manage.py test --exclude-tag selenium && coverage report --skip-covered | ||
run-sqlite-tests: | ||
runs-on: ubuntu-latest | ||
name: SQLite - Python ${{ inputs.python-version }}, Django ${{ inputs.django-version }} (Allowed Failures - ${{ inputs.django-version == 'main'}} ) | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
- name: Install Dependencies | ||
continue-on-error: ${{ inputs.django-version == 'main' }} | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt -r requirements-dev.txt | ||
- name: Install Django Release | ||
run: | | ||
pip install django~=${{ inputs.django-version }} | ||
if: inputs.django-version != 'main' | ||
- name: Install Django Main | ||
continue-on-error: ${{ inputs.django-version == 'main' }} | ||
run: | | ||
pip install 'https://github.com/django/django/archive/main.tar.gz' | ||
if: inputs.django-version == 'main' | ||
- name: Run Tests | ||
continue-on-error: ${{ inputs.django-version == 'main' }} | ||
run: | | ||
export PYTHONWARNINGS=always | ||
coverage run --source='wafer' manage.py test --exclude-tag selenium && coverage report --skip-covered |