-
Notifications
You must be signed in to change notification settings - Fork 0
257 lines (211 loc) · 7.65 KB
/
Copy pathpythonactions.yml
File metadata and controls
257 lines (211 loc) · 7.65 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
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# If you change the name, change the link on the README.md for the badge too
name: Tests
# Help: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
on: [push, pull_request]
jobs:
run_pytest_tests:
# Run pytest tests on pickle files (pre-generated SC2 API observations)
name: Run pytest
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# Python 3.6 fails due to: https://www.python.org/dev/peps/pep-0563/
# If all type annotations were removed, this library should run in py3.6 and perhaps even 3.5
os: [macos-latest, windows-latest, ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Cache poetry
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: |
python -m pip install poetry
poetry install
# Run tests
- name: Run poetry pytest tests on pickle files
run: |
poetry run pytest test/
# Run benchmarks
- name: Run benchmark benchmark_array_creation
run: |
poetry run pytest test/benchmark_array_creation.py
- name: Run benchmark benchmark_distance_two_points
run: |
poetry run pytest test/benchmark_distance_two_points.py
- name: Run benchmark benchmark_distances_cdist
run: |
poetry run pytest test/benchmark_distances_cdist.py
- name: Run benchmark benchmark_distances_points_to_point
run: |
poetry run pytest test/benchmark_distances_points_to_point.py
- name: Run benchmark benchmark_distances_units
run: |
poetry run pytest test/benchmark_distances_units.py
run_coverage:
# Run and upload coverage report using python 3.7
# This coverage test does not cover the whole testing range, check /bat_files/rune_code_coverage.bat
name: Run coverage
runs-on: ubuntu-latest
timeout-minutes: 3
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install poetry
poetry install
- name: Run poetry coverage
run: |
poetry run pytest --cov=./
- name: Generate html coverage files in htmlcov/ folder
run: |
poetry run coverage html
- name: Upload htmlcov/ folder as artifact
uses: actions/upload-artifact@v1
with:
name: Coverage_report
path: htmlcov
run_radon:
# Output a cyclomatic complexity report of the project
name: Run radon
runs-on: ubuntu-latest
timeout-minutes: 3
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install poetry
poetry install
- name: Run poetry radon
run: |
poetry run radon cc sc2/ -a -nb
run_autotest_bot:
# Run test bots that download the SC2 linux client and run it
name: Run testbots linux
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
# Do not allow this test to cancel. Finish all jobs regardless of error
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
# Copy data from repository
- uses: actions/checkout@v1
- name: Print directories and files
run: |
sudo apt-get install tree
tree
- name: Load and build docker image
# Build docker image from Dockerfile using python 3.7
run: |
docker build -t test_image -f test/Dockerfile_3.7 .
- name: Run autotest_bot.py
# docker exec -i app bash -c "cd /root/template && poetry run pytest test/benchmark_distances_points_to_point.py --benchmark-compare"
# Run bot and list resulting files (replay file, stable_id.json)
run: |
docker run -it -d --name app1 test_image
docker exec -i app1 bash -c "python test/travis_test_script.py test/autotest_bot.py"
docker exec -i app1 bash -c "tree"
docker rm -f app1
- name: Run upgradestest_bot.py
run: |
docker run -it -d --name app2 test_image
docker exec -i app2 bash -c "python test/travis_test_script.py test/upgradestest_bot.py"
docker exec -i app2 bash -c "tree"
docker rm -f app2
- name: Run damagetest_bot.py
run: |
docker run -it -d --name app3 test_image
docker exec -i app3 bash -c "python test/travis_test_script.py test/damagetest_bot.py"
docker exec -i app3 bash -c "tree"
docker rm -f app3
- name: Run queries_test_bot.py
run: |
docker run -it -d --name app4 test_image
docker exec -i app4 bash -c "python test/travis_test_script.py test/queries_test_bot.py"
docker exec -i app4 bash -c "tree"
docker rm -f app4
release_to_github_pages:
name: GitHub Pages
runs-on: ubuntu-latest
timeout-minutes: 3
strategy:
matrix:
python-version: [3.9]
needs: [run_pytest_tests, run_autotest_bot]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Remove docs and prepare to build
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#contexts
run: |
python -m pip install poetry
poetry install
- name: Build docs from scratch
run: |
mkdir -p docs
cd docs_generate
poetry run sphinx-build -a -E -b html . ../docs
cd ..
- name: Publish to Github Pages
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BASE_BRANCH: develop # The branch the action should deploy from.
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: . # The folder the action should deploy.
release_to_pypi:
name: Pypi
runs-on: ubuntu-latest
timeout-minutes: 3
strategy:
matrix:
python-version: [3.9]
needs: [run_pytest_tests, run_autotest_bot]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Update dependencies
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#contexts
run: |
pip install poetry
- name: Build package
# Builds package to dist/* directory
run: |
poetry build
# Publish package on pypi
- name: Publish
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
continue-on-error: true
run: |
poetry publish --username ${{ secrets.pypi_username }} --password ${{ secrets.pypi_password }}