Skip to content

Commit 5b7c796

Browse files
committed
created the CI env
1 parent 0c2c3a2 commit 5b7c796

File tree

7 files changed

+214
-1
lines changed

7 files changed

+214
-1
lines changed

.github/workflows/black.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: black
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: psf/black@stable
11+
with:
12+
options: "--check --verbose"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import os
2+
from test_sqlite import * # NOQA
3+
4+
DATABASES = {
5+
"default": {
6+
"ENGINE": "django.db.backends.postgresql",
7+
"USER": "user",
8+
"NAME": "django",
9+
"PASSWORD": "postgres",
10+
"HOST": "localhost",
11+
"PORT": 5432,
12+
"OPTIONS": {
13+
"server_side_binding": os.getenv("SERVER_SIDE_BINDING") == "1",
14+
},
15+
},
16+
"other": {
17+
"ENGINE": "django.db.backends.postgresql",
18+
"USER": "user",
19+
"NAME": "django2",
20+
"PASSWORD": "postgres",
21+
"HOST": "localhost",
22+
"PORT": 5432,
23+
},
24+
}

.github/workflows/python_matrix.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Python Matrix from config file
2+
3+
on:
4+
pull_request:
5+
types: [labeled, synchronize, opened, reopened]
6+
paths-ignore:
7+
- 'docs/**'
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
define-matrix:
19+
if: contains(github.event.pull_request.labels.*.name, 'python-matrix')
20+
runs-on: ubuntu-latest
21+
outputs:
22+
python_versions_output: ${{ steps.set-matrix.outputs.python_versions }}
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
- id: set-matrix
27+
run: |
28+
python_versions=$(sed -n "s/^.*Programming Language :: Python :: \([[:digit:]]\+\.[[:digit:]]\+\).*$/'\1', /p" pyproject.toml | tr -d '\n' | sed 's/, $//g')
29+
echo "Supported Python versions: $python_versions"
30+
echo "python_versions=[$python_versions]" >> "$GITHUB_OUTPUT"
31+
python:
32+
runs-on: ubuntu-latest
33+
needs: define-matrix
34+
strategy:
35+
matrix:
36+
python-version: ${{ fromJson(needs.define-matrix.outputs.python_versions_output) }}
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
- name: Set up Python ${{ matrix.python-version }}
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: ${{ matrix.python-version }}
44+
- name: Install poetry
45+
uses: abatilo/actions-poetry@v3
46+
- name: Install and upgrade packaging tools
47+
run: poetry install --no-interaction --all-extras --with dev
48+
- name: Run tests
49+
run: poetry run python -Wall tests/runtests.py -v2

.github/workflows/ruff.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: ruff
2+
on: [push, pull_request]
3+
jobs:
4+
ruff:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: astral-sh/ruff-action@v3

.github/workflows/schedule_tests.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Schedule tests
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
windows:
15+
runs-on: windows-latest
16+
strategy:
17+
matrix:
18+
python-version:
19+
- '3.12'
20+
- '3.13'
21+
- '3.14-dev'
22+
name: Windows, SQLite, Python ${{ matrix.python-version }}
23+
continue-on-error: true
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Install poetry
32+
uses: abatilo/actions-poetry@v3
33+
34+
- name: Install and upgrade packaging tools
35+
run: poetry install --no-interaction --all-extras --with dev
36+
- name: Run tests
37+
run: poetry run python -Wall tests/runtests.py -v2
38+
39+
postgresql:
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
version: [16, 17]
44+
server_side_bindings: [0, 1]
45+
runs-on: ubuntu-latest
46+
name: PostgreSQL Versions
47+
env:
48+
SERVER_SIDE_BINDING: ${{ matrix.server_side_bindings }}
49+
services:
50+
postgres:
51+
image: postgres:${{ matrix.version }}-alpine
52+
env:
53+
POSTGRES_DB: django
54+
POSTGRES_USER: user
55+
POSTGRES_PASSWORD: postgres
56+
ports:
57+
- 5432:5432
58+
options: >-
59+
--health-cmd pg_isready
60+
--health-interval 10s
61+
--health-timeout 5s
62+
--health-retries 5
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
- name: Set up Python
67+
uses: actions/setup-python@v5
68+
with:
69+
python-version: '3.13'
70+
- name: Install poetry
71+
uses: abatilo/actions-poetry@v3
72+
- name: Install and upgrade packaging tools
73+
run: poetry install --no-interaction --all-extras --with dev
74+
- name: Create PostgreSQL settings file
75+
run: mv ./.github/workflows/data/test_postgres.py.tpl ./tests/test_postgres.py
76+
- name: Run tests
77+
working-directory: ./tests/
78+
run: poetry python -Wall runtests.py --settings=test_postgres --verbosity=2

.github/workflows/tests.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- 'docs/**'
7+
push:
8+
branches:
9+
- main
10+
paths-ignore:
11+
- 'docs/**'
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
windows:
22+
runs-on: windows-latest
23+
strategy:
24+
matrix:
25+
python-version:
26+
- '3.13'
27+
name: Windows, SQLite, Python ${{ matrix.python-version }}
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
- name: Install poetry
36+
uses: abatilo/actions-poetry@v3
37+
- name: Install packaging tools
38+
run: poetry install --no-interaction --all-extras --with dev
39+
- name: Run tests
40+
run: poetry run python -Wall tests/runtests.py -v2
41+

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = {text = "MIT"}
99
readme = "README.md"
1010
requires-python = ">=3.10"
1111
dependencies = [
12-
"django >= 4.2"
12+
"django >= 4.2",
1313
]
1414

1515

@@ -26,6 +26,7 @@ pytest-asyncio = "^0.25.3"
2626
pytest-django = "^4.9.0"
2727
pytest-subtests = "^0.14.1"
2828
pytest-mock = "^3.14.0"
29+
psycopg = {extras = ["binary", "pool"], version = "^3.2.4"}
2930

3031
[tool.ruff.lint]
3132
select = ["T201", "E", "F", "S", "DJ"]

0 commit comments

Comments
 (0)