Skip to content

Commit

Permalink
Fix Django Tests runner (#2)
Browse files Browse the repository at this point in the history
* Move env inside job

* fix django.yaml

* Move env back to root

* Move requirements.txt inside source folder

* Add python version matrix and dependency install to django.yaml

* Rename Django workflow and job name

* Fix python matrix for 3.10 being recognized as 3.1

Ref: actions/setup-python#160

* Bump actions/setup-python to v5

* remove python 3.12 from matrix

as it will raise error on test:
AttributeError: 'ExampleTestCase' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?
  • Loading branch information
rahmatnazali authored Mar 1, 2024
1 parent 206e2c0 commit c9d3870
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/django.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Django tests
name: Django
on:
push:
branches: [ "main" ]
Expand All @@ -13,9 +13,13 @@ env:
POSTGRES_PORT: 5432

jobs:
django-tests:
test:
runs-on: ubuntu-latest
# container: python:3.11.6
strategy:
max-parallel: 4
matrix:
python-version: [ '3.10', '3.11' ]
defaults:
run:
working-directory: ./source
Expand All @@ -34,10 +38,21 @@ jobs:
--health-timeout 5s
--health-retries 5
ports:
- 5432:${{ env.POSTGRES_PORT }}
- 5432:5432
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Django Tests
run: python3 manage.py test --settings=starter.settings_test
run: |
python3 manage.py test --settings=starter.settings_test
File renamed without changes.

0 comments on commit c9d3870

Please sign in to comment.