mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-11-13 12:23:44 +01:00
Import uploads were always written to /usr/src/app/temp, presets were read from /usr/src/app/import_presets and the caches lived in /var/tmp, so WYGIWYH only worked from the Docker image's layout. Running it as a systemd service with a strict sandbox, or on an immutable distro like NixOS, needs these folders to follow the app or be configurable. - Presets are read from IMPORT_PRESETS_ROOT, the import_presets folder next to the app. - Uploads wait in IMPORT_TEMP_ROOT, the temp folder next to the app by default, and movable with the IMPORT_TEMP_ROOT env var. The web views, the API and the import service all use it. - The file-based caches live under CACHE_ROOT, /var/tmp by default, and movable with the CACHE_ROOT env var. In the Docker image the app sits in /usr/src/app, so every default resolves to the same folder as before. The import service checked that a file was inside the temp folder with a plain string prefix, which also accepted sibling folders such as /usr/src/app/temp-other. It now compares paths. CI no longer needs to create /usr/src/app before running the tests. Fixes #472
74 lines
1.8 KiB
YAML
74 lines
1.8 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [ main ]
|
|
workflow_dispatch:
|
|
|
|
# Cancel superseded runs on the same PR/branch
|
|
concurrency:
|
|
group: tests-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
django-tests:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
services:
|
|
db:
|
|
image: postgres:15
|
|
env:
|
|
POSTGRES_USER: wygiwyh
|
|
POSTGRES_PASSWORD: wygiwyh
|
|
POSTGRES_DB: wygiwyh
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U wygiwyh"
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
|
|
env:
|
|
SECRET_KEY: ci-only-not-secret
|
|
SQL_DATABASE: wygiwyh
|
|
SQL_USER: wygiwyh
|
|
SQL_PASSWORD: wygiwyh
|
|
SQL_HOST: localhost
|
|
SQL_PORT: 5432
|
|
# Emit dev-server script tags instead of reading the Vite manifest,
|
|
# so the frontend doesn't need to be built to render templates
|
|
DJANGO_VITE_DEV_MODE: "true"
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
enable-cache: true
|
|
|
|
- name: Set up Python 3.14
|
|
run: uv python install 3.14
|
|
|
|
- name: Install dependencies
|
|
run: uv sync --frozen
|
|
|
|
- name: Check for missing migrations
|
|
working-directory: app
|
|
run: uv run python manage.py makemigrations --check --dry-run
|
|
|
|
- name: Run tests
|
|
working-directory: app
|
|
env:
|
|
# Some tests point STATIC_ROOT at the temp dir; the runner's /tmp
|
|
# holds root-only systemd dirs that WhiteNoise can't scan
|
|
TMPDIR: ${{ runner.temp }}
|
|
run: uv run python manage.py test --parallel auto --noinput
|