Skip to content

Commit 047f87f

Browse files
authored
feat: upgrade dependencies (#535)
* feat: upgrade and cleanup dependencies * feat: move types to optional peer dependencies * chore: align gradle.properties with template * chore: ignore all build directories from eslint * chore: reduce duplicate dependencies * refactor: align node imports * ci: align working-directory * ci: fix working-directory * ci: android try setup only in react-native-app * ci: try again with default working-directory * chore: keep jest for detox * ci: try react-native build-android command * ci: try running react-native through yarn * ci: fix jest config e2e * ci: use npx for jest e2e * chore: upgrade ios example * ci: test maestro * ci: try iPhone 15 Pro * ci: add maestro to path * ci: debug maestro * ci: test maestro path * ci: export path in test job * chore: remove detox * ci: use GITHUB_PATH * ci: remove maestro version testing * ci: setup cocoapods cache * ci: setup iOS build cache * ci: separate iOS build and test * ci: improve cache keys * ci: fix cache and upload paths * ci: keep diretory structure for app * ci: fix pods path * ci: debug pathes * ci: add Android app artifact * ci: fix artifact download path * ci: fix artifact download path * ci: add Android build cache * ci: fix android apk path * ci: try without idb * ci: add Android test * ci: use reactivecircus/android-emulator-runner@v2 * ci: fix android apk path * ci: align tests * ci: fix apk path * test: adapt e2e test for Android * ci: improve android caching * ci: add report upload * chore: ignore report.xml * ci: test android workflows on macos * ci: improve emulator setup * Revert "ci: test android workflows on macos" This reverts commit ed38256. * ci: keep default emulator setup * ci: reorder jobs * ci: list emulators * ci: cache android virtual device * ci: remove avd list * ci: align emulator versions * ci: change api-level * ci: try different profile * ci: remove sdkmanager debugging * fix: use old arch for RN example * chore: fix typo * ci: separate Android and iOS workflow for arch matrix * ci: adopt matrxi for tests * ci: move matrix to jobs * ci: shorten job names * ci: add matrix to test name * ci: Podfile.lock needs update for new arch
1 parent deb9655 commit 047f87f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3351
-4875
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
lib
2+
build

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module.exports = {
22
root: true,
33
extends: ["universe/native"],
4-
ignorePatterns: ["build"],
54
};

.github/workflows/review-android.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Android
2+
3+
on:
4+
workflow_call:
5+
# Review calls this Workflow
6+
7+
jobs:
8+
build-android:
9+
name: Build ${{ matrix.new-arch && 'new' || 'old'}} Arch
10+
runs-on: ubuntu-latest
11+
defaults:
12+
run:
13+
working-directory: ./packages/react-native-app
14+
strategy:
15+
matrix:
16+
new-arch: [false, true]
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup
22+
uses: ./.github/actions/setup
23+
24+
- name: Setup Azul Zulu OpenJDK
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: zulu
28+
java-version: 21
29+
cache: gradle
30+
31+
- name: Cache Build
32+
uses: actions/cache@v4
33+
id: android-build-cache
34+
with:
35+
path: |
36+
./android/build
37+
./packages/react-native-app/android/.gradle
38+
./packages/react-native-app/android/app/build
39+
./packages/react-native-app/android/build
40+
key: ${{ runner.os }}-android-build-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ github.workflow }}-${{ github.sha }}
41+
restore-keys: |
42+
${{ runner.os }}-android-build-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ github.workflow }}-${{ github.sha }}
43+
${{ runner.os }}-android-build-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ github.workflow }}-
44+
45+
- name: Build
46+
if: steps.android-build-cache.outputs.cache-hit != 'true'
47+
run: yarn react-native build-android --mode release --tasks assembleRelease --extra-params "-PnewArchEnabled=${{ matrix.new-arch }}"
48+
49+
- name: Upload App
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: android-app-${{ matrix.new-arch && 'new' || 'old' }}-arch
53+
path: ./packages/react-native-app/android/app/build/outputs/apk/release/app-release.apk
54+
55+
test-android:
56+
name: Test ${{ matrix.new-arch && 'new' || 'old'}} Arch
57+
needs: [build-android]
58+
runs-on: ubuntu-latest
59+
defaults:
60+
run:
61+
working-directory: ./packages/react-native-app
62+
strategy:
63+
matrix:
64+
new-arch: [false, true]
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v4
68+
69+
- name: Enable KVM Group Permissions
70+
run: |
71+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
72+
sudo udevadm control --reload-rules
73+
sudo udevadm trigger --name-match=kvm
74+
75+
- name: Gradle cache
76+
uses: gradle/actions/setup-gradle@v3
77+
78+
- name: Cache Virtual Device
79+
uses: actions/cache@v4
80+
id: android-virtual-device-cache
81+
with:
82+
path: |
83+
~/.android/avd/*
84+
~/.android/adb*
85+
key: android-virtual-device-api-level-33
86+
87+
- name: Create Virtual Device
88+
if: steps.android-virtual-device-cache.outputs.cache-hit != 'true'
89+
uses: reactivecircus/android-emulator-runner@v2
90+
with:
91+
api-level: 33
92+
target: google_apis
93+
arch: x86_64
94+
force-avd-creation: false
95+
working-directory: ./packages/react-native-app
96+
script: echo "Generated Android Virtual Device Snapshot for Caching"
97+
98+
- name: Install Maestro
99+
run: |
100+
curl -Ls "https://get.maestro.mobile.dev" | bash
101+
echo "$HOME/.maestro/bin" >> "$GITHUB_PATH"
102+
103+
- name: Download App
104+
uses: actions/download-artifact@v4
105+
with:
106+
name: android-app-${{ matrix.new-arch && 'new' || 'old' }}-arch
107+
path: ./packages/react-native-app/android/
108+
109+
- name: Run Tests
110+
uses: reactivecircus/android-emulator-runner@v2
111+
with:
112+
api-level: 33
113+
target: google_apis
114+
arch: x86_64
115+
force-avd-creation: false
116+
working-directory: ./packages/react-native-app
117+
script: |
118+
adb install ./android/app-release.apk
119+
maestro test ./e2e/show-map.yml --format junit
120+
121+
- name: Upload Report
122+
if: always()
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: Android Report ${{ matrix.new-arch && 'new' || 'old' }} Arch
126+
path: |
127+
./packages/react-native-app/report.xml
128+
~/.maestro/tests/**/*

.github/workflows/review-ios.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: iOS
2+
3+
on:
4+
workflow_call:
5+
# Review calls this Workflow
6+
7+
jobs:
8+
build-ios:
9+
name: Build ${{ matrix.new-arch && 'new' || 'old'}} Arch
10+
runs-on: macos-latest
11+
defaults:
12+
run:
13+
working-directory: ./packages/react-native-app
14+
strategy:
15+
matrix:
16+
new-arch: [false, true]
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup
22+
uses: ./.github/actions/setup
23+
24+
- name: Cache Cocoapods
25+
uses: actions/cache@v4
26+
id: cocoapods-cache
27+
with:
28+
path: ./packages/react-native-app/ios/Pods
29+
key: ${{ runner.os }}-cocoapods-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ hashFiles('./packages/react-native-app/ios/Podfile.lock') }}
30+
restore-keys: |
31+
${{ runner.os }}-cocoapods-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ hashFiles('./packages/react-native-app/ios/Podfile.lock') }}
32+
${{ runner.os }}-cocoapods-${{ matrix.new-arch && 'new' || 'old' }}-arch-
33+
34+
- name: Install Cocoapods
35+
# New Arch changes Podfile.lock so it always has to run
36+
if: matrix.new-arch || steps.cocoapods-cache.outputs.cache-hit != 'true'
37+
run: RCT_NEW_ARCH_ENABLED=${{ matrix.new-arch && '1' || '0' }} yarn pod:install
38+
39+
- name: Cache Build
40+
uses: actions/cache@v4
41+
id: ios-build-cache
42+
with:
43+
path: ./packages/react-native-app/ios/build
44+
key: ${{ runner.os }}-ios-build-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ github.workflow }}-${{ github.sha }}
45+
restore-keys: |
46+
${{ runner.os }}-ios-build-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ github.workflow }}-${{ github.sha }}
47+
${{ runner.os }}-ios-build-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ github.workflow }}-
48+
49+
- name: Build
50+
if: steps.ios-build-cache.outputs.cache-hit != 'true'
51+
# Like `react-native build-ios --mode Release` but adapted for simulators
52+
run: xcodebuild -workspace ios/MapLibreReactNativeExample.xcworkspace -scheme MapLibreReactNativeExample -configuration Release -sdk iphonesimulator -derivedDataPath ios/build
53+
54+
- name: Upload App
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: ios-app-${{ matrix.new-arch && 'new' || 'old' }}-arch
58+
# `.app` is a directory, so we have to archive one level above
59+
path: |
60+
./packages/react-native-app/ios/build/Build/Products/Release-iphonesimulator
61+
!./packages/react-native-app/ios/build/Build/Products/Release-iphonesimulator/**
62+
./packages/react-native-app/ios/build/Build/Products/Release-iphonesimulator/MapLibreReactNativeExample.app
63+
64+
test-ios:
65+
name: Test ${{ matrix.new-arch && 'new' || 'old'}} Arch
66+
needs: [build-ios]
67+
runs-on: macos-latest
68+
defaults:
69+
run:
70+
working-directory: ./packages/react-native-app
71+
strategy:
72+
matrix:
73+
new-arch: [false, true]
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v4
77+
78+
- name: Install Maestro
79+
run: |
80+
curl -Ls "https://get.maestro.mobile.dev" | bash
81+
echo "$HOME/.maestro/bin" >> "$GITHUB_PATH"
82+
83+
- name: Download App
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: ios-app-${{ matrix.new-arch && 'new' || 'old' }}-arch
87+
path: ./packages/react-native-app/ios
88+
89+
- name: Run Tests
90+
run: |
91+
xcrun simctl boot "iPhone 15 Pro"
92+
xcrun simctl install booted ./ios/MapLibreReactNativeExample.app
93+
maestro test ./e2e/show-map.yml --format junit
94+
95+
- name: Upload Report
96+
if: always()
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: iOS Report ${{ matrix.new-arch && 'new' || 'old' }} Arch
100+
path: |
101+
./packages/react-native-app/report.xml
102+
~/.maestro/tests/**/*

.github/workflows/review.yml

Lines changed: 7 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Review
22

33
on:
44
workflow_call:
5-
# Release calls this Workflow
5+
# Release calls this Workflow
66
pull_request:
77
branches:
88
- main
@@ -87,56 +87,10 @@ jobs:
8787
- name: Build Library
8888
run: yarn prepack
8989

90-
build-react-native-android:
91-
name: Build React Native Android
92-
needs: [lint-eslint, lint-tsc, test, codegen, build-library]
93-
runs-on: ubuntu-latest
94-
defaults:
95-
run:
96-
working-directory: ./packages/react-native-app
97-
steps:
98-
- name: Checkout
99-
uses: actions/checkout@v4
100-
101-
- name: Setup
102-
uses: ./.github/actions/setup
103-
104-
- name: Setup Azul Zulu OpenJDK
105-
uses: actions/setup-java@v4
106-
with:
107-
distribution: zulu
108-
java-version: 21
109-
110-
- name: Build Android
111-
run: ./gradlew assemble
112-
working-directory: packages/react-native-app/android
113-
114-
build-react-native-ios:
115-
name: Build React Native iOS & Test with Detox
116-
needs: [lint-eslint, lint-tsc, test, codegen, build-library]
117-
runs-on: macos-latest
118-
timeout-minutes: 30
119-
defaults:
120-
run:
121-
working-directory: ./packages/react-native-app
122-
steps:
123-
- name: Checkout
124-
uses: actions/checkout@v4
125-
126-
- name: Setup
127-
uses: ./.github/actions/setup
128-
129-
- name: Install Pod Dependencies
130-
run: cd ios && pod --version && pod install
131-
132-
- name: Install Detox Dependencies
133-
run: |
134-
brew tap wix/brew
135-
brew install applesimutils
136-
yarn detox clean-framework-cache && yarn detox build-framework-cache
137-
138-
- name: Build iOS
139-
run: yarn detox build -c ios.sim.release
90+
review-android:
91+
name: Android
92+
uses: ./.github/workflows/review-android.yml
14093

141-
- name: Test with Detox
142-
run: yarn detox test --debug-synchronization 200 -c ios.sim.release
94+
review-ios:
95+
name: iOS
96+
uses: ./.github/workflows/review-ios.yml

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,6 @@ packages/expo-app/android
9191

9292
# Build by bob
9393
lib/
94+
95+
# Maestro
96+
report.xml

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Which means, when you change something within [
3131
`/src/components/UserLocation.tsx`](/src/components/UserLocation.tsx)
3232
it will be reflected in any scene in example that uses that component.
3333

34-
TODO: A better overview of how we use jest, detox, etc. (issue #22)
34+
TODO: A better overview of how we use jest, Maestro, etc. (issue #22)
3535

3636
## Optional: Local development with `yalc`
3737

jest-setup.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
import "@testing-library/react-native/extend-expect";
33
import { NativeModules } from "react-native";
44

5-
// Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing
6-
jest.mock("react-native/Libraries/Animated/NativeAnimatedHelper");
7-
85
function keyMirror(keys: string[]) {
96
const obj: Record<string, string> = {};
107
keys.forEach((key) => (obj[key] = key));

jest.config.js

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

jest.config.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { Config } from "jest";
2+
3+
const config: Config = {
4+
preset: "@testing-library/react-native",
5+
6+
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json"],
7+
setupFilesAfterEnv: [
8+
"./jest-setup.ts",
9+
"./__tests__/__mocks__/react-native.mock.ts",
10+
],
11+
modulePathIgnorePatterns: [
12+
"<rootDir>/lib",
13+
"<rootDir>/packages/*",
14+
"__tests__/__mocks__",
15+
"fixtures",
16+
],
17+
collectCoverageFrom: ["src/**/*.{ts,tsx,js,jsx}"],
18+
};
19+
20+
module.exports = config;

0 commit comments

Comments
 (0)