Skip to content

Release 3.6.1

Release 3.6.1 #430

name: SaaS SDK Automation Tests
on:
workflow_dispatch:
pull_request:
jobs:
# This job
# 1.Installs Certificates and Provisioning profile for signing App and creating IPA.
# 2.Creates Branch SDK framework for DeeplinkDemo app.
# 3.Compiles DeepLinkDemo and creates its IPA.
# 4.Uploads IPA to browserstack and app_url returned is set as envirnoment variable
# 5.Runs SaaS SDK Automation tests on Browserstack
# 6.Prints and uploads output result as an artifact.
build-and-run-automation-tests-onBrowserstack:
runs-on: macos-latest
env:
ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
BROWSERSTACK_KEY: ${{ secrets.BROWSER_STACK_KEY }}
BROWSERSTACK_USER: ${{ secrets.BROWSER_STACK_USER }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
# import certificate
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Create and export DeepLinkDemo IPA file
run: |
cd ./DeepLinkDemo
pod install
xcodebuild -workspace DeepLinkDemo.xcworkspace -scheme DeepLinkDemo -sdk iphoneos archive -archivePath ./IPA/DeepLinkDemo.xcarchive
xcodebuild -exportArchive -archivePath ./IPA/DeepLinkDemo.xcarchive -exportOptionsPlist IPA/Info.plist -exportPath IPA/
- name: Upload IPA 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=@DeepLinkDemo/IPA/DeepLinkDemo.ipa")
parsed=$(echo $response | jq ".app_url")
echo "::add-mask::$parsed"
echo "BrowserStackIOSBuildKey=$parsed" >> "$GITHUB_ENV"
- name: Cheout Automation Code
uses: actions/checkout@v4
with:
repository: BranchMetrics/qentelli-saas-sdk-testing-automation
token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }}
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Setup Node.js environment
uses: actions/[email protected]
- name: Build with Maven
id: build_maven
run: |
mvn clean test -DsuiteXMLFile=testng.xml -e -DInputFormat="json" -DInputFilePath="TestSelection_BrowserStack_iOS.json" --log-file output.txt
- name: Print output
if: always() # run this step even if previous step failed
run: cat ${{ github.workspace }}/output.txt
- name: Publishing test report
if: always() # run this step even if previous step failed
uses: actions/upload-artifact@v3 # upload test results
with:
name: test-results
path: ${{ github.workspace }}/output.txt
- name: Display test report S3 url
if: success() || steps.build_maven.outcome == 'failure'
run: grep 'Test report file link' output.txt