-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (53 loc) · 1.55 KB
/
python.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
name: Python
on:
push:
paths-ignore:
- '*.md'
pull_request:
paths-ignore:
- '*.md'
jobs:
test-ubuntu:
runs-on: ubuntu-latest
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 6379:6379
steps:
- name: Setup MySQL
uses: mirromutth/[email protected]
with:
mysql root password: "123"
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends mysql-client
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-test.txt
- name: Test
run: |
while ! mysqladmin ping -h 127.0.0.1 -uroot -p123 --silent; do
sleep 1
done
mysql -h 127.0.0.1 -uroot -p123 -e "CREATE DATABASE IF NOT EXISTS test"
mysql -h 127.0.0.1 -uroot -p123 test < db/db.sql
mysql -h 127.0.0.1 -uroot -p123 test < db/test.sql
python create_admin.py admin
pytest --ruff app --cov=app tests
env:
MYSQL_DSN: mysql+asyncmy://root:[email protected]:3306/test?charset=utf8mb4
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true