-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (55 loc) · 1.82 KB
/
Copy pathtest.yaml
File metadata and controls
66 lines (55 loc) · 1.82 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
name: Run Test
on:
pull_request:
paths:
- wacruit/**
- .github/workflows/test.yaml
jobs:
pytest:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_USER: test-user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: root-password
MYSQL_DATABASE: testdb
ports:
- 3307:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
env:
env: test
steps:
- uses: actions/checkout@v3
- name: change mysql charset
run: mysql -h 127.0.0.1 -P 3307 -u root -p'root-password' -e "ALTER DATABASE testdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"
- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
python-version: 3.11
enable-cache: true
- name: Install dependencies
run: uv sync --frozen
- name: Run tests
run: |
cd ${GITHUB_WORKSPACE}/wacruit/
uv run pytest --junit-xml=${GITHUB_WORKSPACE}/wacruit/test.xml ./
- name: Test reports
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: backend tests
path: "./wacruit/test.xml"
reporter: java-junit
# run pre-commit only different from base branch
# it contains pylint, black, isort, etc.
- name: Run pre-commit
run: |
git fetch origin ${{ github.base_ref }}
uv run pre-commit run --from-ref origin/${{ github.base_ref }} --to-ref HEAD
- name: Run alembic migration test
run: |
mkdir -p wacruit/src/database/migrations/versions
ls wacruit/src/database/migrations/versions/* || uv run alembic revision --autogenerate
uv run alembic upgrade head