forked from CGM_Public/pretix_original
85 lines
2.5 KiB
YAML
85 lines
2.5 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
paths-ignore:
|
|
- 'doc/**'
|
|
pull_request:
|
|
branches: [ master ]
|
|
paths-ignore:
|
|
- 'doc/**'
|
|
- 'src/pretix/locale/**'
|
|
|
|
permissions:
|
|
contents: read # to fetch code (actions/checkout)
|
|
|
|
env:
|
|
FORCE_COLOR: 1
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-22.04
|
|
name: Tests
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.9", "3.10", "3.11"]
|
|
database: [sqlite, postgres]
|
|
exclude:
|
|
- database: sqlite
|
|
python-version: "3.9"
|
|
- database: sqlite
|
|
python-version: "3.10"
|
|
services:
|
|
postgres:
|
|
image: postgres:15
|
|
env:
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: pretix
|
|
options: >-
|
|
--health-cmd "pg_isready -U postgres -d pretix"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 5432:5432
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
- name: Install system dependencies
|
|
run: sudo apt update && sudo apt install -y gettext
|
|
- name: Install Python dependencies
|
|
run: pip3 install uv && uv pip install --system -e ".[dev]" psycopg2-binary
|
|
- name: Run checks
|
|
run: python manage.py check
|
|
working-directory: ./src
|
|
- name: Install JS dependencies
|
|
working-directory: ./src
|
|
run: make npminstall
|
|
- name: Compile
|
|
working-directory: ./src
|
|
run: make all compress
|
|
- name: Run tests
|
|
working-directory: ./src
|
|
run: PRETIX_CONFIG_FILE=tests/ci_${{ matrix.database }}.cfg py.test -n 3 -p no:sugar --cov=./ --cov-report=xml tests --maxfail=100
|
|
- name: Run concurrency tests
|
|
working-directory: ./src
|
|
run: PRETIX_CONFIG_FILE=tests/ci_${{ matrix.database }}.cfg py.test tests/concurrency_tests/ --reuse-db
|
|
if: matrix.database == 'postgres'
|
|
- name: Upload coverage
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
file: src/coverage.xml
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
fail_ci_if_error: false
|
|
if: matrix.database == 'postgres' && matrix.python-version == '3.11'
|