-
Notifications
You must be signed in to change notification settings - Fork 443
581 lines (513 loc) · 20.1 KB
/
local-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
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
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
name: GraphScope CI on Local
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- 'CONTRIBUTORS'
- 'LICENSE'
- 'NOTICE.txt'
- '**.md'
- '**.rst'
- 'docs/**'
- 'demo/**'
- 'scripts/**'
- 'tutorials/**'
pull_request:
branches:
- main
paths:
- '.github/workflows/local-ci.yml'
- 'Makefile'
- 'analytical_engine/**'
- 'charts/**'
- 'coordinator/**'
- 'interactive_engine/**'
- 'k8s/**'
- 'learning_engine/**'
- 'proto/**'
- 'python/**'
- '!**.md'
- '!**.rst'
concurrency:
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
env:
GS_IMAGE: registry.cn-hongkong.aliyuncs.com/graphscope/graphscope
jobs:
# JOB to run change detection
changes:
runs-on: ubuntu-20.04
# Set job outputs to values from filter step
outputs:
gae-python: ${{ steps.filter.outputs.gae-python }}
networkx: ${{ steps.filter.outputs.networkx }}
gie-function-test: ${{ steps.filter.outputs.gie-function-test }}
steps:
# For push it's necessary to checkout the code
- uses: actions/checkout@v4
- name: Detect the tmate session
run: |
# hack here: get all field of build-wheels which run on self-hosted machine
if sed -n '/self-hosted/,/mini-test/ p' .github/workflows/local-ci.yml | \
grep -v "grep" - | grep "action-tmate"; then
echo 'WARNING!!!the self-hosted machine cannot run tmate session, please debug it manually'
exit 1
fi
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
base: main # Change detection against merge-base with main before push
filters: |
gae-python:
- 'proto/**'
- 'analytical_engine/**'
- 'python/graphscope/analytical/**'
- 'python/graphscope/client/**'
- 'python/graphscope/dataset/**'
- 'python/graphscope/deploy/**'
- 'python/graphscope/framework/**'
- 'python/graphscope/tests/unittest/**'
- 'coordinator/gscoordinator/**'
- '.github/workflows/local-ci.yml'
networkx:
- 'analytical_engine/apps/**'
- 'analytical_engine/frame/**'
- 'analytical_engine/core/**'
- 'python/graphscope/nx/**'
- 'python/requirements.txt'
gie-function-test:
- 'interactive_engine/**'
- 'python/graphscope/interactive/**'
- '.github/workflows/ci.yml'
gie-k8s-failover-test:
- 'interactive_engine/**'
- 'charts/ir-standalone/**'
- name: Cpp Format and Lint Check
run: |
# install clang-format
sudo curl -L https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/master-22538c65/clang-format-8_linux-amd64 --output /usr/bin/clang-format
sudo chmod +x /usr/bin/clang-format
# collect the source files
cd analytical_engine/
files=$(find ./apps ./benchmarks ./core ./frame ./misc ./test \( -name "*.h" -o -name "*.cc" \))
# run format
clang-format -i --style=file $(echo $files)
# validate format
function prepend() { while read line; do echo "${1}${line}"; done; }
GIT_DIFF=$(git diff --ignore-submodules)
if [[ -n $GIT_DIFF ]]; then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "| clang-format failures found!"
echo "|"
echo "$GIT_DIFF" | prepend "| "
echo "|"
echo "| Run: "
echo "|"
echo "| make gsa_clformat"
echo "|"
echo "| to fix this error."
echo "|"
echo "| Ensure you are working with clang-format-8, which can be obtained from"
echo "|"
echo "| https://github.com/muttleyxd/clang-tools-static-binaries/releases"
echo "|"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
exit -1
fi
# validate cpplint
function ec() { [[ "$1" == "-h" ]] && { shift && eval $* > /dev/null 2>&1; ec=$?; echo $ec; } || eval $*; ec=$?; }
# run cpplint
ec ./misc/cpplint.py $(echo $files)
if [[ "$ec" != "0" ]]; then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "| cpplint failures found! Run: "
echo "|"
echo "| make gsa_cpplint"
echo "|"
echo "| to fix this error."
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
exit -1
fi
- name: Python Format and Lint Check
run: |
echo "Checking formatting for $GITHUB_REPOSITORY"
pip3 install -r coordinator/requirements-dev.txt
pushd python
python3 -m isort --check --diff .
python3 -m black --check --diff .
python3 -m flake8 .
popd
pushd coordinator
python3 -m isort --check --diff .
python3 -m black --check --diff .
python3 -m flake8 .
- name: Setup Java11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
- name: Java Format and Lint Check
run: |
wget https://github.com/google/google-java-format/releases/download/v1.13.0/google-java-format-1.13.0-all-deps.jar
files_to_format=$(git ls-files *.java)
# run formatter in-place
java -jar ${GITHUB_WORKSPACE}/google-java-format-1.13.0-all-deps.jar --aosp --skip-javadoc-formatting -i $files_to_format
# validate format
function prepend() { while read line; do echo "${1}${line}"; done; }
GIT_DIFF=$(git diff --ignore-submodules)
if [[ -n $GIT_DIFF ]]; then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "| google-java-format failures found!"
echo "|"
echo "$GIT_DIFF" | prepend "| "
echo "|"
echo "| Run: "
echo "|"
echo '| java -jar google-java-format-1.13.0-all-deps.jar --aosp --skip-javadoc-formatting -i $(git ls-files **/*.java)'
echo "|"
echo "| to fix this error."
echo "|"
echo "| Ensure you are working with google-java-format-1.13.0, which can be obtained from"
echo "|"
echo "| https://github.com/google/google-java-format/releases/download/v1.13.0/google-java-format-1.13.0-all-deps.jar"
echo "|"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
exit -1
fi
build-wheels:
# Require the user id of the self-hosted is 1001, which may need to be
# configured manually when a new self-hosted runner is added.
runs-on: [self-hosted, ubuntu2004]
needs: [changes]
if: ${{ github.repository == 'alibaba/GraphScope' }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cache/sccache
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Build Wheels
run: |
#sleep infinity
git submodule update --init
cd ${GITHUB_WORKSPACE}/learning_engine/graph-learn && git submodule update --init third_party/pybind11
# build graphscope wheels
cd ${GITHUB_WORKSPACE}/k8s/internal
# sudo -E -u runner make graphscope-py3-package GRAPHSCOPE_HOME=/opt/graphscope
make graphscope-py3-package GRAPHSCOPE_HOME=/opt/graphscope INSTALL_PREFIX=/home/graphscope/graphscope-install REGISTRY=registry-vpc.cn-hongkong.aliyuncs.com
# build client wheels
# sudo -E -u runner make graphscope-client-py3-package GRAPHSCOPE_HOME=/opt/graphscope
make graphscope-client-py3-package GRAPHSCOPE_HOME=/opt/graphscope INSTALL_PREFIX=/home/graphscope/graphscope-install REGISTRY=registry-vpc.cn-hongkong.aliyuncs.com
# package
cd ${GITHUB_WORKSPACE}
sudo chown $(id -u) -R .
tar -zcf client.tar.gz python/dist/wheelhouse/*.whl
tar -zcf graphscope.tar.gz coordinator/dist/
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: wheel-${{ github.sha }}
path: |
client.tar.gz
graphscope.tar.gz
retention-days: 5
mini-test:
runs-on: ubuntu-20.04
if: ${{ github.repository == 'alibaba/GraphScope' }}
needs: [build-wheels]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare Environment
env:
GS_TEST_DIR: ${{ github.workspace }}/gstest
run: |
# install graphscope-client
cd artifacts
tar -zxf ./wheel-${{ github.sha }}/client.tar.gz
pushd python/dist/wheelhouse
for f in * ; do python3 -m pip install --no-cache-dir $f || true; done
popd
# install graphscope
tar -zxf ./wheel-${{ github.sha }}/graphscope.tar.gz
pushd coordinator/dist
python3 -m pip install --no-cache-dir ./*.whl
popd
pushd coordinator/dist/wheelhouse
python3 -m pip install --no-cache-dir ./*.whl
popd
# install tensorflow
python3 -m pip install --no-cache-dir pytest pytest-xdist "pandas" --user
# python3 -m pip install --no-cache-dir "tensorflow" --user
# install pytorch
# python3 -m pip install --no-cache-dir "torch<=2.2.1" "networkx<=3.0" --index-url https://download.pytorch.org/whl/cpu
# install java
sudo apt update -y && sudo apt install openjdk-11-jdk -y
# download dataset
git clone -b master --single-branch --depth=1 https://github.com/7br/gstest.git ${GS_TEST_DIR}
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: false
- name: Run Minimum Test
env:
GS_TEST_DIR: ${{ github.workspace }}/gstest
run: |
python3 -m pytest -d --tx popen//python=python3 \
-s -v \
$(dirname $(python3 -c "import graphscope; print(graphscope.__file__)"))/tests/minitest
- name: Upload GIE log
if: failure()
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: gie-log
path: ~/.local/log/graphscope
python-unittest:
runs-on: ubuntu-20.04
if: ${{ github.repository == 'alibaba/GraphScope' }}
needs: [build-wheels, changes]
defaults:
run:
shell: bash --noprofile --norc -eo pipefail {0}
strategy:
matrix:
deployment: ["standalone", "distributed"]
steps:
- uses: actions/checkout@v4
if: ${{ needs.changes.outputs.gae-python == 'true' }}
- uses: actions/download-artifact@v4
if: ${{ needs.changes.outputs.gae-python == 'true' }}
with:
path: artifacts
- name: Prepare Environment
if: ${{ needs.changes.outputs.gae-python == 'true' }}
run: |
# install graphscope-client
cd artifacts
tar -zxf ./wheel-${{ github.sha }}/client.tar.gz
pushd python/dist/wheelhouse
for f in * ; do python3 -m pip install --no-cache-dir $f || true; done
popd
# install graphscope
tar -zxf ./wheel-${{ github.sha }}/graphscope.tar.gz
pushd coordinator/dist
python3 -m pip install --no-cache-dir ./*.whl
popd
pushd coordinator/dist/wheelhouse
python3 -m pip install --no-cache-dir ./*.whl
popd
# install pytest
python3 -m pip install --no-cache-dir pytest pytest-cov pytest-timeout pytest-xdist
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: false
- name: Run Python Test
if: ${{ needs.changes.outputs.gae-python == 'true' }}
env:
GS_TEST_DIR: ${{ github.workspace }}/gstest
DEPLOYMENT: ${{ matrix.deployment }}
run: |
# download dataset
git clone -b master --single-branch --depth=1 https://github.com/7br/gstest.git ${GS_TEST_DIR}
export TMPDIR="${TMPDIR:-$(dirname $(mktemp))}"
python3 -m pytest -d --tx popen//python=python3 \
-s -v \
--cov=graphscope --cov-config=${GITHUB_WORKSPACE}/python/.coveragerc --cov-report=xml --cov-report=term \
--exitfirst \
$(dirname $(python3 -c "import graphscope; print(graphscope.__file__)"))/tests/unittest
- name: Upload Coverage
uses: codecov/codecov-action@v4
continue-on-error: true
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
networkx-basic-test:
runs-on: ubuntu-20.04
needs: [build-wheels, changes]
if: ${{ github.repository == 'alibaba/GraphScope' }}
defaults:
run:
shell: bash
strategy:
matrix:
deployment: ["standalone", "distributed"]
steps:
- uses: actions/checkout@v4
if: ${{ needs.changes.outputs.networkx == 'true' }}
- uses: dorny/paths-filter@v3
if: ${{ needs.changes.outputs.networkx == 'true' }}
id: nx-filter
with:
filters: |
basic:
- 'analytical_engine/apps/**'
- 'analytical_engine/frame/**'
- 'analytical_engine/core/**'
- 'python/graphscope/nx/__init__.py'
- 'python/graphscope/nx/classes/**'
- 'python/graphscope/nx/!(tests)'
- 'python/graphscope/nx/tests/!(convert)'
- 'python/requirements.txt'
convert:
- 'python/graphscope/nx/convert.py'
- 'python/graphscope/nx/convert_matrix.py'
- 'python/graphscope/nx/tests/convert/**'
- uses: actions/download-artifact@v4
if: ${{ needs.changes.outputs.networkx == 'true' }}
with:
path: artifacts
- name: Prepare Environment
if: ${{ needs.changes.outputs.networkx == 'true' }}
env:
GS_TEST_DIR: ${{ github.workspace }}/gstest
run: |
# install graphscope-client
cd artifacts
tar -zxf ./wheel-${{ github.sha }}/client.tar.gz
pushd python/dist/wheelhouse
for f in * ; do python3 -m pip install --no-cache-dir $f || true; done
popd
# install graphscope
tar -zxf ./wheel-${{ github.sha }}/graphscope.tar.gz
pushd coordinator/dist
python3 -m pip install --no-cache-dir ./*.whl
popd
pushd coordinator/dist/wheelhouse
python3 -m pip install --no-cache-dir ./*.whl
popd
# install pytest
python3 -m pip install --no-cache-dir pytest pytest-xdist
# download dataset
git clone -b master --single-branch --depth=1 https://github.com/7br/gstest.git ${GS_TEST_DIR}
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: false
- name: Basic Test
if: ${{ needs.changes.outputs.networkx == 'true' && steps.nx-filter.outputs.basic == 'true' }}
env:
DEPLOYMENT: ${{ matrix.deployment }}
GS_TEST_DIR: ${{ github.workspace }}/gstest
run: |
pip3 show networkx
python3 -m pytest -d --tx popen//python=python3 \
--exitfirst -s -vvv \
$(dirname $(python3 -c "import graphscope; print(graphscope.__file__)"))/nx/tests \
--ignore=$(dirname $(python3 -c "import graphscope; print(graphscope.__file__)"))/nx/tests/convert
- name: Convert Test
if: ${{ needs.changes.outputs.networkx == 'true' && steps.nx-filter.outputs.convert == 'true' }}
env:
DEPLOYMENT: ${{ matrix.deployment }}
GS_TEST_DIR: ${{ github.workspace }}/gstest
run: |
pip3 show networkx
python3 -m pytest -d --tx popen//python=python3 \
--exitfirst -s -vvv \
$(dirname $(python3 -c "import graphscope; print(graphscope.__file__)"))/nx/tests/convert
networkx-algo-and-generator-test:
runs-on: ubuntu-20.04
needs: [build-wheels, changes]
if: ${{ github.repository == 'alibaba/GraphScope' }}
strategy:
matrix:
deployment: ["standalone", "distributed"]
steps:
- uses: actions/checkout@v4
if: ${{ needs.changes.outputs.networkx == 'true' }}
- uses: dorny/paths-filter@v3
if: ${{ needs.changes.outputs.networkx == 'true' }}
id: nx-filter
with:
filters: |
algorithm:
- 'analytical_engine/apps/**'
- 'analytical_engine/frame/**'
- 'python/graphscope/nx/algorithms/builtin.py'
- 'python/graphscope/nx/algorithms/tests/builtin/**'
generator:
- 'python/graphscope/nx/classes/**'
- 'python/graphscope/nx/utils/**'
- 'python/graphscope/nx/generators/**'
io:
- 'python/graphscope/nx/readwrite/**'
- uses: actions/download-artifact@v4
if: ${{ needs.changes.outputs.networkx == 'true' }}
with:
path: artifacts
- name: Prepare Environment
if: ${{ needs.changes.outputs.networkx == 'true' }}
env:
GS_TEST_DIR: ${{ github.workspace }}/gstest
run: |
# install graphscope-client
cd artifacts
tar -zxf ./wheel-${{ github.sha }}/client.tar.gz
pushd python/dist/wheelhouse
for f in * ; do python3 -m pip install --no-cache-dir $f || true; done
popd
# install graphscope
tar -zxf ./wheel-${{ github.sha }}/graphscope.tar.gz
pushd coordinator/dist
python3 -m pip install --no-cache-dir ./*.whl
popd
pushd coordinator/dist/wheelhouse
python3 -m pip install --no-cache-dir ./*.whl
popd
# install pytest
python3 -m pip install --no-cache-dir pytest pytest-xdist
# download dataset
git clone -b master --single-branch --depth=1 https://github.com/7br/gstest.git ${GS_TEST_DIR}
- name: Algorithm test
if: ${{ needs.changes.outputs.networkx == 'true' && steps.nx-filter.outputs.algorithm == 'true' }}
env:
DEPLOYMENT: ${{ matrix.deployment }}
GS_TEST_DIR: ${{ github.workspace }}/gstest
run: |
pip3 show networkx
python3 -m pytest -d --tx popen//python=python3 \
--exitfirst -s -v \
$(dirname $(python3 -c "import graphscope; print(graphscope.__file__)"))/nx/algorithms/tests/builtin
- name: Generator test
if: ${{ needs.changes.outputs.networkx == 'true' && steps.nx-filter.outputs.generator == 'true' }}
env:
DEPLOYMENT: ${{ matrix.deployment }}
GS_TEST_DIR: ${{ github.workspace }}/gstest
run: |
pip3 show networkx
python3 -m pytest -d --tx popen//python=python3 \
--exitfirst -s -v \
$(dirname $(python3 -c "import graphscope; print(graphscope.__file__)"))/nx/generators/tests
- name: Readwrite test
if: ${{ needs.changes.outputs.networkx == 'true' && steps.nx-filter.outputs.io == 'true' }}
env:
DEPLOYMENT: ${{ matrix.deployment }}
run: |
python3 -m pytest -d --tx popen//python=python3 \
--exitfirst -s -v -m "not slow" \
$(dirname $(python3 -c "import graphscope; print(graphscope.__file__)"))/nx/readwrite/tests