-
Notifications
You must be signed in to change notification settings - Fork 230
99 lines (90 loc) · 4.39 KB
/
automation-trigger-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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: |
./scripts/prep_static_xcframework.sh
cd ./DeepLinkDemo
mkdir Framework
unzip ../Branch_static.zip -d ./Framework/
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@v3
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