forked from KatanaGraph/katana
-
Notifications
You must be signed in to change notification settings - Fork 0
433 lines (388 loc) · 13.4 KB
/
python.yaml
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
name: Python CI
on:
push:
branches:
- 'master'
- 'release/*'
tags:
- 'v*'
pull_request:
# Cancel any previous runs with the same key.
concurrency:
# Example key: Repository Structure CI-refs/pull/1381/merge
# or Repository Structure CI-<owner>-<sha> for pushes
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || format('{0}-{1}', github.repository_owner, github.sha) }}
cancel-in-progress: true
jobs:
do_python:
if: |
github.event_name != 'pull_request' ||
(
!contains(github.event.pull_request.body, '[no Python]')
)
runs-on: ubuntu-latest
steps:
- name: Info
run: echo "will build"
do_python_package:
needs:
- do_python
if: |
github.event_name != 'pull_request' ||
(
!contains(github.event.pull_request.body, '[no package]') &&
!contains(github.event.pull_request.body, '[no Python package]')
)
runs-on: ubuntu-latest
steps:
- name: Info
run: echo "will build"
do_python_test:
needs:
- do_python
# Don't run this in tag CI runs. It's useless since it doesn't produce meaningful artifacts.
if: |
github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/tags/') ||
(
!contains(github.event.pull_request.body, '[no test]') &&
!contains(github.event.pull_request.body, '[no Python test]')
)
runs-on: ubuntu-latest
steps:
- name: Info
run: echo "will build"
build_and_test_conda_package:
needs: do_python_package
runs-on: ${{matrix.os}}
strategy:
matrix:
os:
- ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
# We need history so that we have tags to provide version information.
fetch-depth: 0
# 0 fetches all history. See https://github.com/actions/checkout#checkout-v2
###
# Caching between builds
###
- name: Cache miniconda
id: cache-miniconda
uses: actions/cache@v2
with:
key: ${{matrix.os}}-miniconda-${{hashFiles('.github/workflows/download_miniconda.sh')}}
path: ~/.cache/miniconda
- name: Cache ccache objects
uses: actions/cache@v2
with:
key: ${{matrix.os}}-ccache-arrow-6-v1-${{github.sha}}
restore-keys: |
${{matrix.os}}-ccache-arrow-6-v1-
path: ~/.ccache
###
# Install platform-level dependencies (OS-specific)
###
- name: Install dependencies
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt install -yq ccache curl libz-dev bzip2 make libnuma1
- name: Setup ccache
run: |
.github/workflows/configure_ccache.sh
ccache --max-files 350 --max-size=1.5G # Roughly two builds worth of objects, and limited in size as a safety net.
ccache --zero-stats
###
# Install Conda environment
###
- name: Download miniconda
run: .github/workflows/download_miniconda.sh ${{matrix.os}}
if: steps.cache-miniconda.outputs.cache-hit != 'true'
- name: Create directories
run: mkdir -p $HOME/build
- name: Install Conda dependencies
run: |
. .github/workflows/activate_miniconda.sh
mamba install -y -q -c conda-forge conda-build boa conda-verify pygithub packaging
###
# Conda build process
###
- name: Build conda Packages
run: |
. .github/workflows/activate_miniconda.sh
export CPU_COUNT=1
scripts/build_conda.py --output-folder $HOME/build/
- name: Build conda Packages for Katana Metagraph Plugin
run: |
. .github/workflows/activate_miniconda.sh
export KATANA_VERSION=$(scripts/version show --pep440)
export KATANA_TEST_DATASETS=$(realpath external/test-datasets)
cd metagraph-plugin/conda_recipe
conda mambabuild . -c conda-forge -c metagraph -c file://$HOME/build/ --output-folder $HOME/build/
- name: Clean ccache
run: |
ccache --show-stats
ccache --cleanup
# Upload path is relative to work directory and "~" and "${{env.HOME}}" do
# not seem to be expanded, so hard code HOME for now.
- name: Upload built packages
uses: actions/upload-artifact@v1
if: startsWith(matrix.os, 'ubuntu-')
with:
name: conda-pkgs-${{matrix.os}}
path: /home/runner/build
test_conda_package_install:
needs: build_and_test_conda_package
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
image:
- ubuntu:18.04
- ubuntu:latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Download conda packages
uses: actions/download-artifact@v2
with:
name: conda-pkgs-ubuntu-20.04
path: pkgs
- name: Install in docker container
run: python3 test/install_conda_packages_test.py pkgs ${{matrix.image}}
upload_conda_packages:
if: |
(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/v')
|| startsWith(github.ref, 'refs/tags/v'))
&& github.event_name == 'push' && github.repository == 'KatanaGraph/katana'
environment: AnacondaUpload
needs: test_conda_package_install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
###
# Caching between builds
###
- name: Cache miniconda
id: cache-miniconda
uses: actions/cache@v2
with:
key: ubuntu-20.04-miniconda-${{hashFiles('.github/workflows/download_miniconda.sh')}}
path: ~/.cache/miniconda
###
# Install platform-level dependencies (OS-specific)
###
- name: Install dependencies
run: |
sudo apt install -yq curl
###
# Install Conda environment
###
- name: Download miniconda
run: .github/workflows/download_miniconda.sh ${{matrix.os}}
if: steps.cache-miniconda.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
. .github/workflows/activate_miniconda.sh
mamba install -y -q -c conda-forge anaconda-client
- name: Download Katana conda packages
uses: actions/download-artifact@v2
with:
name: conda-pkgs-ubuntu-20.04
path: pkgs
- name: Upload Katana conda packages to anaconda with label dev
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
. .github/workflows/activate_miniconda.sh
echo "Anaconda token has ${#ANACONDA_TOKEN} characters."
echo "Uploading:"
ls pkgs/*/*.tar.bz2
anaconda --token "$ANACONDA_TOKEN" upload --no-progress --user KatanaGraph --package-type conda --label dev pkgs/*/*.tar.bz2
test_build_in_container_conda:
needs: do_python_test
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Run build_in_container
run: scripts/build_in_container.py --build $HOME/build --type conda
test_build_in_container_conda_ninja:
needs: do_python_test
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Run build_in_container (with Ninja)
run: scripts/build_in_container.py --build $HOME/build --type conda --cmake-generator Ninja
lint:
needs: do_python
runs-on: ${{matrix.os}}
strategy:
matrix:
os:
- ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
# We need history so that we have tags to provide version information.
fetch-depth: 0
# 0 fetches all history. See https://github.com/actions/checkout#checkout-v2
###
# Caching between builds
###
- name: Cache miniconda
id: cache-miniconda
uses: actions/cache@v2
with:
key: ${{matrix.os}}-miniconda-${{hashFiles('.github/workflows/download_miniconda.sh')}}
path: ~/.cache/miniconda
###
# Install platform-level dependencies (OS-specific)
###
- name: Install dependencies
run: |
sudo apt install -yq curl
###
# Install Conda environment
###
- name: Download miniconda
run: .github/workflows/download_miniconda.sh ${{matrix.os}}
if: steps.cache-miniconda.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
. .github/workflows/activate_miniconda.sh
mamba install -y -q -c conda-forge black=19.10b0 pylint=2.8.3 pydocstyle=6.1.1
- name: Check formatting
run: |
. .github/workflows/activate_miniconda.sh
./scripts/check_python_format.sh python test scripts
- name: Check for lint
run: |
. .github/workflows/activate_miniconda.sh
./scripts/check_python_lint.sh python test scripts
build_and_test:
needs: do_python_test
runs-on: ${{matrix.os}}
strategy:
matrix:
os:
- ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
# We need history so that we have tags to provide version information.
fetch-depth: 0
# 0 fetches all history. See https://github.com/actions/checkout#checkout-v2
###
# Caching between builds
###
- name: Cache miniconda
id: cache-miniconda
uses: actions/cache@v2
with:
key: ${{matrix.os}}-miniconda-${{hashFiles('.github/workflows/download_miniconda.sh')}}
path: ~/.cache/miniconda
- name: Cache ccache objects
uses: actions/cache@v2
with:
key: ${{matrix.os}}-ccache-dev-arrow-6-v1-${{github.sha}}
restore-keys: |
${{matrix.os}}-ccache-dev-arrow-6-v1-
path: ~/.ccache
###
# Install platform-level dependencies (OS-specific)
###
- name: Install dependencies
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt install -yq ccache curl libz-dev bzip2 make libnuma1
- name: Setup ccache
run: |
.github/workflows/configure_ccache.sh
ccache --max-files 350 --max-size=1.5G # Roughly two builds worth of objects, and limited in size as a safety net.
###
# Install Conda environment
###
- name: Download miniconda
run: .github/workflows/download_miniconda.sh ${{matrix.os}}
if: steps.cache-miniconda.outputs.cache-hit != 'true'
- name: Create directories
run: mkdir -p $HOME/build
- name: Install Conda dependencies
run: |
. .github/workflows/activate_miniconda.sh
mamba env update --quiet --file=conda_recipe/environment.yml
mamba list
###
# Standard CMake build process
###
- name: Configure
run: |
. .github/workflows/activate_miniconda.sh
export CMAKE_BUILD_PARALLEL_LEVEL=2
.github/workflows/configure_cpp.sh \
${{matrix.os}} "$CXX" Release "$HOME/build" \
-DKATANA_LANG_BINDINGS=python -DBUILD_DOCS=internal
- name: Build
run: |
. .github/workflows/activate_miniconda.sh
export CMAKE_BUILD_PARALLEL_LEVEL=2
cmake --build $HOME/build --parallel 2
- name: Build documentation
run: |
. .github/workflows/activate_miniconda.sh
cmake --build $HOME/build --target doc
- name: Clean ccache
run: |
ccache --show-stats
ccache --cleanup
# Upload path is relative to work directory and "~" and "${{env.HOME}}" do
# not seem to be expanded, so hard code HOME for now.
- name: Upload documentation artifact (C++ and Python)
uses: actions/upload-artifact@v1
if: startsWith(matrix.os, 'ubuntu-')
with:
name: katana-docs-${{matrix.os}}
path: /home/runner/build/docs
- name: Publish documentation
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository == 'KatanaGraph/katana' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: documentation
publish_dir: /home/runner/build/docs/katana_python
- name: Test python_env.sh
if: startsWith(matrix.os, 'ubuntu-')
run: |
. .github/workflows/activate_miniconda.sh
$HOME/build/python_env.sh python -c "import katana; katana.for_each;"
$HOME/build/python_env.sh python -c "import katana.local.analytics; katana.local.analytics.sssp;"
. $HOME/build/python_env.sh
python -c "import katana; katana.for_each;"
python -c "import katana.local.analytics; katana.local.analytics.sssp;"
- name: Install
run: |
. .github/workflows/activate_miniconda.sh
DESTDIR=/tmp cmake --install $HOME/build
- name: Test
if: startsWith(matrix.os, 'ubuntu-')
run: |
. .github/workflows/activate_miniconda.sh
export AWS_EC2_METADATA_DISABLED=true
# Default timeout is 1500 seconds. Quick tests should not take more
# than a few seconds typically.
cd $HOME/build && ctest --output-on-failure --label-regex quick --parallel 2 --timeout 350