Update several user-facing views, use Alpine-based Dockerfile, bump dependencies, bump project dependencies. #173
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
name: "Run unit tests" | |
on: | |
push: | |
branches: [master, dev] | |
pull_request: | |
branches: [master] | |
jobs: | |
run_tests: | |
name: Run Django Tests | |
runs-on: ubuntu-latest | |
env: | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres | |
services: | |
db: | |
image: postgres:15-alpine | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
#---------------------------------------------- | |
# Checkout repo and set up Python | |
#---------------------------------------------- | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: "3.12" | |
#---------------------------------------------- | |
# Install & configure Poetry | |
#---------------------------------------------- | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
#---------------------------------------------- | |
# Load cached venv if cache exists | |
#---------------------------------------------- | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
#---------------------------------------------- | |
# Install project dependencies if cache does not exist | |
#---------------------------------------------- | |
- name: Install project dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
#---------------------------------------------- | |
# Run unit tests | |
#---------------------------------------------- | |
- name: Run tests | |
run: | | |
source .venv/bin/activate | |
python manage.py collectstatic | |
python manage.py test |