-
Notifications
You must be signed in to change notification settings - Fork 5
73 lines (61 loc) · 1.75 KB
/
python.yml
File metadata and controls
73 lines (61 loc) · 1.75 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
67
68
69
70
71
72
73
name: Test Python
on:
push:
branches:
- main
pull_request:
paths:
- '*.py'
- 'api/**'
branches:
- main
jobs:
test-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: mirromutth/mysql-action@v1.1
with:
mysql version: '8.0.21'
mysql database: 'spi_data'
mysql root password: 'testpassword'
- name: Install Dependencies
run: |
cd api
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
pip install -e .
pip list
- name: Migrate database
env:
DATABASE_URL: "mysql://root:testpassword@127.0.0.1:3306/spi_data"
run: |
curl -fsSL -o ./dbmate https://github.com/amacneil/dbmate/releases/latest/download/dbmate-linux-amd64
chmod +x ./dbmate
./dbmate --wait up
- name: Test
run: |
pytest api/solarperformanceinsight_api --cov=solarperformanceinsight_api --cov-report=term-missing --cov-report=xml
- name: Run mypy
run: mypy api/solarperformanceinsight_api
if: ${{ always() }}
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
flags: python
files: coverage.xml
fail_ci_if_error: true
if: ${{ always() }}
- name: Ensure assets are up to date
if: ${{ always() }}
run: python extract_files.py --check
lint-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: psf/black@20.8b1