@@ -20,6 +20,10 @@ aliases:
2020 name : Login to DockerHub
2121 command : echo "$DOCKER_HUB_PASS" | docker login -u "$DOCKER_HUB_USER" --password-stdin
2222
23+ - &count_cpus
24+ run :
25+ name : Count the number of available cpu cores
26+ command : echo "export NB_CPUS=$(cat /proc/cpuinfo | grep processor | wc -l)" >> $BASH_ENV
2327# Configuration file anchors
2428generate-version-file : &generate-version-file
2529 run :
@@ -308,6 +312,7 @@ jobs:
308312 - restore_cache :
309313 keys :
310314 - v4-back-dependencies-{{ .Revision }}
315+ - *count_cpus
311316 - run :
312317 name : Lint code with isort
313318 command : ~/.local/bin/isort --check-only marsha
@@ -319,7 +324,7 @@ jobs:
319324 command : ~/.local/bin/flake8 marsha
320325 - run :
321326 name : Lint code with pylint
322- command : ~/.local/bin/pylint -j 4 --rcfile=pylintrc marsha
327+ command : ~/.local/bin/pylint -j "${NB_CPUS}" --rcfile=pylintrc marsha
323328 - run :
324329 name : Lint code with bandit
325330 command : ~/.local/bin/bandit -c .bandit -qr marsha
@@ -532,24 +537,25 @@ jobs:
532537 - restore_cache :
533538 keys :
534539 - front-dependencies-<< pipeline.parameters.cache-version >>-{{ checksum "yarn.lock" }}
540+ - *count_cpus
535541 - run :
536542 name : Run tests on libs-components
537- command : yarn workspace lib-components run test -w 3 --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
543+ command : yarn workspace lib-components run test -w "${NB_CPUS}" --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
538544 - run :
539545 name : Run tests on lib-classroom
540- command : yarn workspace lib-classroom run test -w 3 --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
546+ command : yarn workspace lib-classroom run test -w "${NB_CPUS}" --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
541547 - run :
542548 name : Run tests on lib-video
543- command : yarn workspace lib-video run test -w 3 --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
549+ command : yarn workspace lib-video run test -w "${NB_CPUS}" --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
544550 - run :
545551 name : Run tests on lib-markdown
546- command : yarn workspace lib-markdown run test -w 3 --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
552+ command : yarn workspace lib-markdown run test -w "${NB_CPUS}" --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
547553 - run :
548554 name : Run tests on lti site
549- command : yarn workspace marsha run test -w 3 --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
555+ command : yarn workspace marsha run test -w "${NB_CPUS}" --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
550556 - run :
551557 name : Run tests on standalone site
552- command : yarn workspace standalone_site run test -w 3 --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
558+ command : yarn workspace standalone_site run test -w "${NB_CPUS}" --shard "$(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL"
553559 - store_artifacts :
554560 path : ~/marsha/src/frontend/apps/lti_site/__diff_output__
555561 - store_artifacts :
0 commit comments