Skip to content

Commit 9b9ca58

Browse files
committed
chore: prepare iOS testing on BrowserStack
1 parent 73f37d6 commit 9b9ca58

File tree

1 file changed

+57
-15
lines changed

1 file changed

+57
-15
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ on:
99
required: false
1010

1111
env:
12-
nodejs: "16.x"
12+
nodejs: "22.x"
13+
java_version: "17"
14+
gradle_version: "7.6.1"
1315
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
1416
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
1517

@@ -31,6 +33,8 @@ jobs:
3133

3234
build-ios:
3335
runs-on: macOS-latest
36+
outputs:
37+
run-tests: ${{ steps.should-run-tests.outputs.run_tests }}
3438
steps:
3539
- uses: actions/checkout@v1
3640
- name: Install Node.js ${{ env.nodejs }}
@@ -39,23 +43,41 @@ jobs:
3943
node-version: ${{ env.nodejs }}
4044
cache: npm
4145
cache-dependency-path: package-lock.json
46+
- id: should-run-tests
47+
# need to find a solution for signing iOS App so we can build for device target instead simulator
48+
# for now we skip iOS tests on BrowserStack
49+
run: echo "run_tests=false" >> "$GITHUB_OUTPUT"
4250
- name: Install node modules
4351
run: npm ci
4452
- name: Update test cert for httpbin.org
4553
run: npm run update:cert
46-
# need to find a solution for signing iOS App so we can build for device target instead simulator
4754
- name: Build test app
4855
run: scripts/build-test-app.sh --ios --emulator
4956
- name: Upload artifact to BrowserStack
50-
if: env.BROWSERSTACK_USERNAME != ''
57+
if: steps.should-run-tests.outputs.run_tests == 'true'
5158
run: scripts/upload-browserstack.sh --ios
52-
# need to have an App for device target
53-
# - name: Run e2e tests
54-
# if: env.BROWSERSTACK_USERNAME != ''
55-
# run: scripts/test-app.sh --ios --device
59+
60+
test-ios:
61+
needs: build-ios
62+
if: needs.build-ios.outputs.run-tests == 'true'
63+
runs-on: macOS-latest
64+
steps:
65+
- uses: actions/checkout@v1
66+
- name: Install Node.js ${{ env.nodejs }}
67+
uses: actions/setup-node@v4
68+
with:
69+
node-version: ${{ env.nodejs }}
70+
cache: npm
71+
cache-dependency-path: package-lock.json
72+
- name: Install node modules
73+
run: npm ci
74+
- name: Run e2e tests (iOS)
75+
run: scripts/test-app.sh --ios --device
5676

5777
build-android:
5878
runs-on: ubuntu-latest
79+
outputs:
80+
run-tests: ${{ steps.should-run-tests.outputs.run_tests }}
5981
steps:
6082
- uses: actions/checkout@v1
6183
- name: Install Node.js ${{ env.nodejs }}
@@ -64,23 +86,29 @@ jobs:
6486
node-version: ${{ env.nodejs }}
6587
cache: npm
6688
cache-dependency-path: package-lock.json
89+
- id: should-run-tests
90+
run: |
91+
if [ -n "${BROWSERSTACK_USERNAME}" ]; then
92+
echo "run_tests=true" >> "$GITHUB_OUTPUT"
93+
else
94+
echo "run_tests=false" >> "$GITHUB_OUTPUT"
95+
fi
6796
- name: Install node modules
6897
run: npm ci
6998
- name: Install JDK
7099
uses: actions/setup-java@v2
71100
with:
72101
distribution: "zulu"
73-
java-version: "17"
102+
java-version: ${{ env.java_version }}
74103
java-package: jdk
75104
- name: Ensure Android build-tools 33.0.2
76105
run: yes | "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" "build-tools;33.0.2"
77-
- name: Install Gradle 7.6.1
106+
- name: Install Gradle ${{ env.gradle_version }}
78107
run: |
79108
set -euo pipefail
80-
GRADLE_VERSION=7.6.1
81-
curl -sSL "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" -o gradle.zip
109+
curl -sSL "https://services.gradle.org/distributions/gradle-${{ env.gradle_version }}-bin.zip" -o gradle.zip
82110
unzip -q gradle.zip -d "$HOME/gradle"
83-
echo "$HOME/gradle/gradle-${GRADLE_VERSION}/bin" >> "$GITHUB_PATH"
111+
echo "$HOME/gradle/gradle-${{ env.gradle_version }}/bin" >> "$GITHUB_PATH"
84112
rm gradle.zip
85113
- name: Update test cert for httpbin.org
86114
run: npm run update:cert
@@ -101,8 +129,22 @@ jobs:
101129
- name: Build test app
102130
run: scripts/build-test-app.sh --android --device
103131
- name: Upload artifact to BrowserStack
104-
if: env.BROWSERSTACK_USERNAME != ''
132+
if: steps.should-run-tests.outputs.run_tests == 'true'
105133
run: scripts/upload-browserstack.sh --android
106-
- name: Run e2e tests
107-
if: env.BROWSERSTACK_USERNAME != ''
134+
135+
test-android:
136+
needs: build-android
137+
if: needs.build-android.outputs.run-tests == 'true'
138+
runs-on: ubuntu-latest
139+
steps:
140+
- uses: actions/checkout@v1
141+
- name: Install Node.js ${{ env.nodejs }}
142+
uses: actions/setup-node@v4
143+
with:
144+
node-version: ${{ env.nodejs }}
145+
cache: npm
146+
cache-dependency-path: package-lock.json
147+
- name: Install node modules
148+
run: npm ci
149+
- name: Run e2e tests (Android)
108150
run: scripts/test-app.sh --android --device

0 commit comments

Comments
 (0)