fix CI #609
This file contains 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
name: appium-automation | |
on: | |
workflow_dispatch: | |
push: | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
env: | |
ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} | |
SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} | |
BROWSERSTACK_USER: ${{ secrets.BROWSER_STACK_USER }} | |
BROWSERSTACK_KEY: ${{ secrets.BROWSER_STACK_KEY }} | |
JAVA_DISTRIBUTION: 'corretto' | |
JAVA_VERSION: '17' | |
JAVA_VERSION_AUTOMATION: '11' | |
jobs: | |
appium-automation-tests: | |
name: appium-automation-tests | |
runs-on: macos-latest | |
steps: | |
- name: Checkout SDK repo with testbed app | |
uses: actions/checkout@v3 | |
with: | |
path: sdk | |
ref: ${{ github.ref }} | |
# point to automation master branch by default | |
- name: Checkout Master SDK repo with testbed app for Reinstallation tests | |
uses: actions/checkout@v3 | |
if: ${{ !( github.ref == 'refs/heads/master')}} | |
with: | |
path: previousVersionSDK | |
ref: master | |
- name: Checkout qa automation | |
uses: actions/checkout@v3 | |
with: | |
path: qa | |
repository: BranchMetrics/qentelli-saas-sdk-testing-automation | |
token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }} | |
# repo's gradle is configured to run on java 17 | |
- name: Setup java for gradle | |
uses: actions/setup-java@v3 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
# to reduce complexity, testbed app uses sdk as a project reference | |
- name: Decode Keystore | |
env: | |
ENCODED_STRING: ${{ secrets.KEYSTORE }} | |
run: | | |
cd sdk | |
echo $ENCODED_STRING | base64 -d > ./Branch-SDK-Automation-TestBed/automationSigningKeys.jks | |
- name: Decode Keystore for Reinstallation | |
if: ${{ !( github.ref == 'refs/heads/master')}} | |
env: | |
ENCODED_STRING: ${{ secrets.KEYSTORE }} | |
run: | | |
cd previousVersionSDK | |
echo $ENCODED_STRING | base64 -d > ./Branch-SDK-Automation-TestBed/automationSigningKeys.jks | |
- name: Build testbed app and Link Click Test App | |
run: | | |
cd sdk | |
./gradlew Branch-SDK-Automation-TestBed:assembleDebug | |
./gradlew branchsdk-link-clicktest:assembleDebug | |
env: | |
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
- name: Build Master testbed app for Reinstallation tests | |
if: ${{ !( github.ref == 'refs/heads/master')}} | |
run: | | |
cd previousVersionSDK | |
./gradlew Branch-SDK-Automation-TestBed:assembleDebug | |
env: | |
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
- name: Upload APK to BrowserStack | |
run: | | |
response=$(curl -X POST https://api-cloud.browserstack.com/app-automate/upload -u "${{ secrets.BROWSER_STACK_USER }}:${{ secrets.BROWSER_STACK_KEY }}" -F "file=@sdk/Branch-SDK-Automation-TestBed/build/outputs/apk/debug/Branch-SDK-Automation-TestBed-debug.apk") | |
parsed=$(echo $response | jq -r ".app_url") | |
echo "::add-mask::$parsed" | |
echo "BrowserStackAndroidNewBuildKey=$parsed" >> "$GITHUB_ENV" | |
- name: Upload Link Click Test App APK to BrowserStack | |
run: | | |
response=$(curl -X POST https://api-cloud.browserstack.com/app-automate/upload -u "${{ secrets.BROWSER_STACK_USER }}:${{ secrets.BROWSER_STACK_KEY }}" -F "file=@sdk/branchsdk-link-clicktest/build/outputs/apk/debug/branchsdk-link-clicktest-debug.apk") | |
parsed=$(echo $response | jq -r ".app_url") | |
echo "::add-mask::$parsed" | |
echo "BrowserStackLinkClickAppURL=$parsed" >> "$GITHUB_ENV" | |
- name: Upload APK from Master branch to BrowserStack for Reinstallation tests | |
if: ${{ !( github.ref == 'refs/heads/master')}} | |
run: | | |
response=$(curl -X POST https://api-cloud.browserstack.com/app-automate/upload -u "${{ secrets.BROWSER_STACK_USER }}:${{ secrets.BROWSER_STACK_KEY }}" -F "file=@previousVersionSDK/Branch-SDK-Automation-TestBed/build/outputs/apk/debug/Branch-SDK-Automation-TestBed-debug.apk") | |
parsed=$(echo $response | jq -r ".app_url") | |
echo "::add-mask::$parsed" | |
echo "BrowserStackAndroidOldBuildKey=$parsed" >> "$GITHUB_ENV" | |
# automation is compatible with java 11 | |
- name: Setup java for automation | |
uses: actions/setup-java@v3 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION_AUTOMATION }} | |
- name: Execute automation | |
run: | | |
cd qa | |
mvn clean test -DsuiteXMLFile=testng.xml -e -DInputFormat="json" -DInputFilePath="TestSelection_BrowserStack_Android.json" -DUploadNewBuild="Yes" | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: | | |
qa/Results |