Skip to content

[create-pull-request] automated change #337

[create-pull-request] automated change

[create-pull-request] automated change #337

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
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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 }}
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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@78c01b705fd9d5ad960d432d3a0cfa341d50e410 # v1.179.1
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: 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@89ef406dd8d7e03cfd12d9e0a4a378f454709029 #v4.3.5
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"
steps:
- name: Clone and launch Browserstack tests via Appium 🧪
run: |
git clone -b ${{ inputs.appiumTestsBranch || 'develop' }} https://project_41483872_bot:$GITLAB_TEMP_PATH@gitlab.com/primer-io/acceptance/mobile/mobile-appium-tests.git .
git show --summary
env:
GITLAB_TEMP_PATH: ${{ secrets.GITLAB_APPIUM_PULL_KEY }}
- name: Retrieve Browserstack ID
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #v4.1.8
with:
name: browserstack_id
path: /var/tmp
- name: Setup node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 #v4.0.2
with:
node-version: 18.3.0
- name: npm Install
run: npm install
- run: npm install --save slack-message-builder
- name: Run Appium Test
env:
BROWSERSTACK_USERNAME: ${{secrets.BROWSERSTACK_USERNAME}}
BROWSERSTACK_ACCESS_KEY: ${{secrets.BROWSERSTACK_ACCESS_KEY}}
run: |
export BROWSERSTACK_APP_ID=$(cat /var/tmp/browserstack_id.txt)
testType=MOCKED npx wdio config/wdio.ios.bs.conf.js
- name: Create Slack Report
if: ${{ success() || failure() }}
run: |
node report-script/slack-report-script.js createSlackReport iOS
- name: Post summary message to a Slack channel
if: ${{ success() || failure() }}
id: slack
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e #v1.26.0
with:
channel-id: ${{ secrets.SLACK_MOBILE_SDK_CHANNEL }}
payload-file-path: '/var/tmp/slack-minimal_summary.json'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_REPORTER_BOT_TOKEN }}
- name: Create Slack Failed Summary Report
if: ${{ failure() }}
run: |
node report-script/slack-failed-report-script.js createSlackFailedSummaryReport ${{ steps.slack.outputs.thread_ts }}
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
- name: Post detailed summary to Slack channel thread
if: ${{ failure() }}
id: slack_thread
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e #v1.26.0
with:
channel-id: ${{ secrets.SLACK_MOBILE_SDK_CHANNEL }}
payload-file-path: '/var/tmp/slack_failed_summary.json'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_REPORTER_BOT_TOKEN }}
- name: Create and post Github summary
if: ${{ success() || failure() }}
run: |
node report-script/github-tests-summary-script.js createGithubSummaryReport