-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (90 loc) · 3.89 KB
/
python-app.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
87
88
89
90
91
92
93
94
95
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ main, dev* ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
env:
HYDRA_FULL_ERROR: 1
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
- uses: huaxk/postgis-action@v1
with:
postgresql version: 'latest'
postgresql password: 'postgres'
postgresql user: 'postgres' # This optional environment variable is used in conjunction with postgresql password to set a user and its password. This variable will create the specified user with superuser power and a database with the same name. If it is not specified, then the default user of 'postgres' will be used.
postgresql db: 'test_db' # This optional environment variable can be used to define a different name for the default database that is created when the image is first started. If it is not specified, then the value of postgresql user will be used.
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest parameterized coverage
pip install torch==1.10.0
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.10.0+cpu.html
if [ -f requirements.txt ]; then pip install --upgrade --upgrade-strategy eager -r requirements.txt; fi
pip install .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Cache downloaded models
uses: actions/cache@v2
id: cache
with:
path: ~/.cache
key: ${{ runner.os }}-cache
- name: Cache downloaded models2
uses: actions/cache@v2
id: cache2
with:
path: ~/work/pytorch_segmentation_models_trainer/pytorch_segmentation_models_trainer/pytorch_segmentation_models_trainer/custom_models/pretrained/
key: ${{ runner.os }}-cache2
- name: Cache test checkpoints
uses: actions/cache@v2
id: test-cache
with:
path: ~/work/pytorch_segmentation_models_trainer/pytorch_segmentation_models_trainer/tests/testing_data/data/checkpoints/
key: ${{ runner.os }}-test-cache
- name: Test with unittest
run: |
coverage run --source pytorch_segmentation_models_trainer --omit pytorch_segmentation_models_trainer/custom_models/sync_bn/* -m unittest discover -p 'test_*.py'
- name: statistics
if: success()
run: |
coverage report
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: always()
# see: https://github.com/actions/toolkit/issues/399
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
flags: cpu,unittest,python${{ matrix.python-version }}
name: CPU-coverage
fail_ci_if_error: false