Skip to content

Run UI Tests and publish nightly build #494

Run UI Tests and publish nightly build

Run UI Tests and publish nightly build #494

Workflow file for this run

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-13
timeout-minutes: 20
name: "Build and upload app to Appetize"
steps:
- name: Cancel previous jobs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Git - Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
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-browserstack:
runs-on: macos-13
timeout-minutes: 20
name: "Distribute app to Firebase and Browserstack"
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.ref }}
- name: Select Xcode Version
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: '15.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@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
- uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # v1.202.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 Browserstack 🚀
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 }}
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
SOURCE_BRANCH: ${{ github.ref }}
- name: Save Browserstack ID
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
id: save_browserstack_id_step
with:
name: browserstack_id
path: /var/tmp/browserstack_id.txt
if-no-files-found: error
test-via-browserstack:
runs-on: ubuntu-latest
needs: build-and-upload-to-firebase-and-browserstack
name: "Browserstack test"
if: ${{ inputs.testType == '' }}
strategy:
max-parallel: 1
matrix:
test-type:
- "MOCKED"
- "E2E"
steps:
- name: Git - Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.ref }}
sparse-checkout: .github
- name: Run UI Tests via Browserstack 🧪
id: ui-tests-test-via-browserstack
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 }}
browserstack-user-name: ${{ secrets.BROWSERSTACK_USERNAME }}
browserstack-access-key: ${{ secrets.BROWSERSTACK_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-via-browserstack-manual:
runs-on: ubuntu-latest
needs: build-and-upload-to-firebase-and-browserstack
name: "Browserstack test (manual)"
if: ${{ inputs.testType != '' }}
steps:
- name: Git - Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.ref }}
sparse-checkout: .github
- name: Run UI Tests via Browserstack [${{ inputs.testType }}] 🧪
id: ui-tests-test-via-browserstack
uses: ./.github/actions/ui-tests
with:
appium-tests-branch: ${{ inputs.appiumTestsBranch }}
test-type: ${{ inputs.testType }}
gitlab-appium-pull-key: ${{ secrets.GITLAB_APPIUM_PULL_KEY }}
browserstack-user-name: ${{ secrets.BROWSERSTACK_USERNAME }}
browserstack-access-key: ${{ secrets.BROWSERSTACK_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 }}