Skip to content

Update SpeakerVoucher to a generic voucher system #2300

Update SpeakerVoucher to a generic voucher system

Update SpeakerVoucher to a generic voucher system #2300

Workflow file for this run

name: Backend tests
on:
push:
branches:
- main
pull_request:
paths:
- "backend/**/*"
- "backend/*"
- ".github/workflows/backend-test.yml"
jobs:
unit-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
services:
postgres:
image: postgres:14.5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432/tcp
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:7.2.3
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11.6"
- run: pip install pdm==2.10.4 codecov
- name: Cache PDM
uses: actions/cache@v4
id: cache-deps
with:
path: backend/.venv
key: pdm-${{ hashFiles('**/pdm.lock') }}-1
- name: Install python dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: pdm install
- name: pytest
run: |
set +e
CPUS=$(nproc --all)
OUTPUT=$(pdm run pytest --cov-report xml --cov=. --cov-fail-under 80 --durations 10 -n $CPUS)
STATUS=$?
echo "$OUTPUT"
cd ..
codecov
exit $STATUS
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:${{ job.services.postgres.ports['5432'] }}/postgres
CACHE_URL: redis://localhost:6379/0
CELERY_BROKER_URL: redis://redis:6379/1
CELERY_RESULT_BACKEND: redis://redis:6379/2
STRIPE_SECRET_API_KEY: fake-key
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
MEDIA_FILES_STORAGE_BACKEND: django.core.files.storage.FileSystemStorage
STRIPE_SUBSCRIPTION_PRICE_ID: ""
STRIPE_WEBHOOK_SIGNATURE_SECRET: ""