forked from django-guardian/django-guardian
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (89 loc) · 3.44 KB
/
tests.yml
File metadata and controls
102 lines (89 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
name: Tests
permissions:
contents: read
on:
push:
pull_request:
jobs:
tests:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
database-engine: ['sqlite', 'mariadb', 'postgres']
services:
mariadb:
image: mariadb:11.4.2
env:
MYSQL_ROOT_PASSWORD: mariadb
ports:
- 3306:3306
postgres:
image: postgres:16-alpine
env:
PGUSER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
DJANGO_SETTINGS_MODULE: tests.server.settings
DATABASE_ENGINE: ${{ matrix.database-engine }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install tox
# See: https://github.com/tox-dev/tox-gh
run: uv tool install --python-preference only-managed --python 3.13 tox --with . --with tox-uv --with tox-gh
- name: Install Python
# Skip if the python version is already installed to run tox
if: matrix.python-version != '3.13'
run: uv python install --python-preference only-managed ${{ matrix.python-version }}
- name: Setup test suite
run: tox run -vv --notest --skip-missing-interpreters false
env:
TOX_GH_MAJOR_MINOR: ${{ matrix.python-version }}
- name: Create databases
run: |
PGPASSWORD="postgres" psql -c 'create database django_guardian;' -h localhost -U postgres;
PGPASSWORD="postgres" psql -c 'create database test_django_guardian;' -h localhost -U postgres;
mysql --host=127.0.0.1 --user=root --password=mariadb -e 'CREATE DATABASE django_guardian;';
mysql --host=127.0.0.1 --user=root --password=mariadb -e 'CREATE DATABASE test_django_guardian;';
- name: Test with PostgreSQL
if: matrix.database-engine == 'postgres'
env:
TOX_GH_MAJOR_MINOR: ${{ matrix.python-version }}
DATABASE_URL: postgres://postgres:postgres@localhost/django_guardian
PYTEST_ADDOPTS: "-vv --durations=20"
DIFF_AGAINST: HEAD
UV_PYTHON_PREFERENCE: "only-managed"
run: tox run -vv --skip-pkg-install
- name: Test with MariaDB
if: matrix.database-engine == 'mariadb'
env:
TOX_GH_MAJOR_MINOR: ${{ matrix.python-version }}
DATABASE_URL: mysql://root:mariadb@127.0.0.1:3306/django_guardian
PYTEST_ADDOPTS: "-vv --durations=20"
DIFF_AGAINST: HEAD
UV_PYTHON_PREFERENCE: "only-managed"
run: tox run -vv --skip-pkg-install
- name: Test with SQLite
if: matrix.database-engine == 'sqlite'
env:
TOX_GH_MAJOR_MINOR: ${{ matrix.python-version }}
DATABASE_URL: sqlite://
PYTEST_ADDOPTS: "-vv --durations=20"
DIFF_AGAINST: HEAD
UV_PYTHON_PREFERENCE: "only-managed"
run: tox run -vv --skip-pkg-install