-
-
Notifications
You must be signed in to change notification settings - Fork 100
72 lines (62 loc) · 1.79 KB
/
pytest.yml
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
name: Run Pytest
on:
pull_request:
paths:
- "backend/**"
push:
branches:
- "master"
paths:
- "backend/**"
permissions: read-all
jobs:
pytest:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
services:
mariadb:
image: mariadb:10.11
ports:
- 3306
env:
MYSQL_USER: romm_test
MYSQL_PASSWORD: passwd
MYSQL_DATABASE: romm_test
MYSQL_ROOT_PASSWORD: passwd
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install mariadb connectors
run: |
sudo apt-get update
sudo apt-get install -y libmariadb3 libmariadb-dev
- name: Install poetry
run: |
pipx install poetry
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: "poetry"
- name: Install dependencies
run: |
poetry install --sync
- name: Initiate database
run: |
mysql --host 127.0.0.1 --port ${{ job.services.mariadb.ports['3306'] }} -uroot -ppasswd -e "GRANT ALL PRIVILEGES ON romm_test.* TO 'romm_test'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;"
- name: Run python tests
env:
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mariadb.ports['3306'] }}
run: |
cd backend
poetry run pytest -vv --maxfail=10 --junitxml=pytest-report.xml .
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
files: |
backend/pytest-report.xml