-
Notifications
You must be signed in to change notification settings - Fork 2
179 lines (160 loc) · 6.1 KB
/
ios-browserstack.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
---
name: iOS BrowserStack
on: pull_request
jobs:
build-and-upload-to-browserstack:
runs-on: macos-latest
timeout-minutes: 30
name: Upload app to Browserstack
steps:
- name: Cancel previous jobs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Git - Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Select Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
name: id_rsa_github_actions
known_hosts: unnecessary
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6"
bundler-cache: true
- name: Get npm cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- name: Cache npm dependencies
uses: actions/cache@v3
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install npm
run: |
npm config set legacy-peer-deps true install
- name: Set up Node.js
uses: actions/setup-node@v3
with:
cache: 'yarn'
- run: npm install --save slack-message-builder
- name: Cache pods
uses: actions/cache@v3
with:
path: |
ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install packages
run: |
yarn
- name: Install Tuist.io
run: |
if [ ! -d ".tuist-bin" ]
then
curl -Ls https://install.tuist.io | bash
fi
- name: Create the Xcode project and workspace
run: sh ./example/ios/example_0_70_6/tuist-generate.sh is_ci
- name: Create main.jsbundle
run: |
npm run build:ios:release
- name: Build and upload to Browserstack 🚀
run: |
bundle exec fastlane ios qa_release
env:
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.head_ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
- name: Save Browserstack ID
uses: actions/upload-artifact@v3
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-browserstack
name: Browserstack test
steps:
- name: Clone and launch Browserstack tests via Appium 🧪
run: |
git clone -b develop https://project_41483872_bot:[email protected]/primer-io/dx/mobile-appium-tests.git .
env:
GITLAB_TEMP_PATH: ${{ secrets.GITLAB_APPIUM_PULL_KEY }}
- name: Retrieve Browserstack ID
uses: actions/download-artifact@v3
with:
name: browserstack_id
path: /var/tmp
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 18.3.0
- name: npm Install
run: npm install
- 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)
npx wdio config/wdio.rn.ios.bs.conf.js
- name: Create Slack Report
if: ${{ (success() || failure()) && github.event.pull_request.base.ref == 'master' }}
run: |
node report-script/slack-report-script.js createSlackReport 'RN iOS'
- name: Post summary message to a Slack channel
if: ${{ (success() || failure()) && github.event.pull_request.base.ref == 'master' }}
id: slack
uses: slackapi/[email protected]
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() && github.event.pull_request.base.ref == 'master' }}
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() && github.event.pull_request.base.ref == 'master' }}
id: slack_thread
uses: slackapi/[email protected]
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