try running in parallel

This commit is contained in:
Ulf Gebhardt 2021-04-12 17:58:39 +02:00
parent e57ab0a9c6
commit 064a8baeaf
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
2 changed files with 25 additions and 2 deletions

View File

@ -278,6 +278,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 ##########################################################
@ -320,8 +325,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 #############################################
##########################################################################

19
cypress/parallel-features.sh Executable file
View File

@ -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}})