diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 79afb81da..8949aa1dc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -247,6 +247,11 @@ jobs: name: Fullstack tests runs-on: ubuntu-latest needs: [build_test_webapp, build_test_backend, build_test_neo4j] + strategy: + matrix: + # run copies of the current job in parallel + jobs: 5 + job: [0, 1, 2, 3, 4] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -289,8 +294,7 @@ jobs: - name: cypress | Fullstack tests run: | yarn install - yarn run cypress:run - + yarn run cypress:run --spec $(cypress/parallel-features.sh ${{ matrix.job }} ${{ matrix.jobs }}) ########################################################################## # UPLOAD SCREENSHOTS & VIDEO ############################################# ########################################################################## diff --git a/cypress/parallel-features.sh b/cypress/parallel-features.sh new file mode 100755 index 000000000..a234b1d0e --- /dev/null +++ b/cypress/parallel-features.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Functions +function join_by { local IFS="$1"; shift; echo "$*"; } + +# Arguments: +CUR_JOB=$1 +MAX_JOBS=$2 + +# Features +FEATURE_LIST=( $(find cypress/integration/ -maxdepth 1 -name "*.feature") ) + +# Calculation +MAX_FEATURES=$(find cypress/integration/ -maxdepth 1 -name "*.feature" -printf '.' | wc -m) +FEATURES_PER_JOB=$(expr $(expr ${MAX_FEATURES} + ${MAX_JOBS} - 1) / ${MAX_JOBS} ) +FEATURES_SKIP=$(expr $(expr ${CUR_JOB} - 1 ) \* ${FEATURES_PER_JOB} ) + +# Comma separated list +echo $(join_by , ${FEATURE_LIST[@]:${FEATURES_SKIP}:${FEATURES_PER_JOB}}) \ No newline at end of file