diff --git a/.circleci/config.yml b/.circleci/config.yml index dd6e92ea6..a64917621 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,7 @@ jobs: environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: root + parallelism: 4 resource_class: large steps: - checkout @@ -27,8 +28,3 @@ workflows: - test: context: - slack-notification - filters: - tags: - only: /dev-v[0-9]+(\.[0-9]+)*/ - branches: - ignore: /.*/ \ No newline at end of file diff --git a/.circleci/doTests.sh b/.circleci/doTests.sh index 535495458..80976c249 100755 --- a/.circleci/doTests.sh +++ b/.circleci/doTests.sh @@ -84,144 +84,150 @@ do currPinnedDb=$(echo "$pinnedDBArray" | jq ".[$i]") currPinnedDb=$(echo "$currPinnedDb" | tr -d '"') - echo "" - echo "" - echo "" - echo "" - echo "" - echo "===== testing $currPinnedDb with plugin-interface $currVersion =====" - echo "" - echo "" - echo "" - echo "" - echo "" - i=$((i+1)) - if [[ $currPinnedDb == "sqlite" ]] + if (( i % CIRCLE_NODE_TOTAL == CIRCLE_NODE_INDEX )) then - # shellcheck disable=SC2034 - continue=1 - else - response=$(curl -s -X GET \ - "https://api.supertokens.io/0/plugin-interface/dependency/plugin/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$piVersion&pluginName=$currPinnedDb" \ - -H 'api-version: 0') - if [[ $(echo "$response" | jq .plugin) == "null" ]] - then - echo "fetching latest X.Y version for $currPinnedDb given plugin-interface X.Y version: $piVersion gave response: $response" - exit 1 - fi - pinnedDbVersionX2=$(echo $response | jq .plugin | tr -d '"') - response=$(curl -s -X GET \ - "https://api.supertokens.io/0/plugin/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pinnedDbVersionX2&name=$currPinnedDb" \ - -H 'api-version: 0') - if [[ $(echo "$response" | jq .tag) == "null" ]] + echo "" + echo "" + echo "" + echo "" + echo "" + echo "===== testing $currPinnedDb with plugin-interface $currVersion =====" + echo "" + echo "" + echo "" + echo "" + echo "" + + if [[ $currPinnedDb == "sqlite" ]] then - echo "fetching latest X.Y.Z version for $currPinnedDb, X.Y version: $pinnedDbVersionX2 gave response: $response" - exit 1 + # shellcheck disable=SC2034 + continue=1 + else + response=$(curl -s -X GET \ + "https://api.supertokens.io/0/plugin-interface/dependency/plugin/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$piVersion&pluginName=$currPinnedDb" \ + -H 'api-version: 0') + if [[ $(echo "$response" | jq .plugin) == "null" ]] + then + echo "fetching latest X.Y version for $currPinnedDb given plugin-interface X.Y version: $piVersion gave response: $response" + exit 1 + fi + pinnedDbVersionX2=$(echo $response | jq .plugin | tr -d '"') + + response=$(curl -s -X GET \ + "https://api.supertokens.io/0/plugin/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pinnedDbVersionX2&name=$currPinnedDb" \ + -H 'api-version: 0') + if [[ $(echo "$response" | jq .tag) == "null" ]] + then + echo "fetching latest X.Y.Z version for $currPinnedDb, X.Y version: $pinnedDbVersionX2 gave response: $response" + exit 1 + fi + pinnedDbVersionTag=$(echo "$response" | jq .tag | tr -d '"') + pinnedDbVersion=$(echo "$response" | jq .version | tr -d '"') + ./startDb.sh "$currPinnedDb" fi - pinnedDbVersionTag=$(echo "$response" | jq .tag | tr -d '"') - pinnedDbVersion=$(echo "$response" | jq .version | tr -d '"') - ./startDb.sh "$currPinnedDb" - fi - cd ../../ - git clone git@github.com:supertokens/supertokens-root.git - cd supertokens-root + cd ../../ + git clone git@github.com:supertokens/supertokens-root.git + cd supertokens-root - update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk-15.0.1/bin/java" 2 - update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk-15.0.1/bin/javac" 2 + update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk-15.0.1/bin/java" 2 + update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk-15.0.1/bin/javac" 2 - coreX=$(cut -d'.' -f1 <<<"$coreVersion") - coreY=$(cut -d'.' -f2 <<<"$coreVersion") - if [[ $currPinnedDb == "sqlite" ]] - then - echo -e "core,$coreX.$coreY\nplugin-interface,$piVersion" > modules.txt - else - echo -e "core,$coreX.$coreY\nplugin-interface,$piVersion\n$currPinnedDb-plugin,$pinnedDbVersionX2" > modules.txt - fi - ./loadModules - cd supertokens-core - git checkout dev-v$coreVersion - cd ../supertokens-plugin-interface - git checkout $currTag - if [[ $currPinnedDb == "sqlite" ]] - then - # shellcheck disable=SC2034 - continue=1 - else - cd ../supertokens-$currPinnedDb-plugin - git checkout $pinnedDbVersionTag - fi - cd ../ - echo $SUPERTOKENS_API_KEY > apiPassword - ./startTestingEnv --cicd - - if [[ $? -ne 0 ]] - then - echo "" - echo "" - echo "" - echo "" - echo "" - echo "===== testing $currPinnedDb with plugin-interface $currVersion FAILED =====" - echo "" - echo "" - echo "" - echo "" - echo "" - - cat logs/* - cd ../project/ - echo "test failed... exiting!" - exit 1 - fi + coreX=$(cut -d'.' -f1 <<<"$coreVersion") + coreY=$(cut -d'.' -f2 <<<"$coreVersion") + if [[ $currPinnedDb == "sqlite" ]] + then + echo -e "core,$coreX.$coreY\nplugin-interface,$piVersion" > modules.txt + else + echo -e "core,$coreX.$coreY\nplugin-interface,$piVersion\n$currPinnedDb-plugin,$pinnedDbVersionX2" > modules.txt + fi + ./loadModules + cd supertokens-core + git checkout dev-v$coreVersion + cd ../supertokens-plugin-interface + git checkout $currTag + if [[ $currPinnedDb == "sqlite" ]] + then + # shellcheck disable=SC2034 + continue=1 + else + cd ../supertokens-$currPinnedDb-plugin + git checkout $pinnedDbVersionTag + fi + cd ../ + echo $SUPERTOKENS_API_KEY > apiPassword + ./startTestingEnv --cicd - echo "" - echo "" - echo "" - echo "" - echo "" - echo "===== testing $currPinnedDb with plugin-interface $currVersion SUCCEEDED =====" - echo "" - echo "" - echo "" - echo "" - echo "" - - cd ../ - rm -rf supertokens-root - - if [[ $currPinnedDb == "sqlite" ]] - then - # shellcheck disable=SC2034 - continue=1 - else - curl -o supertokens.zip -s -X GET \ - "https://api.supertokens.io/0/app/download?pluginName=$currPinnedDb&os=linux&mode=DEV&binary=FREE&targetCore=$coreVersion&targetPlugin=$pinnedDbVersion" \ - -H 'api-version: 0' - unzip supertokens.zip -d . - rm supertokens.zip - cd supertokens - ../project/.circleci/testCli.sh if [[ $? -ne 0 ]] then - echo "cli testing failed... exiting!" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "===== testing $currPinnedDb with plugin-interface $currVersion FAILED =====" + echo "" + echo "" + echo "" + echo "" + echo "" + + cat logs/* + cd ../project/ + echo "test failed... exiting!" exit 1 fi + + echo "" + echo "" + echo "" + echo "" + echo "" + echo "===== testing $currPinnedDb with plugin-interface $currVersion SUCCEEDED =====" + echo "" + echo "" + echo "" + echo "" + echo "" + cd ../ - fi + rm -rf supertokens-root + + if [[ $currPinnedDb == "sqlite" ]] + then + # shellcheck disable=SC2034 + continue=1 + else + curl -o supertokens.zip -s -X GET \ + "https://api.supertokens.io/0/app/download?pluginName=$currPinnedDb&os=linux&mode=DEV&binary=FREE&targetCore=$coreVersion&targetPlugin=$pinnedDbVersion" \ + -H 'api-version: 0' + unzip supertokens.zip -d . + rm supertokens.zip + cd supertokens + ../project/.circleci/testCli.sh + if [[ $? -ne 0 ]] + then + echo "cli testing failed... exiting!" + exit 1 + fi + cd ../ + fi + + rm -rf supertokens + cd project/.circleci + if [[ $currPinnedDb == "sqlite" ]] + then + # shellcheck disable=SC2034 + continue=1 + else + ./stopDb.sh $currPinnedDb + fi - rm -rf supertokens - cd project/.circleci - if [[ $currPinnedDb == "sqlite" ]] - then - # shellcheck disable=SC2034 - continue=1 - else - ./stopDb.sh $currPinnedDb fi + done done 10