-
Notifications
You must be signed in to change notification settings - Fork 3
86 lines (71 loc) · 2.6 KB
/
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: CI
on:
push:
tags-ignore:
- '**'
branches:
- '**'
pull_request:
jobs:
checks:
name: checks
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10']
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setting Python and OS environment variables on Linux and Mac
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }}
run: |
echo "PYTHON=${{ matrix.python-version }}" >> $GITHUB_ENV
echo "OS=${{ runner.os }}" >> $GITHUB_ENV
- name: Setting Python and OS environment variables on Windows
if: ${{ runner.os == 'Windows' }}
run: |
echo "PYTHON=${{ matrix.python-version }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "OS=${{ runner.os }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Cache pip
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/dev_requirements.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade --upgrade-strategy eager -r requirements.txt -r dev_requirements.txt
- name: isort
run: isort --check-only pymusas_models model_function_tests model_creation_tests
- name: flake8
run: flake8
- name: Cache mypy
uses: actions/cache@v2
with:
path: ./.mypy_cache
key: ${{ runner.os }}-${{ env.pythonLocation }}
- name: mypy
run: mypy
- name: tests on Linux
if: ${{ runner.os == 'Linux' }}
run: |
make model-creation-tests
make model-function-tests
- name: tests on Mac
if: ${{ runner.os == 'macOS' }}
run: |
pytest --virtual-env-directory=./temp_venv --overwrite ./model_creation_tests
source ./temp_venv/venv/bin/activate
pytest ./model_function_tests
deactivate
- name: tests on Windows
if: ${{ runner.os == 'Windows' }}
run: |
pytest --virtual-env-directory=.\temp_venv --overwrite .\model_creation_tests
.\temp_venv\venv\Scripts\Activate.ps1
pytest .\model_function_tests
deactivate