-
Notifications
You must be signed in to change notification settings - Fork 2.4k
167 lines (146 loc) · 5.15 KB
/
test_pull_requests.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: test pull requests
on:
push:
branches:
- '!master'
pull_request:
jobs:
build:
# There were errors on Mac that would lead to non-stop printing of
# error messages forever instead of the job crashing. To prevent this,
# a timeout is placed here (default value is otherwise 360min).
# Usually, jobs currently run through in around 10min.
timeout-minutes: 45
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# see supported versions at
# https://raw.githubusercontent.com/actions/python-versions/master/versions-manifest.json
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
# test only 2.7 and the latest 3.x on mac
# test only the latest 3.x on windows
exclude:
- os: macos-latest
python-version: 3.5
- os: macos-latest
python-version: 3.6
- os: macos-latest
python-version: 3.7
- os: windows-latest
python-version: 2.7 # causes a Shapely install error
- os: windows-latest
python-version: 3.5
- os: windows-latest
python-version: 3.6
- os: windows-latest
python-version: 3.7
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
# ----------------
# Install python and base packages
# ----------------
- name: Set up Python ${{ matrix.python-version }} on ${{ runner.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display python version
run: |
python -c "import sys; print(sys.version)"
- name: Display system information
run : |
python -c "import sys; print(sys.maxsize);"
python -c "import platform; print(platform.uname());"
python -c "import platform; print(platform.platform());"
python -c "import platform; print(platform.architecture());"
python -c "import platform; print(platform.processor());"
python -c "import platform; print(platform.python_compiler());"
- name: Upgrade basic packages
run: |
python -m pip install --upgrade pip setuptools wheel
# ----------------
# Set up pip cache
# ----------------
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- uses: actions/cache@v1
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v1
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v1
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# ----------------
# Install dependencies
# ----------------
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Install test dependencies
run: |
pip install --upgrade -r test/requirements.txt
- name: Install further test tools
run: |
pip install coverage pytest-cov flake8
# ----------------
# Install library
# ----------------
- name: Install library
run: |
pip install .
# ----------------
# Run checks and tests
# ----------------
- name: Run flake8
run: |
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude=".svn,CVS,.bzr,.hg,.git,__pycache__,poly_point_isect.py"
- name: Run tests
run: |
python -m pytest --verbose --xdoctest-modules -s --durations=50 -Walways
# ----------------
# Code coverage reports
# ----------------
# Add 'coverage html -d out_foldername' to add html reports
# Dont deactivate -Walways here, otherwise some tests fail as warnings
# are no longer produced.
- name: Generate code coverage report
run: |
coverage run --source imgaug -m pytest --verbose -Walways
coverage xml
coverage report
#- name: Upload coverage report to codacy
# uses: codacy/codacy-coverage-reporter-action@master
# with:
# project-token: ${{ secrets.CODACY_TOKEN }}
# coverage-reports: coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
# right now the env_vars argument causes a warning, see
# https://github.com/codecov/codecov-action/issues/80
#env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false