diff --git a/.circleci/config.yml b/.circleci/config.yml index 236eabffa..3c1695d23 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,17 +11,30 @@ jobs: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: root resource_class: large + parallelism: 4 parameters: plugin: type: string steps: - checkout + - run: mkdir ~/junit - run: echo $'\n[mysqld]\ncharacter_set_server=utf8mb4\nmax_connections=10000' >> /etc/mysql/mysql.cnf - run: apt-get update && apt-get -y -q install postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5 sudo - run: echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.conf - run: echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf - run: sed -i 's/^#*\s*max_connections\s*=.*/max_connections = 10000/' /etc/postgresql/9.5/main/postgresql.conf - run: (cd .circleci/ && ./doTests.sh << parameters.plugin >>) + - run: + command: cp ~/supertokens-root/supertokens-core/build/test-results/test/*.xml ~/junit/ + when: always + - when: + condition: + not: + equal: [ << parameters.plugin >>, "sqlite" ] + steps: + - run: cp ~/supertokens-root/supertokens-<< parameters.plugin >>-plugin/build/test-results/test/*.xml ~/junit/ + - store_test_results: + path: ~/junit - slack/status mark-passed: @@ -45,7 +58,7 @@ workflows: tags: only: /dev-v[0-9]+(\.[0-9]+)*/ branches: - ignore: /.*/ + only: /test-cicd\/.*/ - test: plugin: mongodb name: test-mongodb @@ -55,7 +68,7 @@ workflows: tags: only: /dev-v[0-9]+(\.[0-9]+)*/ branches: - ignore: /.*/ + only: /test-cicd\/.*/ - test: plugin: postgresql name: test-postgresql @@ -65,7 +78,7 @@ workflows: tags: only: /dev-v[0-9]+(\.[0-9]+)*/ branches: - ignore: /.*/ + only: /test-cicd\/.*/ - test: plugin: mysql name: test-mysql @@ -75,7 +88,7 @@ workflows: tags: only: /dev-v[0-9]+(\.[0-9]+)*/ branches: - ignore: /.*/ + only: /test-cicd\/.*/ - mark-passed: context: - slack-notification diff --git a/.circleci/doTests.sh b/.circleci/doTests.sh index 3fb117cc5..dba0669be 100755 --- a/.circleci/doTests.sh +++ b/.circleci/doTests.sh @@ -162,6 +162,24 @@ do fi cd ../ echo $SUPERTOKENS_API_KEY > apiPassword + + # Get list of classnames of tests that should run on this node. + circleci tests glob "supertokens-*/src/test/**/*Test.java" | cut -c 1- | sed 's@/@.@g' | sed 's/.\{5\}$//' | + circleci tests run --command=">classnames.txt xargs echo" --verbose --split-by=timings --timings-type=classname + + echo "!!!!! CLASSNAMES" + cat classnames.txt + echo "----- CLASSNAMES" + + + #if this is a re-run and it is a parallel run that does not have tests to run, halt execution of this parallel run + [ -s classnames.txt ] || circleci-agent step halt + + GRADLE_ARGS=$(cat src/test/java/classnames.txt | awk '{for (i=1; i<=NF; i++) print "--tests",$i}') + echo "Prepared arguments for Gradle: $GRADLE_ARGS" + + # TODO: remove before merging, this is here to make testing the scripts quicker + sed -i -e "s/\.\/gradlew test/\.\/gradlew --tests \*Config\*/" startTestEnv ./startTestingEnv --cicd if [[ $? -ne 0 ]]