Run UI Tests and publish nightly build #911
This file contains hidden or 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: Run UI Tests and publish nightly build | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| appiumTestsBranch: | |
| description: The branch to run from mobile-appium-tests | |
| required: true | |
| default: develop | |
| type: string | |
| testType: | |
| description: The type of test run, one of [MOCKED|E2E] | |
| required: false | |
| type: string | |
| schedule: | |
| - cron: '0 21 * 4-10 1-5' | |
| - cron: '0 22 * 11-12,1-3 1-5' | |
| push: | |
| branches: | |
| - 'release/**' | |
| jobs: | |
| build-and-upload-to-appetize: | |
| runs-on: macos-latest | |
| timeout-minutes: 20 | |
| name: "Build and upload app to Appetize" | |
| steps: | |
| - name: Cancel previous jobs | |
| uses: styfle/[email protected] | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Git - Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ github.ref }} | |
| - name: Upload preview to Appetize | |
| id: appetize-upload | |
| uses: ./.github/actions/appetize-build | |
| with: | |
| build_type: 'nightly' | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| ssh-private-key: ${{ secrets.SSH_KEY }} | |
| known-hosts: ${{ secrets.KNOWN_HOSTS }} | |
| match-password: ${{ secrets.MATCH_PASSWORD }} | |
| match-git-private-key: ${{ secrets.FASTLANE_PASSWORD }} | |
| fastlane-session: ${{ secrets.FASTLANE_SESSION }} | |
| fastlane-password: ${{ secrets.FASTLANE_PASSWORD }} | |
| match-keychain-name: ${{ secrets.MATCH_KEYCHAIN_NAME }} | |
| match-keychain-password: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} | |
| appetize-api-token: ${{ secrets.APPETIZE_API_TOKEN }} | |
| source-branch: ${{ github.head_ref || github.ref_name }} | |
| pr-number: "" | |
| slack-channel: ${{ secrets.SLACK_MOBILE_SDK_CHANNEL }} | |
| slack-reporter-token: ${{ secrets.SLACK_REPORTER_BOT_TOKEN }} | |
| github-run-id: ${{ github.run_id }} | |
| stripe-publishable-key: ${{ secrets.STRIPE_PUBLISHABLE_KEY }} | |
| build-and-upload-to-firebase-and-lambdatest: | |
| runs-on: macos-latest | |
| timeout-minutes: 20 | |
| name: "Distribute app to Firebase and LambdaTest" | |
| outputs: | |
| artifact-url: ${{ steps.save_app_artifact_step.outputs.artifact-url }} | |
| steps: | |
| - name: Cancel previous jobs | |
| uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Git - Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ github.ref }} | |
| - name: Select Xcode Version | |
| uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0 | |
| with: | |
| xcode-version: '16.3.0' | |
| - name: Install SSH key | |
| uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 #v2.7.0 | |
| with: | |
| key: ${{ secrets.SSH_KEY }} | |
| name: id_rsa_github_actions | |
| known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
| - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_KEY }} | |
| - uses: ruby/setup-ruby@4ff6f3611a42bc75eee1e5138240eb1613f48c8f # v1.266.0 | |
| with: | |
| ruby-version: "3.2" | |
| bundler-cache: true | |
| - name: Create Firebase Service Credentials file | |
| run: | | |
| echo "$FIREBASE_CREDENTIALS" > firebase_credentials.json.b64 | |
| base64 -d -i firebase_credentials.json.b64 > firebase_credentials.json | |
| env: | |
| FIREBASE_CREDENTIALS: ${{ secrets.FIREBASE_CREDENTIALS }} | |
| - name: Create secrets.defaults.properties | |
| shell: bash | |
| run: | | |
| echo "STRIPE_PUBLISHABLE_KEY=${{ secrets.STRIPE_PUBLISHABLE_KEY }}" > Debug\ App/secrets.defaults.properties | |
| - name: Distribute internally on Firebase and upload to LambdaTest 🚀 | |
| run: | | |
| bundle exec fastlane qa_release | |
| env: | |
| FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }} | |
| FIREBASE_COMMA_SEPARATED_TEST_GROUPS: ${{ 'primer-internal' }} | |
| MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
| MATCH_GIT_PRIVATE_KEY: ${{ secrets.SSH_KEY }} | |
| FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} | |
| FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }} | |
| MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} | |
| MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} | |
| APPETIZE_API_TOKEN: ${{ secrets.APPETIZE_API_TOKEN }} | |
| LAMBDATEST_USERNAME: ${{ secrets.LAMBDATEST_USERNAME }} | |
| LAMBDATEST_ACCESS_KEY: ${{ secrets.LAMBDATEST_ACCESS_KEY }} | |
| SOURCE_BRANCH: ${{ github.ref }} | |
| - name: Save LambdaTest ID | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 #v5.0.0 | |
| id: save_lambdatest_id_step | |
| with: | |
| name: lambdatest_id | |
| retention-days: 1 | |
| path: /var/tmp/lambdatest_id.txt | |
| - name: Save App Artifact | |
| id: save_app_artifact_step | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: app_artifact_id | |
| retention-days: 1 | |
| path: '/Users/runner/work/primer-sdk-ios/primer-sdk-ios/Debug App.ipa' | |
| if-no-files-found: error | |
| test-via-lambdatest: | |
| runs-on: ubuntu-latest | |
| needs: build-and-upload-to-firebase-and-lambdatest | |
| name: "LambdaTest test" | |
| if: ${{ inputs.testType == '' }} | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 1 | |
| matrix: | |
| test-type: | |
| - "MOCKED" | |
| - "E2E" | |
| steps: | |
| - name: Git - Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ github.ref }} | |
| sparse-checkout: .github | |
| - name: Run UI Tests via LambdaTest [${{ inputs.testType }}] 🧪 | |
| id: ui-tests-test-via-lambdatest | |
| uses: ./.github/actions/ui-tests | |
| with: | |
| appium-tests-branch: ${{ inputs.appiumTestsBranch }} | |
| test-type: ${{ matrix.test-type }} | |
| gitlab-appium-pull-key: ${{ secrets.GITLAB_APPIUM_PULL_KEY }} | |
| lambdatest-user-name: ${{ secrets.LAMBDATEST_USERNAME }} | |
| lambdatest-access-key: ${{ secrets.LAMBDATEST_ACCESS_KEY }} | |
| slack-mobile-sdk-channel: ${{ secrets.SLACK_MOBILE_SDK_CHANNEL }} | |
| slack-reporter-bot-token: ${{ secrets.SLACK_REPORTER_BOT_TOKEN }} | |
| ui-tests-secrets-api-key: ${{ secrets.UI_TESTS_SECRETS_API_KEY }} | |
| test-app-artifact-url: ${{ needs.build-and-upload-to-firebase-and-lambdatest.outputs.artifact-url }} | |
| test-via-lambdatest-manual: | |
| runs-on: ubuntu-latest | |
| needs: build-and-upload-to-firebase-and-lambdatest | |
| name: "LambdaTest test (manual)" | |
| if: ${{ inputs.testType != '' }} | |
| steps: | |
| - name: Git - Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ github.ref }} | |
| sparse-checkout: .github | |
| - name: Run UI Tests via LambdaTest [${{ inputs.testType }}] 🧪 | |
| id: ui-tests-test-via-lambdatest | |
| uses: ./.github/actions/ui-tests | |
| with: | |
| appium-tests-branch: ${{ inputs.appiumTestsBranch }} | |
| test-type: ${{ inputs.testType }} | |
| gitlab-appium-pull-key: ${{ secrets.GITLAB_APPIUM_PULL_KEY }} | |
| lambdatest-user-name: ${{ secrets.LAMBDATEST_USERNAME }} | |
| lambdatest-access-key: ${{ secrets.LAMBDATEST_ACCESS_KEY }} | |
| slack-mobile-sdk-channel: ${{ secrets.SLACK_MOBILE_SDK_CHANNEL }} | |
| slack-reporter-bot-token: ${{ secrets.SLACK_REPORTER_BOT_TOKEN }} | |
| ui-tests-secrets-api-key: ${{ secrets.UI_TESTS_SECRETS_API_KEY }} | |
| test-app-artifact-url: ${{ needs.build-and-upload-to-firebase-and-lambdatest.outputs.artifact-url }} |