Last active
October 27, 2020 18:04
-
-
Save janakamarasena/d84e5383805a352cd186121f2f491435 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash +x | |
| wget https://raw.githubusercontent.com/mevan-karu/pom_version_property_finder/master/src/version_property_finder.py | |
| wget https://gist.githubusercontent.com/janakamarasena/d84e5383805a352cd186121f2f491435/raw/fed8a22868e1f346495be849bb75982b5e95ca9f/testng.xml | |
| echo "" | |
| echo "==========================================================" | |
| PR_LINK=${PR_LINK%/} | |
| echo " PR_LINK: $PR_LINK" | |
| echo "::warning::Build ran for PR $PR_LINK" | |
| USER=$(echo $PR_LINK | awk -F'/' '{print $4}') | |
| REPO=$(echo $PR_LINK | awk -F'/' '{print $5}') | |
| PULL_NUMBER=$(echo $PR_LINK | awk -F'/' '{print $7}') | |
| echo " USER: $USER" | |
| echo " REPO: $REPO" | |
| echo " PULL_NUMBER: $PULL_NUMBER" | |
| echo "::set-output name=REPO_NAME::$REPO" | |
| echo "==========================================================" | |
| echo "Cloning product-is" | |
| echo "==========================================================" | |
| git clone https://github.com/wso2/product-is | |
| echo "" | |
| echo "PR is for the dependency repository $REPO." | |
| echo "" | |
| echo "Cloning $USER/$REPO" | |
| echo "==========================================================" | |
| git clone https://github.com/$USER/$REPO | |
| echo "" | |
| echo "Determining dependency version property key..." | |
| echo "==========================================================" | |
| VERSION_PROPERTY=$(python version_property_finder.py $REPO product-is 2>&1) | |
| VERSION_PROPERTY_KEY="" | |
| if [ "$VERSION_PROPERTY" != "invalid" ]; then | |
| echo "Version property key for the $REPO is $VERSION_PROPERTY" | |
| VERSION_PROPERTY_KEY=$VERSION_PROPERTY | |
| else | |
| echo "" | |
| echo "==========================================================" | |
| echo "$REPO is not yet supported! Exiting..." | |
| echo "==========================================================" | |
| echo "" | |
| echo "::error::PR builder not supprted" | |
| exit 1 | |
| fi | |
| echo "" | |
| echo "Property key found: $VERSION_PROPERTY_KEY" | |
| cd $REPO | |
| DEPENDENCY_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) | |
| echo "Dependency Version: $DEPENDENCY_VERSION" | |
| echo "" | |
| echo "Applying PR $PULL_NUMBER as a diff..." | |
| echo "==========================================================" | |
| wget -q --output-document=diff.diff $PR_LINK.diff | |
| cat diff.diff | |
| echo "==========================================================" | |
| git apply diff.diff || { | |
| echo 'Applying diff failed. Exiting...' | |
| echo "::error::Applying diff failed." | |
| exit 1 | |
| } | |
| echo "" | |
| echo "Building dependency repo $REPO..." | |
| echo "==========================================================" | |
| mvn clean install -Dmaven.test.skip=true --batch-mode | tee mvn-build.log | |
| echo "" | |
| echo "Dependency repo $REPO build complete." | |
| echo "Built version: $DEPENDENCY_VERSION" | |
| echo "==========================================================" | |
| echo "" | |
| REPO_BUILD_STATUS=$(cat mvn-build.log | grep "\[INFO\] BUILD" | grep -oE '[^ ]+$') | |
| REPO_TEST_RESULT_1=$(sed -n -e '/Results :/,/Tests run:/ p' mvn-build.log) | |
| REPO_TEST_RESULT_2=$(sed -n -e '/\[INFO\] Results:/,/\[INFO\] Tests run:/ p' mvn-build.log) | |
| REPO_FINAL_RESULT=$( | |
| echo "===========================================================" | |
| echo "$REPO BUILD $REPO_BUILD_STATUS" | |
| echo "==========================================================" | |
| echo "" | |
| echo "Built version: $DEPENDENCY_VERSION" | |
| echo "" | |
| echo "$REPO_TEST_RESULT_1" | |
| echo "" | |
| echo "$REPO_TEST_RESULT_2" | |
| ) | |
| REPO_BUILD_RESULT_LOG_TEMP=$(echo "$REPO_FINAL_RESULT" | sed 's/$/%0A/') | |
| REPO_BUILD_RESULT_LOG=$(echo $REPO_BUILD_RESULT_LOG_TEMP) | |
| echo "::warning::$REPO_BUILD_RESULT_LOG" | |
| if [ "$REPO_BUILD_STATUS" != "SUCCESS" ]; then | |
| echo "$REPO BUILD not successfull. Aborting." | |
| echo "::error::$REPO BUILD not successfull. Check artifacts for logs." | |
| exit 1 | |
| fi | |
| cd ../ | |
| rm product-is/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml | |
| cp testng.xml product-is/modules/integration/tests-integration/tests-backend/src/test/resources/ | |
| cat product-is/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml | |
| cd product-is | |
| echo "Updating dependency version in product-is..." | |
| echo "==========================================================" | |
| echo "" | |
| sed -i "s/<$VERSION_PROPERTY_KEY>.*<\/$VERSION_PROPERTY_KEY>/<$VERSION_PROPERTY_KEY>$DEPENDENCY_VERSION<\/$VERSION_PROPERTY_KEY>/" pom.xml | |
| cat pom.xml | |
| mvn clean install --batch-mode | tee mvn-build.log | |
| PR_BUILD_STATUS=$(cat mvn-build.log | grep "\[INFO\] BUILD" | grep -oE '[^ ]+$') | |
| PR_TEST_RESULT=$(sed -n -e '/\[INFO\] Results:/,/\[INFO\] Tests run:/ p' mvn-build.log) | |
| PR_BUILD_FINAL_RESULT=$( | |
| echo "===========================================================" | |
| echo "product-is BUILD $PR_BUILD_STATUS" | |
| echo "==========================================================" | |
| echo "" | |
| echo "$PR_TEST_RESULT" | |
| ) | |
| PR_BUILD_RESULT_LOG_TEMP=$(echo "$PR_BUILD_FINAL_RESULT" | sed 's/$/%0A/') | |
| PR_BUILD_RESULT_LOG=$(echo $PR_BUILD_RESULT_LOG_TEMP) | |
| echo "::warning::$PR_BUILD_RESULT_LOG" | |
| if [ "$PR_BUILD_STATUS" != "SUCCESS" ]; then | |
| echo "PR BUILD not successfull. Aborting." | |
| echo "::error::PR BUILD not successfull. Check artifacts for logs." | |
| exit 1 | |
| fi | |
| echo "" | |
| echo "==========================================================" | |
| echo "Build completed" | |
| echo "==========================================================" | |
| echo "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash +x | |
| # PR_LINK=https://github.com/wso2-extensions/identity-inbound-provisioning-scim2/pull/297 | |
| echo "" | |
| echo "==========================================================" | |
| echo "Building with params:" | |
| echo " PR_LINK: $PR_LINK" | |
| echo " APPROVE_PR_IF_BUILD_SUCCESS: $APPROVE_PR_IF_BUILD_SUCCESS" | |
| echo " REQUEST_CHANGES_IF_BUILD_FAILURE: $REQUEST_CHANGES_IF_BUILD_FAILURE" | |
| USER=$(echo $PR_LINK | awk -F'/' '{print $4}') | |
| REPO=$(echo $PR_LINK | awk -F'/' '{print $5}') | |
| PULL_NUMBER=$(echo $PR_LINK | awk -F'/' '{print $7}') | |
| INTERNAL_ERROR=false | |
| echo " USER: $USER" | |
| echo " REPO: $REPO" | |
| echo " PULL_NUMBER: $PULL_NUMBER" | |
| echo "==========================================================" | |
| ######################### | |
| # START ## | |
| #1st run build with diff if success then run PR build | |
| ########################## | |
| echo "Cloning product-is" | |
| echo "==========================================================" | |
| #git clone https://github.com/wso2/product-is | |
| echo "" | |
| echo "PR is for the dependency repository $REPO." | |
| echo "" | |
| echo "Cloning $USER/$REPO" | |
| echo "==========================================================" | |
| git clone https://github.com/$USER/$REPO | |
| cd $REPO | |
| echo "" | |
| echo "Building dependency repo $REPO..." | |
| echo "==========================================================" | |
| mvn clean install --batch-mode | tee mvn-run.log | |
| BUILD_STATUS=$(cat mvn-run.log | grep "\[INFO\] BUILD" | grep -oE '[^ ]+$') | |
| TEST_RESULT=$(sed -n -e '/Results :/,/Tests run:/ p' mvn-run.log) | |
| echo "" | |
| echo "==========================================================" | |
| echo "BUILD_STATUS" "$BUILD_STATUS" | |
| echo "==========================================================" | |
| echo "" | |
| if [ "$BUILD_STATUS" != "SUCCESS" ]; then | |
| echo "Damn it the build has failed" | |
| fi | |
| if [ "$BUILD_STATUS" == "SUCCESS" ]; then | |
| echo "hoorayyyyyy" | |
| fi | |
| echo "" | |
| echo "==========================================================" | |
| echo "TEST_RESULT" "$TEST_RESULT" | |
| echo "==========================================================" | |
| echo "" | |
| REPO_FINAL_RESULT=$( | |
| echo "==========================================================" | |
| echo "BUILD $BUILD_STATUS" | |
| echo "==========================================================" | |
| echo "$TEST_RESULT" | |
| ) | |
| REPO_BUILD_RESULT_LOG_TEMP=$(echo "$REPO_FINAL_RESULT" | sed 's/$/%0A/') | |
| REPO_BUILD_RESULT_LOG=$(echo $REPO_BUILD_RESULT_LOG_TEMP) | |
| echo "::warning::$REPO_BUILD_RESULT_LOG" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | |
| <suite name="Identity-suite-initializer" parallel="false" thread-count="1"> | |
| <parameter name="useDefaultListeners" value="false"/> | |
| <listeners> | |
| <listener class-name="org.wso2.carbon.automation.engine.testlisteners.TestExecutionListener"/> | |
| <listener class-name="org.wso2.carbon.automation.engine.testlisteners.TestManagerListener"/> | |
| <listener class-name="org.wso2.carbon.automation.engine.testlisteners.TestReportListener"/> | |
| <listener class-name="org.wso2.carbon.automation.engine.testlisteners.TestSuiteListener"/> | |
| <listener class-name="org.wso2.carbon.automation.engine.testlisteners.TestTransformerListener"/> | |
| <listener class-name="org.wso2.identity.integration.test.listeners.IdentityTestListener"/> | |
| </listeners> | |
| <test name="is-tests-initialize" preserve-order="true" parallel="false" group-by-instances="true"> | |
| <classes> | |
| <class name="org.wso2.identity.integration.test.IdentityServerTestSuitInitializerTestCase"/> | |
| <class name="org.wso2.identity.integration.test.base.TomcatInitializerTestCase"/> | |
| </classes> | |
| </test> | |
| <test name="is-tests-with-individual-configuration-changes" preserve-order="true" parallel="false" group-by-instances="true"> | |
| <classes> | |
| <class name="org.wso2.identity.integration.test.saml.RegistryMountTestCase"/> | |
| <class name="org.wso2.identity.integration.test.provisioning.DBSeperationTestCase"/> | |
| <class name="org.wso2.identity.integration.test.oauth2.OAuth2ServiceAuthCodeGrantTestCase"/> | |
| <class name="org.wso2.identity.integration.test.oidc.OIDCFileBasedSkipLoginConsentTestCase"/> | |
| <class name="org.wso2.identity.integration.test.scim.IDENTITY4776SCIMServiceWithOAuthTestCase" /> | |
| <class name="org.wso2.identity.integration.test.identity.mgt.UserInformationRecoveryServiceTenantEmailUserTestCase"/> | |
| <class name="org.wso2.identity.integration.test.oauth2.Oauth2HashAlgorithmTestCase"/> | |
| <class name="org.wso2.identity.integration.test.oauth2.Oauth2PersistenceProcessorInsertTokenTestCase"/> | |
| <class name="org.wso2.identity.integration.test.oauth2.Oauth2PersistenceProcessorTestCase"/> | |
| <class name="org.wso2.identity.integration.test.oauth2.OAuth2ServiceJWTGrantTestCase"/> | |
| <class name="org.wso2.identity.integration.test.oauth2.Oauth2TokenRenewalPerRequestTestCase"/> | |
| <class name="org.wso2.identity.integration.test.oidc.OIDCPasswordGrantTest"/> | |
| <!--<class name="org.wso2.identity.integration.test.saml.SAMLECPSSOTestCase"/>--> | |
| <class name="org.wso2.identity.integration.test.user.profile.mgt.UserProfileAdminTestCase"/> | |
| <!-- TODO this test has a restart--> | |
| <class name="org.wso2.identity.integration.test.auth.RiskBasedLoginTestCase" /> | |
| <class name="org.wso2.identity.integration.test.identity.mgt.AccountLockWhileCaseInsensitiveUserFalseTestCase"/> | |
| <class name="org.wso2.identity.integration.test.EmailOTPTestCase"/> | |
| </classes> | |
| </test> | |
| </suite> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment