Skip to content

Commit

Permalink
ci: try automatically re-running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Oct 28, 2024
1 parent 8944bfd commit edcffc0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -45,7 +58,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test-cicd\/.*/
- test:
plugin: mongodb
name: test-mongodb
Expand All @@ -55,7 +68,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test-cicd\/.*/
- test:
plugin: postgresql
name: test-postgresql
Expand All @@ -65,7 +78,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test-cicd\/.*/
- test:
plugin: mysql
name: test-mysql
Expand All @@ -75,7 +88,7 @@ workflows:
tags:
only: /dev-v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
only: /test-cicd\/.*/
- mark-passed:
context:
- slack-notification
Expand Down
18 changes: 18 additions & 0 deletions .circleci/doTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]]
Expand Down

0 comments on commit edcffc0

Please sign in to comment.