Skip to content

Commit

Permalink
Merge branch 'main' into @bohdanprog/handle-web-events
Browse files Browse the repository at this point in the history
  • Loading branch information
jakex7 committed Nov 4, 2024
2 parents 2890018 + 2a58016 commit a462699
Show file tree
Hide file tree
Showing 607 changed files with 20,890 additions and 10,606 deletions.
10 changes: 5 additions & 5 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
**/node_modules/
example/examples/
example/android/
example/ios/
example/windows/
macos-example/macos/
apps/**/node_modules/
apps/**/android/
apps/**/ios/
apps/**/windows/
apps/**/macos/
screenshots/
android/
apple/
Expand Down
74 changes: 31 additions & 43 deletions .github/workflows/android-build-test.yml
Original file line number Diff line number Diff line change
@@ -1,83 +1,71 @@
name: Test Android build
name: Example Android check
on:
pull_request:
paths:
- '.github/workflows/android-build-test.yml'
- .github/workflows/android-build-test.yml
- 'android/**'
- 'src/fabric/**'
- 'package.json'
- 'example/android/**'
- 'example/package.json'
- 'fabric-example/android/**'
- 'fabric-example/package.json'
- 'apps/paper-example/android/**'
- 'apps/paper-example/package.json'
- 'apps/fabric-example/android/**'
- 'apps/fabric-example/package.json'
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
working-directory: [example, fabric-example]
working-directory: [paper-example, fabric-example]
fail-fast: false
concurrency:
group: android-${{ matrix.working-directory }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Checkout Git repository
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: Accept licenses
run: /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"

- name: Restore svg node_modules from cache
uses: actions/cache@v2
id: cache-node-modules-svg
- name: Get react-native-svg node_modules cache
uses: actions/cache@v4
with:
path: |
node_modules
path: node_modules
key: ${{ runner.os }}-node-modules-svg-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-svg
- name: Install svg node_modules
restore-keys: ${{ runner.os }}-node-modules-svg-

- name: Install react-native-svg node_modules
run: yarn install --frozen-lockfile

- name: Restore app node_modules from cache
uses: actions/cache@v2
id: cache-node-modules-app
- name: Get app node_modules cache
uses: actions/cache@v4
with:
path: |
${{ matrix.working-directory }}/node_modules
path: apps/${{ matrix.working-directory }}/node_modules
key: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/yarn.lock', matrix.working-directory)) }}
restore-keys: |
${{ runner.os }}-node-modules-${{ matrix.working-directory }}-
restore-keys: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-

- name: Install app node_modules
working-directory: ${{ matrix.working-directory }}
working-directory: apps/${{ matrix.working-directory }}
run: yarn install --frozen-lockfile

- name: Restore build from cache
uses: actions/cache@v3
- name: Get build cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
android/build
android/.cxx
${{ matrix.working-directory }}/android/build
${{ matrix.working-directory }}/android/.cxx
${{ matrix.working-directory }}/android/.gradle
${{ matrix.working-directory }}/android/app/build
${{ matrix.working-directory }}/android/app/.cxx
${{ matrix.working-directory }}/node_modules/react-native/ReactAndroid/build
${{ matrix.working-directory }}/node_modules/react-native/ReactAndroid/hermes-engine/build
${{ matrix.working-directory }}/node_modules/react-native/ReactAndroid/hermes-engine/.cxx
key: ${{ runner.os }}-build5-${{ matrix.working-directory }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'android/build.gradle', format('{0}/node_modules/react-native/sdks/.hermesversion', matrix.working-directory)) }}
key: ${{ runner.os }}-gradle-${{matrix.working-directory}}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-${{matrix.working-directory}}-
- name: Build app
working-directory: ${{ matrix.working-directory }}/android
working-directory: apps/${{ matrix.working-directory }}/android
run: ./gradlew assembleDebug --build-cache --console=plain -PreactNativeArchitectures=arm64-v8a
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: Test Android e2e
name: E2E Android
on:
pull_request:
paths:
- '.github/workflows/android-e2e-test.yml'
- 'apps/examples/**'
- 'example/**'
- 'android/**'
- 'src/**'
- 'e2e/**'
- 'package.json'
- .github/workflows/e2e-android.yml
- apps/common/example/**
- android/**
- src/**
- e2e/**
- package.json
# push:
# branches:
# - main
Expand All @@ -18,7 +17,7 @@ jobs:
runs-on: macos-12
timeout-minutes: 60
env:
WORKING_DIRECTORY: example
WORKING_DIRECTORY: paper-example
API_LEVEL: 34
SYSTEM_IMAGES: system-images;android-34;google_apis;x86_64
AVD_NAME: rn-svg-avd
Expand Down Expand Up @@ -81,26 +80,26 @@ jobs:
timeout-minutes: 10

- name: Reverse TCP
working-directory: ${{ env.WORKING_DIRECTORY }}
working-directory: apps/${{ env.WORKING_DIRECTORY }}
run: adb devices | grep '\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} adb -s {} reverse tcp:8081 tcp:8081

- name: Install root node dependencies
run: yarn

- name: Install example app node dependencies
run: yarn
working-directory: ${{ env.WORKING_DIRECTORY }}
working-directory: apps/${{ env.WORKING_DIRECTORY }}

- name: Build Android app
working-directory: ${{ env.WORKING_DIRECTORY }}/android
working-directory: apps/${{ env.WORKING_DIRECTORY }}/android
run: ./gradlew assembleDebug

- name: Start Metro server
working-directory: ${{ env.WORKING_DIRECTORY }}
working-directory: apps/${{ env.WORKING_DIRECTORY }}
run: E2E=true yarn start &> output.log &

- name: Install APK
run: adb install -r ${{ env.WORKING_DIRECTORY }}/android/app/build/outputs/apk/debug/app-debug.apk
run: adb install -r apps/${{ env.WORKING_DIRECTORY }}/android/app/build/outputs/apk/debug/app-debug.apk

- name: Launch APK
run: 'while ! (adb shell monkey -p com.example 1 | grep -q "Events injected: 1"); do sleep 1; echo "Retrying due to errors in previous run..."; done'
Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/e2e-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: E2E iOS
on:
pull_request:
paths:
- .github/workflows/ios-e2e.yml
- apps/common/example/**
- apple/**
- src/**
- e2e/**
- package.json
push:
branches:
- main
workflow_dispatch:

jobs:
test:
runs-on: macos-14
timeout-minutes: 60
strategy:
matrix:
working-directory: [paper-example]
fail-fast: false
env:
DEVICE: iPhone 16 Pro
steps:
- name: Checkout Git repository
uses: actions/checkout@v4

- name: Use latest stable Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Get react-native-svg node_modules cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-svg-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-node-modules-svg-

- name: Install react-native-svg node_modules
run: yarn install --frozen-lockfile

- name: Get app node_modules cache
uses: actions/cache@v4
with:
path: apps/${{ matrix.working-directory }}/node_modules
key: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-${{ hashFiles(format('apps/{0}/yarn.lock', matrix.working-directory)) }}
restore-keys: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-

- name: Install app node_modules
working-directory: apps/${{ matrix.working-directory }}
run: yarn install --frozen-lockfile

- name: Get Pods cache
uses: actions/cache@v4
with:
path: apps/${{ matrix.working-directory }}/ios/Pods
key: ${{ runner.os }}-pods-${{ matrix.working-directory }}-${{ hashFiles(format('apps/{0}/ios/Podfile.lock', matrix.working-directory)) }}
restore-keys: |
${{ runner.os }}-pods-${{ matrix.working-directory }}-
- name: Install Pods
working-directory: apps/${{ matrix.working-directory }}/ios
run: bundle install && bundle exec pod install

- name: Get build artifacts cache
uses: actions/cache@v4
with:
path: ~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-ios-derived-data-${{ matrix.working-directory }}-${{ hashFiles(format('apps/{0}/ios/Podfile.lock', matrix.working-directory)) }}
restore-keys: |
${{ runner.os }}-ios-derived-data-${{ matrix.working-directory }}-
- name: Start Metro server
working-directory: apps/${{ matrix.working-directory }}
run: E2E=true yarn start &> output.log &

- name: Build app
working-directory: apps/${{ matrix.working-directory }}
run: E2E=true npx react-native run-ios --simulator="${{ env.DEVICE }}" --mode Debug --verbose

- name: Run e2e Tests
run: E2E=true yarn e2e

- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: report
path: |
report.html
jest-html-reporters-attach/
58 changes: 30 additions & 28 deletions .github/workflows/ios-build-test.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
name: Test iOS build
name: Example iOS check
on:
pull_request:
paths:
- .github/workflows/ios-build-test.yml
- RNSVG.podspec
- apple/**
- example/package.json
- example/ios/**
- src/fabric/**
- fabric-example/package.json
- fabric-example/ios/**
- package.json
- apps/paper-example/package.json
- apps/paper-example/ios/**
- apps/fabric-example/package.json
- apps/fabric-example/ios/**
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: macos-14
strategy:
matrix:
working-directory: [example, fabric-example]
working-directory: [paper-example, fabric-example]
fail-fast: false
concurrency:
group: ios-${{ matrix.working-directory }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Checkout Git repository
uses: actions/checkout@v4

- name: Use latest stable Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Restore react-native-svg node_modules from cache
uses: actions/cache@v3
- name: Get react-native-svg node_modules cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-svg-${{ hashFiles('yarn.lock') }}
Expand All @@ -44,36 +45,37 @@ jobs:
- name: Install react-native-svg node_modules
run: yarn install --frozen-lockfile

- name: Restore app node_modules from cache
uses: actions/cache@v3
- name: Get app node_modules cache
uses: actions/cache@v4
with:
path: ${{ matrix.working-directory }}/node_modules
key: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/yarn.lock', matrix.working-directory)) }}
path: apps/${{ matrix.working-directory }}/node_modules
key: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-${{ hashFiles(format('apps/{0}/yarn.lock', matrix.working-directory)) }}
restore-keys: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-

- name: Install app node_modules
working-directory: ${{ matrix.working-directory }}
working-directory: apps/${{ matrix.working-directory }}
run: yarn install --frozen-lockfile

- name: Restore Pods from cache
uses: actions/cache@v3
- name: Get Pods cache
uses: actions/cache@v4
with:
path: |
${{ matrix.working-directory }}/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/ios/Podfile.lock', matrix.working-directory)) }}
path: apps/${{ matrix.working-directory }}/ios/Pods
key: ${{ runner.os }}-pods-${{ matrix.working-directory }}-${{ hashFiles(format('apps/{0}/ios/Podfile.lock', matrix.working-directory)) }}
restore-keys: |
${{ runner.os }}-pods-${{ matrix.working-directory }}-
- name: Install Pods
working-directory: ${{ matrix.working-directory }}/ios
working-directory: apps/${{ matrix.working-directory }}/ios
run: bundle install && bundle exec pod install

- name: Restore build artifacts from cache
uses: actions/cache@v3
- name: Get build artifacts cache
uses: actions/cache@v4
with:
path: ~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-ios-derived-data-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/ios/Podfile.lock', matrix.working-directory)) }}
key: ${{ runner.os }}-ios-derived-data-${{ matrix.working-directory }}-${{ hashFiles(format('apps/{0}/ios/Podfile.lock', matrix.working-directory)) }}
restore-keys: |
${{ runner.os }}-ios-derived-data-${{ matrix.working-directory }}-
- name: Build app
working-directory: ${{ matrix.working-directory }}
run: npx react-native@latest run-ios --simulator="iPhone 16 Pro" --mode Debug --verbose --terminal /bin/zsh
working-directory: apps/${{ matrix.working-directory }}
run: npx react-native run-ios --simulator="iPhone 15 Pro" --mode Debug --verbose --no-packager
Loading

0 comments on commit a462699

Please sign in to comment.