Skip to content

Commit 352dbca

Browse files
author
Wiktor Jaszczuk
committed
chore: use RNEF to build example app in e2e tests
1 parent bd26773 commit 352dbca

File tree

19 files changed

+1662
-283
lines changed

19 files changed

+1662
-283
lines changed

.github/actions/installMaestro/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ runs:
1212
- name: Install Maestro CLI
1313
shell: bash
1414
run: |
15-
export MAESTRO_VERSION=1.40.3
15+
export MAESTRO_VERSION=1.41.0
1616
curl -Ls "https://get.maestro.mobile.dev" | bash
1717
1818
- name: Conditionally install brew packages for iOS

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ runs:
1111
node-version: 20
1212

1313
- name: Install dependencies
14-
run: yarn install --frozen-lockfile --immutable
14+
run: yarn install --immutable
1515
shell: bash

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
cache: yarn
2525

2626
- name: Install Dependencies
27-
run: yarn install --frozen-lockfile
27+
run: yarn install --immutable
2828

2929
- name: Create Release Pull Request or Publish to npm
3030
id: changesets
@@ -36,4 +36,4 @@ jobs:
3636
publish: yarn release
3737
env:
3838
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
39+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test-e2e-android.yaml

Lines changed: 76 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,47 @@ env:
2929
MAESTRO_DISABLE_UPDATE_CHECK: true
3030

3131
jobs:
32-
e2e-android:
32+
build-release:
3333
runs-on: ubuntu-latest
34+
outputs:
35+
artifact-id: ${{ steps.rnef-remote-build-android.outputs.artifact-id }}
36+
37+
steps:
38+
- name: Checkout Repo
39+
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
43+
- name: Setup
44+
uses: ./.github/actions/setup
45+
46+
- name: Run generate:legal from bare-example
47+
run: yarn workspace react-native-legal-bare-example generate:legal
48+
shell: bash
49+
50+
- name: "[WORKAROUND] run generateCodegenArtifactsFromSchema manually for example app"
51+
shell: bash
52+
run: |
53+
cd examples/bare-example/android
54+
./gradlew generateCodegenArtifactsFromSchema
55+
56+
- name: RNEF Remote Build - Android
57+
id: rnef-remote-build-android
58+
uses: callstackincubator/android@v1
59+
with:
60+
variant: release
61+
github-token: ${{ secrets.GITHUB_TOKEN }}
62+
sign: false
63+
working-directory: ./examples/bare-example
64+
65+
run-e2e-tests:
66+
runs-on: ubuntu-latest
67+
needs: build-release
3468
strategy:
3569
fail-fast: false
3670
matrix:
37-
api-level: [30, 34, 35]
71+
api-level: [ 30, 33, 35 ]
3872
steps:
39-
- name: Enable KVM group perms
40-
run: |
41-
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
42-
sudo udevadm control --reload-rules
43-
sudo udevadm trigger --name-match=kvm
44-
4573
- name: Checkout Repo
4674
uses: actions/checkout@v4
4775
with:
@@ -55,44 +83,58 @@ jobs:
5583
with:
5684
target-platform: android
5785

58-
- name: Cache Build
59-
id: cache-build
86+
- name: Enable KVM group perms
87+
run: |
88+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
89+
sudo udevadm control --reload-rules
90+
sudo udevadm trigger --name-match=kvm
91+
92+
- name: Download and Unpack APK artifact
93+
run: |
94+
curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o artifact.zip "https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${{ needs.build-release.outputs.artifact-id }}/zip"
95+
unzip artifact.zip -d downloaded-artifacts
96+
ls -l downloaded-artifacts
97+
APK_PATH=$(pwd)/$(find downloaded-artifacts -name "*.apk" -print -quit)
98+
echo "ARTIFACT_PATH_FOR_E2E=$APK_PATH" >> $GITHUB_ENV
99+
shell: bash
100+
101+
- name: AVD cache
60102
uses: actions/cache@v4
61-
env:
62-
cache-name: cached-android-build
103+
id: avd-cache
63104
with:
64105
path: |
65-
examples/bare-example/android/build
66-
examples/bare-example/android/app/build
67-
examples/bare-example/android/app/.cxx
68-
key: bare-example-android-build
106+
~/.android/avd/*
107+
~/.android/adb*
108+
key: avd-${{ matrix.api-level }}
69109

70-
- uses: actions/setup-java@v4
110+
- name: create AVD and generate snapshot for caching
111+
if: steps.avd-cache.outputs.cache-hit != 'true'
112+
uses: reactivecircus/android-emulator-runner@v2
71113
with:
72-
distribution: 'zulu'
73-
java-version: '17'
74-
cache: 'gradle'
75-
76-
- name: Gradle cache
77-
uses: gradle/actions/setup-gradle@v3
78-
79-
- name: Install example dependencies
80-
run: yarn workspace react-native-legal-bare-example install --frozen-lockfile --immutable
81-
82-
- name: Bundle app
83-
run: yarn workspace react-native-legal-bare-example build:android
114+
api-level: ${{ matrix.api-level }}
115+
arch: 'x86_64'
116+
target: 'google_apis'
117+
force-avd-creation: false
118+
cores: 4
119+
emulator-options: -verbose -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none -camera-back none
120+
disable-animations: false
121+
ram-size: '6144M'
122+
script: echo "Generated AVD snapshot for caching."
84123

85-
- name: Create AVD and generate snapshot for caching
124+
- name: Run tests
86125
uses: reactivecircus/android-emulator-runner@v2
87126
with:
88127
api-level: ${{ matrix.api-level }}
89128
arch: 'x86_64'
90129
target: 'google_apis'
91-
force-avd-creation: true
92-
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
130+
force-avd-creation: false
131+
cores: 4
132+
emulator-options: -verbose -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none -camera-back none
93133
disable-animations: false
94-
ram-size: '4096M'
95-
script: ./scripts/e2e_android_emulator_build_and_test.sh
134+
ram-size: '6144M'
135+
script: |
136+
adb install -r "$ARTIFACT_PATH_FOR_E2E"
137+
yarn workspace react-native-legal-bare-example e2e:android
96138
97139
- name: Upload report
98140
if: always()

.github/workflows/test-e2e-ios.yaml

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,59 @@ concurrency:
2929
cancel-in-progress: true
3030

3131
jobs:
32-
e2e-ios:
32+
build-release:
3333
runs-on: macos-15
34+
outputs:
35+
artifact-id: ${{ steps.rnef-remote-build-ios.outputs.artifact-id }}
36+
artifact-url: ${{ steps.rnef-remote-build-ios.outputs.artifact-url }}
37+
38+
steps:
39+
- name: Checkout Repo
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Setup
45+
uses: ./.github/actions/setup
46+
47+
- name: Run generate:legal from bare-example
48+
run: yarn workspace react-native-legal-bare-example generate:legal
49+
shell: bash
50+
51+
- name: Build iOS
52+
id: rnef-remote-build-ios
53+
uses: callstackincubator/ios@v1
54+
with:
55+
destination: 'simulator'
56+
scheme: 'ReactNativeLegalBareExample'
57+
configuration: 'Release'
58+
github-token: ${{ secrets.GITHUB_TOKEN }}
59+
working-directory: ./examples/bare-example
60+
61+
run-e2e-tests:
62+
runs-on: macos-15
63+
needs: build-release
3464
strategy:
3565
fail-fast: false
3666
matrix:
37-
simulator: ['iPhone 16 Pro (18.5)', 'iPhone SE (3rd generation) (18.0)']
67+
simulator: ['iPhone 16 Pro', 'iPhone SE (3rd generation)']
68+
3869
steps:
3970
- name: Checkout Repo
4071
uses: actions/checkout@v4
4172
with:
4273
fetch-depth: 0
4374

75+
- name: Download and Unpack APK artifact
76+
run: |
77+
curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o artifact.zip "https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${{ needs.build-release.outputs.artifact-id }}/zip"
78+
unzip artifact.zip -d downloaded-artifacts
79+
tar zxf downloaded-artifacts/app.tar.gz -C downloaded-artifacts
80+
ls -l downloaded-artifacts
81+
APP_PATH=$(pwd)/$(find downloaded-artifacts -name "*.app" -print -quit)
82+
echo "ARTIFACT_PATH_FOR_E2E=$APP_PATH" >> $GITHUB_ENV
83+
shell: bash
84+
4485
- name: Setup
4586
uses: ./.github/actions/setup
4687

@@ -49,38 +90,13 @@ jobs:
4990
with:
5091
target-platform: ios
5192

52-
- name: Install example dependencies
53-
run: yarn workspace react-native-legal-bare-example install --frozen-lockfile --immutable
54-
55-
- name: Cache Pods
56-
id: cache-pods
57-
uses: actions/cache@v4
58-
env:
59-
cache-name: cached-ios-pods-deps
60-
with:
61-
path: examples/bare-example/ios/Pods
62-
key: bare-example-pods
63-
64-
- name: Cache Build
65-
id: cache-build
66-
uses: actions/cache@v4
67-
env:
68-
cache-name: cached-ios-build
69-
with:
70-
path: examples/bare-example/ios/build
71-
key: bare-example-ios-build
72-
73-
- name: Install example Pods
74-
run: yarn workspace react-native-legal-bare-example pods
75-
76-
- name: Bundle app
77-
run: yarn workspace react-native-legal-bare-example build:ios
78-
7993
- name: List simulators
8094
run: xcrun simctl list
8195

82-
- name: Build iOS App
83-
run: yarn workspace react-native-legal-bare-example ios:release --simulator="${{ matrix.simulator }}"
96+
- name: Install on simulator
97+
run: |
98+
cd examples/bare-example
99+
npx rnef run:ios --binary-path "$ARTIFACT_PATH_FOR_E2E" --device "${{ matrix.simulator }}" --local
84100
85101
- name: Run tests
86102
run: yarn workspace react-native-legal-bare-example e2e:ios

examples/bare-example/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ local.properties
3737
android/config/
3838
ios/Settings.bundle/
3939
ios/license_plist.yml
40+
.rnef/
4041

4142
# node.js
4243
#

examples/bare-example/Gemfile.lock

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
CFPropertyList (3.0.6)
4+
CFPropertyList (3.0.7)
5+
base64
6+
nkf
57
rexml
6-
activesupport (7.0.6)
7-
concurrent-ruby (~> 1.0, >= 1.0.2)
8+
activesupport (7.2.2.1)
9+
base64
10+
benchmark (>= 0.3)
11+
bigdecimal
12+
concurrent-ruby (~> 1.0, >= 1.3.1)
13+
connection_pool (>= 2.2.5)
14+
drb
815
i18n (>= 1.6, < 2)
16+
logger (>= 1.4.2)
917
minitest (>= 5.1)
10-
tzinfo (~> 2.0)
18+
securerandom (>= 0.3)
19+
tzinfo (~> 2.0, >= 2.0.5)
1120
addressable (2.8.7)
1221
public_suffix (>= 2.0.2, < 7.0)
1322
algoliasearch (1.27.5)
1423
httpclient (~> 2.8, >= 2.8.3)
1524
json (>= 1.5.1)
1625
atomos (0.1.3)
26+
base64 (0.3.0)
27+
benchmark (0.4.1)
28+
bigdecimal (3.2.2)
1729
claide (1.1.0)
1830
cocoapods (1.15.2)
1931
addressable (~> 2.8)
@@ -53,51 +65,60 @@ GEM
5365
netrc (~> 0.11)
5466
cocoapods-try (1.2.0)
5567
colored2 (3.1.2)
56-
concurrent-ruby (1.2.2)
68+
concurrent-ruby (1.3.3)
69+
connection_pool (2.5.3)
70+
drb (2.2.3)
5771
escape (0.0.4)
5872
ethon (0.16.0)
5973
ffi (>= 1.15.0)
60-
ffi (1.17.1)
74+
ffi (1.17.2)
6175
fourflusher (2.3.1)
6276
fuzzy_match (2.0.4)
6377
gh_inspector (1.1.3)
6478
httpclient (2.9.0)
6579
mutex_m
66-
i18n (1.14.1)
80+
i18n (1.14.7)
6781
concurrent-ruby (~> 1.0)
68-
json (2.10.1)
69-
minitest (5.19.0)
82+
json (2.12.2)
83+
logger (1.7.0)
84+
minitest (5.25.5)
7085
molinillo (0.8.0)
7186
mutex_m (0.3.0)
7287
nanaimo (0.3.0)
7388
nap (1.1.0)
7489
netrc (0.11.0)
90+
nkf (0.2.0)
7591
public_suffix (4.0.7)
76-
rexml (3.2.6)
92+
rexml (3.4.1)
7793
ruby-macho (2.5.1)
94+
securerandom (0.4.1)
7895
typhoeus (1.4.1)
7996
ethon (>= 0.9.0)
8097
tzinfo (2.0.6)
8198
concurrent-ruby (~> 1.0)
82-
xcodeproj (1.24.0)
99+
xcodeproj (1.25.1)
83100
CFPropertyList (>= 2.3.3, < 4.0)
84101
atomos (~> 0.1.3)
85102
claide (>= 1.0.2, < 2.0)
86103
colored2 (~> 3.1)
87104
nanaimo (~> 0.3.0)
88-
rexml (~> 3.2.4)
105+
rexml (>= 3.3.6, < 4.0)
89106

90107
PLATFORMS
91108
ruby
92109

93110
DEPENDENCIES
94111
activesupport (>= 6.1.7.5, != 7.1.0)
112+
benchmark
113+
bigdecimal
95114
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
96115
concurrent-ruby (< 1.3.4)
116+
logger
117+
mutex_m
97118
xcodeproj (< 1.26.0)
98119

99120
RUBY VERSION
100-
ruby 3.2.2p53
121+
ruby 3.4.5p51
101122

102123
BUNDLED WITH
103-
2.4.15
124+
2.6.9

0 commit comments

Comments
 (0)