|
| 1 | +name: Build and test iOS Sample App on Browserstack |
| 2 | +on: pull_request |
| 3 | + |
| 4 | +jobs: |
| 5 | + run-ios-browserstack: |
| 6 | + runs-on: macos-latest |
| 7 | + |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@v2 |
| 10 | + |
| 11 | + - name: fastlane build swift-sample-app |
| 12 | + run: fastlane build_for_browserstack |
| 13 | + |
| 14 | + - name: upload swift-sample-app .ipa to browserstack |
| 15 | + id: upload_ipa |
| 16 | + uses: fjogeleit/http-request-action@v1 |
| 17 | + with: |
| 18 | + url: "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/app" |
| 19 | + method: "POST" |
| 20 | + username: "justinyu_cIqvyB" |
| 21 | + password: "TszLVeLKEjzwXpVUSB48" |
| 22 | + files: '{ "file": ${{ github.workspace }}/build-swift-sample-app/swift-sample-app.ipa", "custom_id": "swift-sample-app" }' |
| 23 | + |
| 24 | + - name: get browserstack app_url |
| 25 | + id: get_app_url |
| 26 | + run: | |
| 27 | + bs_app_url=${{ fromJson(steps.upload_ipa.outputs.response).app_url }} |
| 28 | + echo "::set-output name=app_url::$bs_app_url" |
| 29 | +
|
| 30 | + - name: upload test suite .zip to browserstack |
| 31 | + id: upload_test_zip |
| 32 | + uses: fjogeleit/http-request-action@v1 |
| 33 | + with: |
| 34 | + url: "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/test-suite" |
| 35 | + method: "POST" |
| 36 | + username: "justinyu_cIqvyB" |
| 37 | + password: "TszLVeLKEjzwXpVUSB48" |
| 38 | + files: '{ "file": ${{ github.workspace }}/build-swift-sample-app/swift-sample-app-ui-test.zip", "custom_id": "swift-sample-app-ui-test" }' |
| 39 | + |
| 40 | + - name: get browserstack test_suite_url |
| 41 | + id: get_test_suite_url |
| 42 | + run: | |
| 43 | + bs_test_suite_url=${{ fromJson(steps.upload_test_zip.outputs.response).test_suite_url }} |
| 44 | + echo "::set-output name=test_suite_url::$bs_test_suite_url" |
| 45 | +
|
| 46 | + - name: execute test suite on browserstack |
| 47 | + uses: fjogeleit/http-request-action@v1 |
| 48 | + with: |
| 49 | + url: "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/build" |
| 50 | + method: "POST" |
| 51 | + username: "justinyu_cIqvyB" |
| 52 | + password: "TszLVeLKEjzwXpVUSB48" |
| 53 | + data: "${{ steps.get_app_url.app_url }},${{ steps.get_test_suite_url.test_suite_url }}" |
| 54 | + file: "${{ github.workspace }}/build-swift-sample-app/swift-sample-app-ui-test.zip" |
| 55 | + customHeaders: '{"Content-Type": "application/json"}' |
0 commit comments