Skip to content

Commit af5e069

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

File tree

1 file changed

+65
-22
lines changed

1 file changed

+65
-22
lines changed

.github/workflows/ci.yml

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

1111
env:
12-
nodejs: "16.x"
12+
node_version: "22.x"
13+
java_distribution: "zulu"
14+
java_version: "17"
15+
gradle_version: "7.6.1"
1316
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
1417
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
1518

@@ -18,10 +21,10 @@ jobs:
1821
runs-on: ubuntu-latest
1922
steps:
2023
- uses: actions/checkout@v1
21-
- name: Install Node.js ${{ env.nodejs }}
24+
- name: Install node.js
2225
uses: actions/setup-node@v4
2326
with:
24-
node-version: ${{ env.nodejs }}
27+
node-version: ${{ env.node_version }}
2528
cache: npm
2629
cache-dependency-path: package-lock.json
2730
- name: Install node modules
@@ -31,56 +34,82 @@ jobs:
3134

3235
build-ios:
3336
runs-on: macOS-latest
37+
outputs:
38+
run-tests: ${{ steps.should-run-tests.outputs.run_tests }}
3439
steps:
3540
- uses: actions/checkout@v1
36-
- name: Install Node.js ${{ env.nodejs }}
41+
- name: Install node.js
3742
uses: actions/setup-node@v4
3843
with:
39-
node-version: ${{ env.nodejs }}
44+
node-version: ${{ env.node_version }}
4045
cache: npm
4146
cache-dependency-path: package-lock.json
47+
- id: should-run-tests
48+
# need to find a solution for signing iOS App so we can build for device target instead simulator
49+
# for now we skip iOS tests on BrowserStack
50+
run: echo "run_tests=false" >> "$GITHUB_OUTPUT"
4251
- name: Install node modules
4352
run: npm ci
4453
- name: Update test cert for httpbin.org
4554
run: npm run update:cert
46-
# need to find a solution for signing iOS App so we can build for device target instead simulator
4755
- name: Build test app
4856
run: scripts/build-test-app.sh --ios --emulator
4957
- name: Upload artifact to BrowserStack
50-
if: env.BROWSERSTACK_USERNAME != ''
58+
if: steps.should-run-tests.outputs.run_tests == 'true'
5159
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
60+
61+
test-ios:
62+
needs: build-ios
63+
if: needs.build-ios.outputs.run-tests == 'true'
64+
runs-on: macOS-latest
65+
steps:
66+
- uses: actions/checkout@v1
67+
- name: Install node.js
68+
uses: actions/setup-node@v4
69+
with:
70+
node-version: ${{ env.node_version }}
71+
cache: npm
72+
cache-dependency-path: package-lock.json
73+
- name: Install node modules
74+
run: npm ci
75+
- name: Run e2e tests (iOS)
76+
run: scripts/test-app.sh --ios --device
5677

5778
build-android:
5879
runs-on: ubuntu-latest
80+
outputs:
81+
run-tests: ${{ steps.should-run-tests.outputs.run_tests }}
5982
steps:
6083
- uses: actions/checkout@v1
61-
- name: Install Node.js ${{ env.nodejs }}
84+
- name: Install node.js
6285
uses: actions/setup-node@v4
6386
with:
64-
node-version: ${{ env.nodejs }}
87+
node-version: ${{ env.node_version }}
6588
cache: npm
6689
cache-dependency-path: package-lock.json
90+
- id: should-run-tests
91+
run: |
92+
if [ -n "${BROWSERSTACK_USERNAME}" ]; then
93+
echo "run_tests=true" >> "$GITHUB_OUTPUT"
94+
else
95+
echo "run_tests=false" >> "$GITHUB_OUTPUT"
96+
fi
6797
- name: Install node modules
6898
run: npm ci
6999
- name: Install JDK
70100
uses: actions/setup-java@v2
71101
with:
72-
distribution: "zulu"
73-
java-version: "17"
102+
distribution: ${{ env.java_distribution }}
103+
java-version: ${{ env.java_version }}
74104
java-package: jdk
75105
- name: Ensure Android build-tools 33.0.2
76106
run: yes | "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" "build-tools;33.0.2"
77-
- name: Install Gradle 7.6.1
107+
- name: Install Gradle
78108
run: |
79109
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
110+
curl -sSL "https://services.gradle.org/distributions/gradle-${{ env.gradle_version }}-bin.zip" -o gradle.zip
82111
unzip -q gradle.zip -d "$HOME/gradle"
83-
echo "$HOME/gradle/gradle-${GRADLE_VERSION}/bin" >> "$GITHUB_PATH"
112+
echo "$HOME/gradle/gradle-${{ env.gradle_version }}/bin" >> "$GITHUB_PATH"
84113
rm gradle.zip
85114
- name: Update test cert for httpbin.org
86115
run: npm run update:cert
@@ -101,8 +130,22 @@ jobs:
101130
- name: Build test app
102131
run: scripts/build-test-app.sh --android --device
103132
- name: Upload artifact to BrowserStack
104-
if: env.BROWSERSTACK_USERNAME != ''
133+
if: steps.should-run-tests.outputs.run_tests == 'true'
105134
run: scripts/upload-browserstack.sh --android
106-
- name: Run e2e tests
107-
if: env.BROWSERSTACK_USERNAME != ''
135+
136+
test-android:
137+
needs: build-android
138+
if: needs.build-android.outputs.run-tests == 'true'
139+
runs-on: ubuntu-latest
140+
steps:
141+
- uses: actions/checkout@v1
142+
- name: Install node.js
143+
uses: actions/setup-node@v4
144+
with:
145+
node-version: ${{ env.node_version }}
146+
cache: npm
147+
cache-dependency-path: package-lock.json
148+
- name: Install node modules
149+
run: npm ci
150+
- name: Run e2e tests (Android)
108151
run: scripts/test-app.sh --android --device

0 commit comments

Comments
 (0)