Skip to content

Commit 8e5c895

Browse files
authored
ci(android): enable Android nightlies (#1189)
1 parent 7a7984a commit 8e5c895

File tree

3 files changed

+58
-6
lines changed

3 files changed

+58
-6
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- trunk
66
pull_request:
77
schedule:
8-
# nightly builds against react-native@nightly at 5:00
8+
# Nightly builds against react-native@nightly at 5:00
99
- cron: 0 5 * * *
1010
env:
1111
HOMEBREW_NO_INSTALL_CLEANUP: 1
@@ -220,7 +220,6 @@ jobs:
220220
matrix:
221221
os: [ubuntu-latest, windows-latest]
222222
runs-on: ${{ matrix.os }}
223-
if: ${{ github.event_name != 'schedule' }}
224223
steps:
225224
- name: Checkout
226225
uses: actions/checkout@v3
@@ -231,6 +230,7 @@ jobs:
231230
- name: Set up react-native@nightly
232231
if: ${{ github.event_name == 'schedule' }}
233232
run: |
233+
git apply scripts/android-nightly.patch
234234
npm run set-react-version -- nightly
235235
shell: bash
236236
- name: Install npm dependencies
@@ -242,13 +242,18 @@ jobs:
242242
npx jest
243243
working-directory: example
244244
- name: Bundle JavaScript
245+
# Metro on nightlies currently fails with "SHA-1 for file index.js is
246+
# not computed" so we'll skip this step for now.
247+
if: ${{ github.event_name != 'schedule' || matrix.os == 'ubuntu-latest' }}
245248
run: |
246249
# `npm run` fails with "Workspaces not supported for global packages"
247250
# on Windows if we don't use `yarn` here. ¯\_(ツ)_/¯
248251
yarn build:android || yarn build:android
249252
shell: bash
250253
working-directory: example
251254
- name: Build
255+
# Nightlies currently fail on Windows because of wrong path separators.
256+
if: ${{ github.event_name != 'schedule' || matrix.os == 'ubuntu-latest' }}
252257
uses: ./.github/actions/gradle
253258
with:
254259
project-root: example

example/test/config.test.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,9 @@ describe("react-native config", () => {
178178
project: expect.objectContaining({
179179
ios: {
180180
sourceDir: expect.stringContaining(sourceDir),
181-
xcodeProject: {
182-
name: "Example.xcworkspace",
183-
isWorkspace: true,
184-
},
181+
xcodeProject: fs.existsSync("ios/Pods")
182+
? { name: "Example.xcworkspace", isWorkspace: true }
183+
: null,
185184
},
186185
}),
187186
});

scripts/android-nightly.patch

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
diff --git a/example/App.js b/example/App.js
2+
index c9cd14d..f63758d 100644
3+
--- a/example/App.js
4+
+++ b/example/App.js
5+
@@ -2,6 +2,7 @@
6+
import React, { useCallback, useMemo, useState } from "react";
7+
import {
8+
NativeModules,
9+
+ SafeAreaView,
10+
ScrollView,
11+
StatusBar,
12+
StyleSheet,
13+
@@ -10,7 +11,6 @@ import {
14+
useColorScheme,
15+
View,
16+
} from "react-native";
17+
-import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
18+
// @ts-expect-error
19+
import { version as coreVersion } from "react-native/Libraries/Core/ReactNativeVersion";
20+
import { Colors, Header } from "react-native/Libraries/NewAppScreen";
21+
@@ -169,7 +169,6 @@ const App = ({ concurrentRoot }) => {
22+
);
23+
24+
return (
25+
- <SafeAreaProvider>
26+
<SafeAreaView style={styles.body}>
27+
<StatusBar barStyle={isDarkMode ? "light-content" : "dark-content"} />
28+
<ScrollView
29+
@@ -192,7 +191,6 @@ const App = ({ concurrentRoot }) => {
30+
</View>
31+
</ScrollView>
32+
</SafeAreaView>
33+
- </SafeAreaProvider>
34+
);
35+
};
36+
37+
diff --git a/example/package.json b/example/package.json
38+
index a51d4cf..512b9c6 100644
39+
--- a/example/package.json
40+
+++ b/example/package.json
41+
@@ -32,7 +32,6 @@
42+
"react": "17.0.2",
43+
"react-native": "^0.68.2",
44+
"react-native-macos": "^0.68.3",
45+
- "react-native-safe-area-context": "^4.3.4",
46+
"react-native-test-app": "workspace:.",
47+
"react-native-windows": "^0.68.8"
48+
},

0 commit comments

Comments
 (0)