-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a9bab6
commit eb193ea
Showing
1 changed file
with
115 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: Django Test Suite | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
postgres: | ||
image: postgres:13 | ||
ports: | ||
- 5432:5432 | ||
env: | ||
POSTGRES_DB: pguser | ||
POSTGRES_USER: pguser | ||
POSTGRES_PASSWORD: foobar | ||
options: >- | ||
--health-cmd "pg_isready -U pguser" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
redis: | ||
image: redis:latest | ||
ports: | ||
- 6379:6379 | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
env: | ||
DATABASE_NAME: pguser | ||
DATABASE_USER: pguser | ||
DATABASE_PASSWORD: foobar | ||
DATABASE_HOST: 127.0.0.1 | ||
DATABASE_PORT: 5432 | ||
REDIS_URL: redis://127.0.0.1:6379/0 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
django-version: ["3.2", "4.0", "4.1", "4.2", "5.0"] | ||
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | ||
exclude: | ||
# Exclusions for Django 3.2 | ||
- python-version: "3.11" | ||
django-version: "3.2" | ||
- python-version: "3.12" | ||
django-version: "3.2" | ||
# Exclusions for Django 4.0 | ||
- python-version: "3.6" | ||
django-version: "4.0" | ||
- python-version: "3.7" | ||
django-version: "4.0" | ||
- python-version: "3.11" | ||
django-version: "4.0" | ||
- python-version: "3.12" | ||
django-version: "4.0" | ||
# Exclusions for Django 4.1 | ||
- python-version: "3.6" | ||
django-version: "4.1" | ||
- python-version: "3.7" | ||
django-version: "4.1" | ||
# Exclusions for Django 4.2 | ||
- python-version: "3.6" | ||
django-version: "4.2" | ||
- python-version: "3.7" | ||
django-version: "4.2" | ||
# Exclusions for Django 5.0 | ||
- python-version: "3.6" | ||
django-version: "5.0" | ||
- python-version: "3.7" | ||
django-version: "5.0" | ||
- python-version: "3.8" | ||
django-version: "5.0" | ||
- python-version: "3.9" | ||
django-version: "5.0" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install django==${{ matrix.django-version }} | ||
pip install -r requirements.txt | ||
pip install psycopg2-binary | ||
- name: Run migrations | ||
run: | | ||
python manage.py migrate | ||
- name: Run tests | ||
run: | | ||
python manage.py test | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true |