-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (58 loc) · 1.56 KB
/
python-ci.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
name: Python CI
on:
push:
branches:
- develop
- "feature/**"
- "release/**"
pull_request:
branches:
- develop
- main
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: scholar_db
MYSQL_USER: scholar_user
MYSQL_PASSWORD: scholar_pass
MYSQL_ROOT_PASSWORD: rootpass
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint pytest pytest-cov
- name: Initialize Database
run: |
mysql -h127.0.0.1 -P3306 -uscholar_user -pscholar_pass scholar_db < init/01_schema.sql
- name: Run tests with pytest
run: |
python -m pytest tests/ --cov=code --cov=app
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_USER: scholar_user
MYSQL_PASSWORD: scholar_pass
MYSQL_DATABASE: scholar_db
- name: Lint with pylint
run: |
pylint code/ app/ tests/ --disable=C0111,C0301
- name: Upload coverage reports
if: success()
uses: codecov/codecov-action@v3