Skip to content

Commit 5bc18f8

Browse files
authored
Merge pull request #1255 from BranchMetrics/SDK-1954-Move-Qentelli-Testbed-to-iOSSDK
Sdk 1954 - [iOS Automation] Move Qentelli Testbed app to iOS SDK
2 parents a502b1e + e9663c0 commit 5bc18f8

File tree

67 files changed

+7869
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+7869
-13
lines changed
Lines changed: 94 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,99 @@
1-
#on: [push]
1+
name: SaaS SDK Automation Tests
2+
23
on:
34
workflow_dispatch:
5+
pull_request:
46

57
jobs:
6-
build:
7-
runs-on: ubuntu-latest
8+
9+
# This job
10+
# 1.Installs Certificates and Provisioning profile for signing App and creating IPA.
11+
# 2.Creates Branch SDK framework for DeeplinkDemo app.
12+
# 3.Compiles DeepLinkDemo and creates its IPA.
13+
# 4.Uploads IPA to browserstack and app_url returned is set as envirnoment variable
14+
# 5.Runs SaaS SDK Automation tests on Browserstack
15+
# 6.Prints and uploads output result as an artifact.
16+
17+
build-and-run-automation-tests-onBrowserstack:
18+
runs-on: macos-latest
19+
env:
20+
ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
21+
SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
22+
BROWSERSTACK_KEY: ${{ secrets.BROWSER_STACK_KEY }}
23+
BROWSERSTACK_USER: ${{ secrets.BROWSER_STACK_USER }}
824
steps:
9-
- uses: actions/github-script@v6
10-
with:
11-
github-token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }}
12-
script: |
13-
await github.rest.actions.createWorkflowDispatch({
14-
owner: 'BranchMetrics',
15-
repo: 'qentelli-saas-sdk-testing-automation',
16-
workflow_id: 'ios-maven.yml',
17-
ref: 'master'
18-
})
25+
- name: Check out code
26+
uses: actions/checkout@v3
27+
- name: Install the Apple certificate and provisioning profile
28+
env:
29+
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
30+
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
31+
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
32+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
33+
run: |
34+
# create variables
35+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
36+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
37+
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
38+
39+
# import certificate
40+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
41+
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
42+
43+
# create temporary keychain
44+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
45+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
46+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
47+
48+
# import certificate to keychain
49+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
50+
security list-keychain -d user -s $KEYCHAIN_PATH
51+
52+
# apply provisioning profile
53+
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
54+
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
55+
56+
- name: Create and export DeepLinkDemo IPA file
57+
run: |
58+
./scripts/prep_static_xcframework.sh
59+
cd ./DeepLinkDemo
60+
mkdir Framework
61+
unzip ../Branch_static.zip -d ./Framework/
62+
pod install
63+
xcodebuild -workspace DeepLinkDemo.xcworkspace -scheme DeepLinkDemo -sdk iphoneos archive -archivePath ./IPA/DeepLinkDemo.xcarchive
64+
xcodebuild -exportArchive -archivePath ./IPA/DeepLinkDemo.xcarchive -exportOptionsPlist IPA/Info.plist -exportPath IPA/
65+
- name: Upload IPA to Browserstack
66+
run: |
67+
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")
68+
parsed=$(echo $response | jq ".app_url")
69+
echo "::add-mask::$parsed"
70+
echo "APP_URL=$parsed" >> "$GITHUB_ENV"
71+
- name: Cheout Automation Code
72+
uses: actions/checkout@v3
73+
with:
74+
repository: BranchMetrics/qentelli-saas-sdk-testing-automation
75+
token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }}
76+
- name: Set up JDK 11
77+
uses: actions/setup-java@v3
78+
with:
79+
java-version: '11'
80+
distribution: 'temurin'
81+
cache: maven
82+
- name: Setup Node.js environment
83+
uses: actions/[email protected]
84+
- name: Build with Maven
85+
id: build_maven
86+
run: |
87+
mvn clean test -DsuiteXMLFile=testng.xml -e -DInputFormat="json" -DInputFilePath="TestSelection_BrowserStack_iOS.json" --log-file output.txt
88+
- name: Print output
89+
if: always() # run this step even if previous step failed
90+
run: cat ${{ github.workspace }}/output.txt
91+
- name: Publishing test report
92+
if: always() # run this step even if previous step failed
93+
uses: actions/upload-artifact@v3 # upload test results
94+
with:
95+
name: test-results
96+
path: ${{ github.workspace }}/output.txt
97+
- name: Display test report S3 url
98+
if: success() || steps.build_maven.outcome == 'failure'
99+
run: grep 'Test report file link' output.txt

0 commit comments

Comments
 (0)