@@ -43,6 +43,19 @@ commands:
4343 circleci step halt
4444 fi
4545
46+ only_run_if_forked_pull_request :
47+ description : >-
48+ If this build is from an internal (i.e not a forked) pull request, then end early.
49+ This is required when we want different behaviours for external, versus internal PRs.
50+ steps :
51+ - run :
52+ name : Return early if not a forked pull request
53+ command : |
54+ if [[ ! -n "$CIRCLE_PR_NUMBER" ]]; then
55+ echo "Not a forked PR so marking as successfull and exiting"
56+ circleci step halt
57+ fi
58+
4659 relocate-docker-storage :
4760 steps :
4861 - run :
@@ -127,6 +140,64 @@ commands:
127140 - store_artifacts :
128141 path : tests/logs
129142
143+ valgrind-general-steps :
144+ parameters :
145+ test_args :
146+ type : string
147+ default : " CLUSTER=0 AOF=0"
148+ steps :
149+ - abort_for_docs
150+ - abort_for_noci
151+ - checkout-all
152+ - restore_cache :
153+ keys :
154+ - build-dependencies-{{ checksum "get_deps.sh" }}
155+ # If no exact match is found will get dependencies from source
156+ - setup-build-system
157+ - run :
158+ name : Install dependencies
159+ command : |
160+ ./opt/readies/bin/getredis -v 6.0 --valgrind --force
161+ ./get_deps.sh cpu
162+ - run :
163+ name : Build for valgrind
164+ command : |
165+ make -C opt all VALGRIND=1 SHOW=1
166+ - run :
167+ name : Test with valgrind
168+ command : |
169+ make -C opt test VALGRIND=1 <<parameters.test_args>>
170+ no_output_timeout : 120m
171+
172+ build-and-test-gpu-steps :
173+ steps :
174+ - abort_for_docs
175+ - abort_for_noci
176+ - checkout-all
177+ - run :
178+ name : Relocate docker overlay2 dir
179+ command : |
180+ sudo systemctl stop docker
181+ sudo mkdir -p /var2/lib/docker
182+ sudo mv /var/lib/docker/overlay2 /var2/lib/docker
183+ sudo mkdir /var/lib/docker/overlay2
184+ sudo mount --bind /var2/lib/docker/overlay2 /var/lib/docker/overlay2
185+ sudo systemctl start docker
186+ - run :
187+ name : Build
188+ command : |
189+ docker build -f Dockerfile.gpu-test --no-cache -t redisai-gpu:latest-x64-bionic-test .
190+ - run :
191+ name : Test
192+ command : |
193+ mkdir -p $HOME/tests
194+ docker run --gpus all -v $HOME/tests:/build/tests/logs -it --rm redisai-gpu:latest-x64-bionic-test
195+ no_output_timeout : 40m
196+ - store_artifacts :
197+ path : tests/logs
198+
199+
200+
130201jobs :
131202 lint :
132203 docker :
@@ -245,37 +316,18 @@ jobs:
245316 make -C opt test VALGRIND=1 <<parameters.test_args>>
246317 no_output_timeout : 120m
247318
319+ valgrind-general-for-forked-prs :
320+ docker :
321+ - image : redisfab/rmbuilder:6.2.1-x64-buster
322+ steps :
323+ - only_run_if_forked_pull_request
324+ - valgrind-general-steps
325+
248326 valgrind-general :
249- parameters :
250- test_args :
251- type : string
252- default : " CLUSTER=0 AOF=0"
253327 docker :
254328 - image : redisfab/rmbuilder:6.2.1-x64-buster
255329 steps :
256- - abort_for_docs
257- - abort_for_noci
258- - early_return_for_forked_pull_requests
259- - checkout-all
260- - restore_cache :
261- keys :
262- - build-dependencies-{{ checksum "get_deps.sh" }}
263- # If no exact match is found will get dependencies from source
264- - setup-build-system
265- - run :
266- name : Install dependencies
267- command : |
268- ./opt/readies/bin/getredis -v 6.0 --valgrind --force
269- ./get_deps.sh cpu
270- - run :
271- name : Build for valgrind
272- command : |
273- make -C opt all VALGRIND=1 SHOW=1
274- - run :
275- name : Test with valgrind
276- command : |
277- make -C opt test VALGRIND=1 <<parameters.test_args>>
278- no_output_timeout : 120m
330+ - valgrind-general-steps
279331
280332# build-macos:
281333# macos:
@@ -316,6 +368,8 @@ jobs:
316368# make build
317369# sudo make publish
318370
371+ # internal PRs execute build-and-test either in a workflow or
372+ # via a github action trigger
319373 build-and-test-gpu :
320374 machine :
321375 enabled : true
@@ -324,30 +378,20 @@ jobs:
324378 image : ubuntu-1604-cuda-11.1:202012-01
325379
326380 steps :
327- - abort_for_docs
328- - abort_for_noci
329- - checkout-all
330- - run :
331- name : Relocate docker overlay2 dir
332- command : |
333- sudo systemctl stop docker
334- sudo mkdir -p /var2/lib/docker
335- sudo mv /var/lib/docker/overlay2 /var2/lib/docker
336- sudo mkdir /var/lib/docker/overlay2
337- sudo mount --bind /var2/lib/docker/overlay2 /var/lib/docker/overlay2
338- sudo systemctl start docker
339- - run :
340- name : Build
341- command : |
342- docker build -f Dockerfile.gpu-test --no-cache -t redisai-gpu:latest-x64-bionic-test .
343- - run :
344- name : Test
345- command : |
346- mkdir -p $HOME/tests
347- docker run --gpus all -v $HOME/tests:/build/tests/logs -it --rm redisai-gpu:latest-x64-bionic-test
348- no_output_timeout : 40m
349- - store_artifacts :
350- path : tests/logs
381+ - build-and-test-gpu-steps
382+
383+ # in the case of a forked PR, we want to run the GPU steps
384+ # hence we check if we're forked, explicitly
385+ build-and-test-gpu-for-forked-prs :
386+ machine :
387+ enabled : true
388+ docker_layer_caching : true
389+ resource_class : gpu.nvidia.small
390+ image : ubuntu-1604-cuda-11.1:202012-01
391+
392+ steps :
393+ - only_run_if_forked_pull_request
394+ - build-and-test-gpu-steps
351395
352396 deploy-artifacts :
353397 parameters :
@@ -512,6 +556,12 @@ workflows:
512556 - build-and-test :
513557 << : *on-any-branch
514558 << : *after-linter
559+ - build-and-test-gpu :
560+ << : *on-integ-branch
561+ << : *after-linter
562+ - build-and-test-gpu-for-forked-prs :
563+ << : *on-any-branch
564+ << : *after-linter
515565 - platforms-build :
516566 << : *after-build-and-test
517567 << : *on-master-version-tags-and-dockertests
@@ -530,6 +580,9 @@ workflows:
530580 context : common
531581 << : *on-dev-branches
532582 << : *after-linter
583+ - valgrind-general-for-forked-prs :
584+ << : *on-any-branch
585+ << : *after-linter
533586 - valgrind :
534587 name : valgrind-cluster
535588 test_args : GEN=0 AOF=0
@@ -540,9 +593,6 @@ workflows:
540593 test_args : GEN=0 CLUSTER=0
541594 << : *on-integ-branch
542595 << : *after-linter
543- - build-and-test-gpu :
544- << : *on-integ-branch
545- << : *after-linter
546596 - deploy-snapshot :
547597 context : common
548598 << : *after-platform-builds
0 commit comments