Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 44 additions & 37 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ on:
branches: [ "main" ]
workflow_dispatch:
inputs:
test_filter:
test_filter:
description: "Pytest filter (e.g. -m smoke, -k auth)"
default: "-m required"
required: false


permissions:
contents: read

Expand All @@ -24,71 +23,79 @@ env:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12.3"
python-version: "3.12"

- name: Install dependencies
working-directory: ./backend
run: |
python -m pip install --upgrade pip
pip install flake8 djangorestframework psycopg2-binary pytest-django
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
pip install -r requirements.txt
pip install pytest-django

- name: Lint with ruff
working-directory: ./backend
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
ruff check .
ruff format --check .

- name: Create test settings.py
working-directory: ./backend
run: |
cp backend/settings_template.txt backend/settings.py
# use sed to use SQLite for testing
sed -i "s/'ENGINE': 'django.db.backends.postgresql'/'ENGINE': 'django.db.backends.sqlite3'/g" backend/settings.py
sed -i "s/'NAME': 'your_database_name'/'NAME': ':memory:'/g" backend/settings.py
- name: Make and run migrations
cp settings_template.txt settings.py
sed -i "s/'ENGINE': 'django.db.backends.postgresql'/'ENGINE': 'django.db.backends.sqlite3'/g" settings.py
sed -i "s/'NAME': 'your_database_name'/'NAME': ':memory:'/g" settings.py

- name: Run migrations
run: |
python manage.py makemigrations
python manage.py migrate

- name: Test with pytest
run: |
pytest ${{ env.REQUIRED_TESTS }}

build-addtl:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12.3"
python-version: "3.12"

- name: Install dependencies
working-directory: ./backend
run: |
python -m pip install --upgrade pip
pip install flake8 djangorestframework psycopg2-binary pytest-django
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
pip install -r requirements.txt
pip install pytest-django

- name: Lint with ruff
working-directory: ./backend
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
ruff check .
ruff format --check .

- name: Create test settings.py
working-directory: ./backend
run: |
cp backend/settings_template.txt backend/settings.py
# use sed to use SQLite for testing
sed -i "s/'ENGINE': 'django.db.backends.postgresql'/'ENGINE': 'django.db.backends.sqlite3'/g" backend/settings.py
sed -i "s/'NAME': 'your_database_name'/'NAME': ':memory:'/g" backend/settings.py
- name: Make and run migrations
cp settings_template.txt settings.py
sed -i "s/'ENGINE': 'django.db.backends.postgresql'/'ENGINE': 'django.db.backends.sqlite3'/g" settings.py
sed -i "s/'NAME': 'your_database_name'/'NAME': ':memory:'/g" settings.py

- name: Run migrations
run: |
python manage.py makemigrations
python manage.py migrate

- name: Test with pytest
run: |
pytest
pytest
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Python environment
env/
.venv/
__pycache__/
backend/__pycache/*
uv.lock

# personal settings
backend/settings.py
Expand All @@ -15,3 +17,11 @@ backend/quickstart/migrations/*

# MacOS
.DS_Store

# postman
.postman/
postman/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW I'm planning on using Insomnia instead of Postman right now

@anthisse anthisse Jun 16, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine, but there's no harm in having Postman gitignore stuff here for right now. Once you set up Insomnia add it to the .gitignore


# IDE settings
.vscode/
.idea/
Loading
Loading