Skip to content

Commit 5938d7b

Browse files
authored
Refine e2e CI task (#2612)
1 parent ec99607 commit 5938d7b

File tree

13 files changed

+133
-219
lines changed

13 files changed

+133
-219
lines changed

.github/workflows/android.yml

Lines changed: 0 additions & 160 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 93 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
types:
1111
- checks_requested
1212

13+
concurrency:
14+
group: ${{ github.ref }}
15+
cancel-in-progress: true
16+
1317
jobs:
1418
lint:
1519
runs-on: ubuntu-latest
@@ -220,6 +224,94 @@ jobs:
220224
run: |
221225
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --concurrency 1
222226
227+
- name: Cache apk
228+
uses: actions/cache/save@v3
229+
env:
230+
cache-name: cache-apk
231+
with:
232+
path: apps/paper/android/app/build/outputs/apk/debug/app-debug.apk
233+
key: apk-${{ github.sha }}
234+
235+
test-android:
236+
needs: build-android
237+
runs-on: macos-latest-large
238+
strategy:
239+
matrix:
240+
working-directory: [apps/paper]
241+
steps:
242+
- name: checkout
243+
uses: actions/checkout@v3
244+
with:
245+
submodules: recursive
246+
247+
- name: Setup
248+
uses: ./.github/actions/setup
249+
with:
250+
github_token: ${{ secrets.GITHUB_TOKEN }}
251+
252+
- name: Restore APK
253+
id: cache-apk
254+
uses: actions/cache/restore@v3
255+
with:
256+
path: ${{ matrix.working-directory }}/android/app/build/outputs/apk/debug/app-debug.apk
257+
key: apk-${{ github.sha }}
258+
259+
- name: SKDs - download required images
260+
run: $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "system-images;android-30;default;x86_64"
261+
262+
- name: Emulator - Create
263+
run: $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd -n Pixel_API_30 --device 'Nexus 5X' --package "system-images;android-30;default;x86_64" --sdcard 512M
264+
265+
- name: Emulator - Boot
266+
run: $ANDROID_HOME/emulator/emulator -memory 4096 -avd Pixel_API_30 -wipe-data -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim &
267+
268+
- name: ADB Wait For Device
269+
run: adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;'
270+
timeout-minutes: 10
271+
272+
- name: Start Package Manager
273+
working-directory: ${{ matrix.working-directory }}
274+
run: E2E=true yarn start &
275+
276+
- name: Check APK existence
277+
uses: andstor/file-existence-action@v2
278+
with:
279+
files: ${{ matrix.working-directory }}/android/app/build/outputs/apk/debug/app-debug.apk
280+
fail: true
281+
282+
- name: Install APK
283+
run: adb install -r ${{ matrix.working-directory }}/android/app/build/outputs/apk/debug/app-debug.apk
284+
285+
# - name: Set up environment
286+
# run: echo "PACKAGE_NAME=${{ env.PACKAGE_NAME }}" >> $GITHUB_ENV
287+
- name: Launch APK
288+
env:
289+
PACKAGE_NAME: ${{ matrix.working-directory == 'fabricexample' && 'com.fabricexample' || 'com.paper' }}
290+
run: adb shell monkey -p ${{ env.PACKAGE_NAME }} 1
291+
292+
# On fabric, the system fonts are slightly different
293+
# so wont run the paragraph tests there for now
294+
- name: Run e2e Tests
295+
working-directory: packages/skia
296+
run: |
297+
if [ "${{ matrix.working-directory }}" = "apps/paper" ]; then
298+
CI=true yarn e2e
299+
elif [ "${{ matrix.working-directory }}" = "apps/none" ]; then
300+
CI=true yarn e2e --testPathIgnorePatterns Paragraphs
301+
fi
302+
303+
- uses: actions/upload-artifact@v2
304+
if: failure()
305+
with:
306+
path: packages/skia/src/__tests__/snapshots/
307+
name: ${{ matrix.working-directory }}-snapshots-screenshots
308+
309+
- uses: actions/upload-artifact@v2
310+
if: failure()
311+
with:
312+
path: apps/docs/static
313+
name: ${{ matrix.working-directory }}-docs-screenshots
314+
223315
build-ios:
224316
runs-on: macos-latest-large
225317
env:
@@ -251,26 +343,6 @@ jobs:
251343
echo "turbo_cache_hit=1" >> $GITHUB_ENV
252344
fi
253345
254-
- name: Cache cocoapods
255-
if: env.turbo_cache_hit != 1
256-
id: cocoapods-cache
257-
uses: actions/cache@v3
258-
with:
259-
path: |
260-
**/ios/Pods
261-
key: ${{ runner.os }}-cocoapods-${{ hashFiles('./apps/paper/ios/Podfile.lock') }}
262-
restore-keys: |
263-
${{ runner.os }}-cocoapods-
264-
265-
- name: Install cocoapods
266-
run: |
267-
cd apps/paper/ios
268-
pod install
269-
cd ../../fabric/ios
270-
pod install
271-
env:
272-
NO_FLIPPER: 1
273-
274346
- name: Build example for iOS
275347
run: |
276-
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
348+
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --concurrency 1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ And then the _SDK Location_ section. It will show you the NDK path, or the optio
4747
- Go to the package folder `cd packages/skia`
4848
- Build the Skia libraries with `yarn build-skia` (this can take a while)
4949
- Copy Skia headers `yarn copy-skia-headers`
50-
- run `pod install` in `apps/papepr/ios` and `apps/fabric/ios`
50+
- run `yarn pod:install`
5151

5252
### Upgrading
5353

apps/fabric/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23-
**/.xcode.env.local
2423

2524
# Android/IntelliJ
2625
#

apps/fabric/ios/.xcode.env.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export NODE_BINARY=$(command -v node)

apps/fabric/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"start": "react-native start",
1010
"test": "node --experimental-vm-modules ../../node_modules/.bin/jest",
1111
"tsc": "tsc --noEmit",
12+
"pod:install": "cd ios && pod install",
1213
"build:android": "cd android && ./gradlew assembleDebug --warning-mode all",
1314
"build:ios": "npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist && react-native build-ios --scheme fabric --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\"",
1415
"mkdist": "node -e \"require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })\""

apps/paper/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23-
**/.xcode.env.local
2423

2524
# Android/IntelliJ
2625
#

apps/paper/ios/.xcode.env.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export NODE_BINARY=$(command -v node)

apps/paper/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"start": "react-native start",
1010
"test": "node --experimental-vm-modules ../../node_modules/.bin/jest",
1111
"tsc": "tsc --noEmit",
12+
"pod:install": "cd ios && pod install",
1213
"build:android": "cd android && ./gradlew assembleDebug --warning-mode all",
1314
"build:ios": "npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist && react-native build-ios --scheme paper --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\"",
1415
"mkdist": "node -e \"require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })\""

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"test": "turbo run test",
2727
"build": "turbo run build",
2828
"build:ios": "turbo run build:ios",
29-
"build:android": "turbo run build:android"
29+
"build:android": "turbo run build:android",
30+
"pod:install": "turbo run pod:install"
3031
},
3132
"packageManager": "[email protected]",
3233
"devDependencies": {

0 commit comments

Comments
 (0)