From 3d82dd41ff34d385605e8823f76bf4dbedf4faa1 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 19 Jun 2025 11:57:39 +0100 Subject: [PATCH 01/13] drop artifactory from generate-react-native-fixture script --- scripts/generate-react-native-fixture.js | 71 +++++++++++++++--------- 1 file changed, 45 insertions(+), 26 deletions(-) mode change 100644 => 100755 scripts/generate-react-native-fixture.js diff --git a/scripts/generate-react-native-fixture.js b/scripts/generate-react-native-fixture.js old mode 100644 new mode 100755 index 44087a7eb7..79f499be6d --- a/scripts/generate-react-native-fixture.js +++ b/scripts/generate-react-native-fixture.js @@ -3,7 +3,6 @@ const { execFileSync, execSync } = require('child_process') const { resolve } = require('path') const fs = require('fs') -const common = require('./common') const androidUtils = require('./react-native/android-utils') const iosUtils = require('./react-native/ios-utils') @@ -12,18 +11,11 @@ if (!process.env.RN_VERSION) { process.exit(1) } -if (!process.env.REGISTRY_URL) { - console.error('Please provide a Registry URL') - process.exit(1) -} - if (!process.env.RCT_NEW_ARCH_ENABLED || (process.env.RCT_NEW_ARCH_ENABLED !== '1' && process.env.RCT_NEW_ARCH_ENABLED !== '0')) { console.error('RCT_NEW_ARCH_ENABLED must be set to 1 or 0') process.exit(1) } -const notifierVersion = process.env.NOTIFIER_VERSION || common.getCommitId() - const reactNativeVersion = process.env.RN_VERSION const ROOT_DIR = resolve(__dirname, '../') @@ -42,16 +34,8 @@ if (isNewArchEnabled) { } const fixtureDir = resolve(ROOT_DIR, fixturePath, reactNativeVersion) - const replacementFilesDir = resolve(ROOT_DIR, 'test/react-native/features/fixtures/app/dynamic/') -const PEER_DEPENDENCIES = [ - 'react-native-file-access@3.1.1', - `@bugsnag/react-native@${notifierVersion}`, - `@bugsnag/plugin-react-navigation@${notifierVersion}`, - `@bugsnag/plugin-react-native-navigation@${notifierVersion}` -] - let reactNavigationVersion = '6.1.18' let reactNavigationNativeStackVersion = '6.11.0' let reactNativeScreensVersion = '3.35.0' @@ -72,7 +56,7 @@ const REACT_NAVIGATION_PEER_DEPENDENCIES = [ `react-native-safe-area-context@${reactNativeSafeAreaContextVersion}` ] -const reactNativeNavigationVersion = '7.41.0' // Issue with 7.42.0 +const reactNativeNavigationVersion = '7.41.0' const REACT_NATIVE_NAVIGATION_PEER_DEPENDENCIES = [ `react-native-navigation@${reactNativeNavigationVersion}` ] @@ -118,24 +102,59 @@ if (process.env.BUILD_IOS === 'true' || process.env.BUILD_IOS === '1') { iosUtils.buildIPA(fixtureDir) } +// Pack all the required Bugsnag packages +function packLocalPackages() { + const packagesDir = resolve(ROOT_DIR, 'packages') + const packages = [ + 'react-native', + 'delivery-react-native', + 'plugin-react-native-client-sync', + 'plugin-react-native-event-sync', + 'plugin-react-native-global-error-handler', + 'plugin-react-native-hermes', + 'plugin-react-native-navigation', + 'plugin-react-native-orientation-breadcrumbs', + 'plugin-react-native-session', + 'plugin-react-native-unhandled-rejection', + 'plugin-react-navigation' + ] + + // Pack each package and move the tarballs to the fixture directory + for (const pkg of packages) { + execSync(`npm pack "${resolve(packagesDir, pkg)}" --pack-destination "${fixtureDir}"`, { stdio: 'inherit' }) + } +} + function installFixtureDependencies () { - // add dependencies for react-native-navigation (wix) + // Pack local packages first + packLocalPackages() + + // Install non-Bugsnag dependencies + const externalDependencies = [] + + // Add dependencies for react-native-navigation (wix) if (process.env.REACT_NATIVE_NAVIGATION === 'true' || process.env.REACT_NATIVE_NAVIGATION === '1') { - PEER_DEPENDENCIES.push(...REACT_NATIVE_NAVIGATION_PEER_DEPENDENCIES) + externalDependencies.push(...REACT_NATIVE_NAVIGATION_PEER_DEPENDENCIES) } else if (!isNewArchEnabled) { - // add dependencies for @react-navigation - PEER_DEPENDENCIES.push(...REACT_NAVIGATION_PEER_DEPENDENCIES) + // Add dependencies for @react-navigation + externalDependencies.push(...REACT_NAVIGATION_PEER_DEPENDENCIES) } - const fixtureDependencyArgs = PEER_DEPENDENCIES.join(' ') + // Add react-native-file-access which is a non-Bugsnag dependency + externalDependencies.push('react-native-file-access@3.1.1') + + // Install external dependencies first + if (externalDependencies.length > 0) { + execSync(`npm install --save --save-exact ${externalDependencies.join(' ')} --legacy-peer-deps`, { cwd: fixtureDir, stdio: 'inherit' }) + } - // install test fixture dependencies - execSync(`npm install --save --save-exact ${fixtureDependencyArgs} --registry ${process.env.REGISTRY_URL} --legacy-peer-deps`, { cwd: fixtureDir, stdio: 'inherit' }) + // Install local Bugsnag packages from tarballs + execSync('npm install --save bugsnag-*.tgz --legacy-peer-deps', { cwd: fixtureDir, stdio: 'inherit' }) - // install the scenario launcher package + // Pack and install the scenario launcher package const scenarioLauncherPackage = `${ROOT_DIR}/test/react-native/features/fixtures/scenario-launcher` execSync(`npm pack ${scenarioLauncherPackage} --pack-destination ${fixtureDir}`, { cwd: ROOT_DIR, stdio: 'inherit' }) - execSync(`npm install --save bugsnag-react-native-scenarios-*.tgz --registry ${process.env.REGISTRY_URL}`, { cwd: fixtureDir, stdio: 'inherit' }) + execSync('npm install --save bugsnag-react-native-scenarios-*.tgz', { cwd: fixtureDir, stdio: 'inherit' }) } /** Replace native files generated by react-native cli with pre-configured files */ From 2cf12acd297e21be3e249c476c80be5b90ec3741 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 19 Jun 2025 12:38:03 +0100 Subject: [PATCH 02/13] ensure pipelines do not depend on publish-js --- .buildkite/basic/react-native-android-full-pipeline.yml | 4 ---- .buildkite/basic/react-native-android-pipeline.yml | 2 -- .buildkite/basic/react-native-ios-full-pipeline.yml | 5 ----- .buildkite/basic/react-native-ios-pipeline.yml | 2 -- 4 files changed, 13 deletions(-) diff --git a/.buildkite/basic/react-native-android-full-pipeline.yml b/.buildkite/basic/react-native-android-full-pipeline.yml index fda9113fd3..0614088b09 100644 --- a/.buildkite/basic/react-native-android-full-pipeline.yml +++ b/.buildkite/basic/react-native-android-full-pipeline.yml @@ -82,7 +82,6 @@ steps: - label: ':android: Build RN {{matrix}} test fixture APK (Old Arch)' key: "build-react-native-android-fixture-old-arch-full" - depends_on: "publish-js" timeout_in_minutes: 15 agents: queue: macos-node-18 @@ -110,7 +109,6 @@ steps: - label: ':android: Build RN {{matrix}} test fixture APK (New Arch)' key: "build-react-native-android-fixture-new-arch-full" - depends_on: "publish-js" timeout_in_minutes: 15 agents: queue: macos-node-18 @@ -138,7 +136,6 @@ steps: - label: ':android: Build react-native-navigation {{matrix}} test fixture APK (Old Arch)' key: "build-react-native-navigation-android-fixture-old-arch" - depends_on: "publish-js" timeout_in_minutes: 30 agents: queue: macos-node-18 @@ -164,7 +161,6 @@ steps: - label: ':android: Build react-native-navigation {{matrix}} test fixture APK (New Arch)' key: "build-react-native-navigation-android-fixture-new-arch" - depends_on: "publish-js" timeout_in_minutes: 30 agents: queue: macos-node-18 diff --git a/.buildkite/basic/react-native-android-pipeline.yml b/.buildkite/basic/react-native-android-pipeline.yml index aab114e22a..52611dace7 100644 --- a/.buildkite/basic/react-native-android-pipeline.yml +++ b/.buildkite/basic/react-native-android-pipeline.yml @@ -7,7 +7,6 @@ steps: steps: - label: ':android: Build RN {{matrix}} test fixture APK (Old Arch)' key: "build-react-native-android-fixture-old-arch" - depends_on: "publish-js" timeout_in_minutes: 15 agents: queue: macos-node-18 @@ -31,7 +30,6 @@ steps: - label: ':android: Build RN {{matrix}} test fixture APK (New Arch)' key: "build-react-native-android-fixture-new-arch" - depends_on: "publish-js" timeout_in_minutes: 15 agents: queue: macos-node-18 diff --git a/.buildkite/basic/react-native-ios-full-pipeline.yml b/.buildkite/basic/react-native-ios-full-pipeline.yml index 0fcc6a74db..27a2e56f98 100644 --- a/.buildkite/basic/react-native-ios-full-pipeline.yml +++ b/.buildkite/basic/react-native-ios-full-pipeline.yml @@ -11,7 +11,6 @@ steps: # - label: ":ios: Build RN 0.68 Hermes ipa" key: "rn-0-68-hermes-ipa" - depends_on: "publish-js" timeout_in_minutes: 20 agents: queue: "macos-12-arm" @@ -29,7 +28,6 @@ steps: - label: ":ios: Build RN 0.69 ipa" key: "rn-0-69-ipa" - depends_on: "publish-js" timeout_in_minutes: 20 agents: queue: "macos-12-arm" @@ -47,7 +45,6 @@ steps: - label: ':mac: Build RN {{matrix}} test fixture ipa (Old Arch)' key: "build-react-native-ios-fixture-old-arch-full" - depends_on: "publish-js" timeout_in_minutes: 30 agents: queue: "macos-15" @@ -75,7 +72,6 @@ steps: - label: ':mac: Build RN {{matrix}} test fixture ipa (New Arch)' key: "build-react-native-ios-fixture-new-arch-full" - depends_on: "publish-js" timeout_in_minutes: 30 agents: queue: "macos-15" @@ -103,7 +99,6 @@ steps: - label: ':mac: Build react-native-navigation {{matrix}} test fixture ipa (Old Arch)' key: "build-react-native-navigation-ios-fixture-old-arch" - depends_on: "publish-js" timeout_in_minutes: 30 agents: queue: "macos-15" diff --git a/.buildkite/basic/react-native-ios-pipeline.yml b/.buildkite/basic/react-native-ios-pipeline.yml index cf58a57c63..c6161393b4 100644 --- a/.buildkite/basic/react-native-ios-pipeline.yml +++ b/.buildkite/basic/react-native-ios-pipeline.yml @@ -11,7 +11,6 @@ steps: # - label: ':mac: Build RN {{matrix}} test fixture ipa (Old Arch)' key: "build-react-native-ios-fixture-old-arch" - depends_on: "publish-js" timeout_in_minutes: 20 agents: queue: "macos-15" @@ -35,7 +34,6 @@ steps: - label: ':mac: Build RN {{matrix}} test fixture ipa (New Arch)' key: "build-react-native-ios-fixture-new-arch" - depends_on: "publish-js" timeout_in_minutes: 20 agents: queue: "macos-15" From 676cc164f946eea26f0cf19312347b37f282e52f Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 19 Jun 2025 15:19:28 +0100 Subject: [PATCH 03/13] use local version of packages for cli fixture builder --- .../basic/react-native-cli-pipeline.yml | 2 -- scripts/generate-react-native-cli-fixture.js | 25 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.buildkite/basic/react-native-cli-pipeline.yml b/.buildkite/basic/react-native-cli-pipeline.yml index 717ef68f2a..7307f793a0 100644 --- a/.buildkite/basic/react-native-cli-pipeline.yml +++ b/.buildkite/basic/react-native-cli-pipeline.yml @@ -7,7 +7,6 @@ steps: steps: - label: ':android: RN CLI - {{matrix}} Android build and sourcemap upload tests' key: "build-react-native-cli-android-fixture" - depends_on: "publish-js" timeout_in_minutes: 15 agents: queue: "macos-15-isolated" @@ -35,7 +34,6 @@ steps: - label: ':mac: RN CLI - {{matrix}} iOS build and sourcemap upload tests' key: "build-react-native-cli-ios-fixture" - depends_on: "publish-js" timeout_in_minutes: 20 agents: queue: "macos-15-isolated" diff --git a/scripts/generate-react-native-cli-fixture.js b/scripts/generate-react-native-cli-fixture.js index e45c5d2922..8272d80873 100644 --- a/scripts/generate-react-native-cli-fixture.js +++ b/scripts/generate-react-native-cli-fixture.js @@ -12,11 +12,6 @@ if (!process.env.RN_VERSION) { process.exit(1) } -if (!process.env.REGISTRY_URL) { - console.error('Please provide a Registry URL') - process.exit(1) -} - if (!process.env.RCT_NEW_ARCH_ENABLED || (process.env.RCT_NEW_ARCH_ENABLED !== '1' && process.env.RCT_NEW_ARCH_ENABLED !== '0')) { console.error('RCT_NEW_ARCH_ENABLED must be set to 1 or 0') process.exit(1) @@ -43,9 +38,18 @@ const fixtureDir = resolve(ROOT_DIR, fixturePath, reactNativeVersion) const replacementFilesDir = resolve(ROOT_DIR, 'test/react-native-cli/features/fixtures/app/dynamic/') -const PEER_DEPENDENCIES = [ - `@bugsnag/react-native-cli@${notifierVersion}` -] +function packLocalPackages() { + // Pack the react-native-cli package + const packagesDir = resolve(ROOT_DIR, 'packages') + const packages = [ + 'react-native-cli' + ] + + // Pack each package and move the tarballs to the fixture directory + for (const pkg of packages) { + execSync(`npm pack "${resolve(packagesDir, pkg)}" --pack-destination "${fixtureDir}"`, { stdio: 'inherit' }) + } +} // Generate the fixture if (!process.env.SKIP_GENERATE_FIXTURE) { @@ -64,8 +68,9 @@ if (!process.env.SKIP_GENERATE_FIXTURE) { iosUtils.configureIOSProject(fixtureDir) - // install the peer dependencies - execSync(`npm install --save ${PEER_DEPENDENCIES} --registry ${process.env.REGISTRY_URL} --legacy-peer-deps`, { cwd: fixtureDir, stdio: 'inherit' }) + // Pack and install local packages + packLocalPackages() + execSync('npm install --save bugsnag-*.tgz --legacy-peer-deps', { cwd: fixtureDir, stdio: 'inherit' }) if (process.env.INIT_RN_CLI === 'true' || process.env.INIT_RN_CLI === '1') { enableSourceMaps() From b3c0622e6cbd053267dd069b4ca9ba3c937b91ec Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 19 Jun 2025 15:20:24 +0100 Subject: [PATCH 04/13] remove unnecessary packages --- scripts/generate-react-native-fixture.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/scripts/generate-react-native-fixture.js b/scripts/generate-react-native-fixture.js index 79f499be6d..eaaf9a844d 100755 --- a/scripts/generate-react-native-fixture.js +++ b/scripts/generate-react-native-fixture.js @@ -107,15 +107,7 @@ function packLocalPackages() { const packagesDir = resolve(ROOT_DIR, 'packages') const packages = [ 'react-native', - 'delivery-react-native', - 'plugin-react-native-client-sync', - 'plugin-react-native-event-sync', - 'plugin-react-native-global-error-handler', - 'plugin-react-native-hermes', 'plugin-react-native-navigation', - 'plugin-react-native-orientation-breadcrumbs', - 'plugin-react-native-session', - 'plugin-react-native-unhandled-rejection', 'plugin-react-navigation' ] From b7b92d00618993acfa363d95532dd768bcf3f36a Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 19 Jun 2025 15:22:21 +0100 Subject: [PATCH 05/13] build packages first --- scripts/generate-react-native-cli-fixture.js | 3 +++ scripts/generate-react-native-fixture.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/scripts/generate-react-native-cli-fixture.js b/scripts/generate-react-native-cli-fixture.js index 8272d80873..65160e2aee 100644 --- a/scripts/generate-react-native-cli-fixture.js +++ b/scripts/generate-react-native-cli-fixture.js @@ -39,6 +39,9 @@ const fixtureDir = resolve(ROOT_DIR, fixturePath, reactNativeVersion) const replacementFilesDir = resolve(ROOT_DIR, 'test/react-native-cli/features/fixtures/app/dynamic/') function packLocalPackages() { + // Build all packages first + execSync('npm run build', { cwd: ROOT_DIR, stdio: 'inherit' }) + // Pack the react-native-cli package const packagesDir = resolve(ROOT_DIR, 'packages') const packages = [ diff --git a/scripts/generate-react-native-fixture.js b/scripts/generate-react-native-fixture.js index eaaf9a844d..45dfb00643 100755 --- a/scripts/generate-react-native-fixture.js +++ b/scripts/generate-react-native-fixture.js @@ -104,6 +104,9 @@ if (process.env.BUILD_IOS === 'true' || process.env.BUILD_IOS === '1') { // Pack all the required Bugsnag packages function packLocalPackages() { + // Build all packages first + execSync('npm run build', { cwd: ROOT_DIR, stdio: 'inherit' }) + const packagesDir = resolve(ROOT_DIR, 'packages') const packages = [ 'react-native', From 1f8cdf6936963c59aa12a18d208b7f958e9b340b Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 19 Jun 2025 15:37:33 +0100 Subject: [PATCH 06/13] add missing parentheses (linting) --- scripts/generate-react-native-cli-fixture.js | 2 +- scripts/generate-react-native-fixture.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/generate-react-native-cli-fixture.js b/scripts/generate-react-native-cli-fixture.js index 65160e2aee..a5ffd473a0 100644 --- a/scripts/generate-react-native-cli-fixture.js +++ b/scripts/generate-react-native-cli-fixture.js @@ -38,7 +38,7 @@ const fixtureDir = resolve(ROOT_DIR, fixturePath, reactNativeVersion) const replacementFilesDir = resolve(ROOT_DIR, 'test/react-native-cli/features/fixtures/app/dynamic/') -function packLocalPackages() { +function packLocalPackages () { // Build all packages first execSync('npm run build', { cwd: ROOT_DIR, stdio: 'inherit' }) diff --git a/scripts/generate-react-native-fixture.js b/scripts/generate-react-native-fixture.js index 45dfb00643..d68319055a 100755 --- a/scripts/generate-react-native-fixture.js +++ b/scripts/generate-react-native-fixture.js @@ -103,10 +103,10 @@ if (process.env.BUILD_IOS === 'true' || process.env.BUILD_IOS === '1') { } // Pack all the required Bugsnag packages -function packLocalPackages() { +function packLocalPackages () { // Build all packages first execSync('npm run build', { cwd: ROOT_DIR, stdio: 'inherit' }) - + const packagesDir = resolve(ROOT_DIR, 'packages') const packages = [ 'react-native', From 58c66408f9bbb7af3135ad40846dfcf0859df5c2 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 19 Jun 2025 15:50:49 +0100 Subject: [PATCH 07/13] run install before build --- scripts/generate-react-native-cli-fixture.js | 1 + scripts/generate-react-native-fixture.js | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/generate-react-native-cli-fixture.js b/scripts/generate-react-native-cli-fixture.js index a5ffd473a0..ff47439ce4 100644 --- a/scripts/generate-react-native-cli-fixture.js +++ b/scripts/generate-react-native-cli-fixture.js @@ -40,6 +40,7 @@ const replacementFilesDir = resolve(ROOT_DIR, 'test/react-native-cli/features/fi function packLocalPackages () { // Build all packages first + execSync('npm install', { cwd: ROOT_DIR, stdio: 'inherit' }) execSync('npm run build', { cwd: ROOT_DIR, stdio: 'inherit' }) // Pack the react-native-cli package diff --git a/scripts/generate-react-native-fixture.js b/scripts/generate-react-native-fixture.js index d68319055a..f64afccdfc 100755 --- a/scripts/generate-react-native-fixture.js +++ b/scripts/generate-react-native-fixture.js @@ -105,6 +105,7 @@ if (process.env.BUILD_IOS === 'true' || process.env.BUILD_IOS === '1') { // Pack all the required Bugsnag packages function packLocalPackages () { // Build all packages first + execSync('npm install', { cwd: ROOT_DIR, stdio: 'inherit' }) execSync('npm run build', { cwd: ROOT_DIR, stdio: 'inherit' }) const packagesDir = resolve(ROOT_DIR, 'packages') From 488104103600f49118139c99b4e24c1bde2417ac Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 19 Jun 2025 15:59:20 +0100 Subject: [PATCH 08/13] skip playwright browser download --- .buildkite/basic/react-native-android-full-pipeline.yml | 6 ++++++ .buildkite/basic/react-native-android-pipeline.yml | 2 ++ .buildkite/basic/react-native-cli-pipeline.yml | 2 ++ .buildkite/basic/react-native-ios-full-pipeline.yml | 5 +++++ .buildkite/basic/react-native-ios-pipeline.yml | 2 ++ 5 files changed, 17 insertions(+) diff --git a/.buildkite/basic/react-native-android-full-pipeline.yml b/.buildkite/basic/react-native-android-full-pipeline.yml index 0614088b09..dacf5f4e4e 100644 --- a/.buildkite/basic/react-native-android-full-pipeline.yml +++ b/.buildkite/basic/react-native-android-full-pipeline.yml @@ -50,6 +50,7 @@ steps: timeout_in_minutes: 20 env: REACT_NATIVE_VERSION: "rn0.68-hermes" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" plugins: - docker-compose#v4.12.0: pull: react-native-android-builder-java-11-node-16 @@ -69,6 +70,7 @@ steps: timeout_in_minutes: 20 env: REACT_NATIVE_VERSION: "rn0.69" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" plugins: - docker-compose#v4.12.0: pull: react-native-android-builder-java-11-node-16 @@ -91,6 +93,7 @@ steps: RN_VERSION: "{{matrix}}" RCT_NEW_ARCH_ENABLED: "0" BUILD_ANDROID: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/old-arch/**/reactnative.apk" commands: @@ -118,6 +121,7 @@ steps: RN_VERSION: "{{matrix}}" RCT_NEW_ARCH_ENABLED: "1" BUILD_ANDROID: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/new-arch/**/reactnative.apk" commands: @@ -146,6 +150,7 @@ steps: RCT_NEW_ARCH_ENABLED: "0" BUILD_ANDROID: "true" REACT_NATIVE_NAVIGATION: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/react-native-navigation/old-arch/**/reactnative.apk" commands: @@ -171,6 +176,7 @@ steps: RCT_NEW_ARCH_ENABLED: "1" BUILD_ANDROID: "true" REACT_NATIVE_NAVIGATION: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/react-native-navigation/new-arch/**/reactnative.apk" commands: diff --git a/.buildkite/basic/react-native-android-pipeline.yml b/.buildkite/basic/react-native-android-pipeline.yml index 52611dace7..a29436b8bf 100644 --- a/.buildkite/basic/react-native-android-pipeline.yml +++ b/.buildkite/basic/react-native-android-pipeline.yml @@ -16,6 +16,7 @@ steps: RN_VERSION: "{{matrix}}" RCT_NEW_ARCH_ENABLED: "0" BUILD_ANDROID: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/old-arch/**/reactnative.apk" commands: @@ -39,6 +40,7 @@ steps: RN_VERSION: "{{matrix}}" RCT_NEW_ARCH_ENABLED: "1" BUILD_ANDROID: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/new-arch/**/reactnative.apk" commands: diff --git a/.buildkite/basic/react-native-cli-pipeline.yml b/.buildkite/basic/react-native-cli-pipeline.yml index 7307f793a0..0167a6ecc7 100644 --- a/.buildkite/basic/react-native-cli-pipeline.yml +++ b/.buildkite/basic/react-native-cli-pipeline.yml @@ -17,6 +17,7 @@ steps: RCT_NEW_ARCH_ENABLED: "0" BUILD_ANDROID: "true" INIT_RN_CLI: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native-cli/features/fixtures/generated/old-arch/**/reactnative.apk" commands: @@ -45,6 +46,7 @@ steps: XCODE_VERSION: "16.2.0" INIT_RN_CLI: "true" EXPORT_ARCHIVE: "0" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native-cli/features/fixtures/generated/old-arch/**/output/reactnative.ipa" commands: diff --git a/.buildkite/basic/react-native-ios-full-pipeline.yml b/.buildkite/basic/react-native-ios-full-pipeline.yml index 27a2e56f98..686c327351 100644 --- a/.buildkite/basic/react-native-ios-full-pipeline.yml +++ b/.buildkite/basic/react-native-ios-full-pipeline.yml @@ -18,6 +18,7 @@ steps: REACT_NATIVE_VERSION: rn0.68-hermes LANG: "en_US.UTF-8" DEVELOPER_DIR: "/Applications/Xcode14.app" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: build/rn0.68-hermes.ipa commands: - npm run test:build-react-native-ios @@ -35,6 +36,7 @@ steps: REACT_NATIVE_VERSION: rn0.69 LANG: "en_US.UTF-8" DEVELOPER_DIR: "/Applications/Xcode14.app" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: build/rn0.69.ipa commands: - npm run test:build-react-native-ios @@ -54,6 +56,7 @@ steps: RCT_NEW_ARCH_ENABLED: "0" BUILD_IOS: "true" XCODE_VERSION: "16.2.0" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/old-arch/**/output/reactnative.ipa" commands: @@ -81,6 +84,7 @@ steps: RCT_NEW_ARCH_ENABLED: "1" BUILD_IOS: "true" XCODE_VERSION: "16.2.0" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/new-arch/**/output/reactnative.ipa" commands: @@ -109,6 +113,7 @@ steps: BUILD_IOS: "true" XCODE_VERSION: "16.2.0" REACT_NATIVE_NAVIGATION: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/react-native-navigation/old-arch/**/output/reactnative.ipa" commands: diff --git a/.buildkite/basic/react-native-ios-pipeline.yml b/.buildkite/basic/react-native-ios-pipeline.yml index c6161393b4..625aa4e0cb 100644 --- a/.buildkite/basic/react-native-ios-pipeline.yml +++ b/.buildkite/basic/react-native-ios-pipeline.yml @@ -20,6 +20,7 @@ steps: RCT_NEW_ARCH_ENABLED: "0" BUILD_IOS: "true" XCODE_VERSION: "16.2.0" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/old-arch/**/output/reactnative.ipa" commands: @@ -43,6 +44,7 @@ steps: RCT_NEW_ARCH_ENABLED: "1" BUILD_IOS: "true" XCODE_VERSION: "16.2.0" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/new-arch/**/output/reactnative.ipa" commands: From a1ca8c41ed1a08d065ac042bf4dc8818b34e4766 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 19 Jun 2025 17:22:12 +0100 Subject: [PATCH 09/13] install packages from repo --- .../basic/react-native-ios-full-pipeline.yml | 2 + package.json | 1 + scripts/generate-react-native-cli-fixture.js | 2 +- scripts/generate-react-native-fixture.js | 2 +- scripts/publish_local.js | 52 +++++++++++++++++++ scripts/react-native-helper.js | 17 +++--- 6 files changed, 67 insertions(+), 9 deletions(-) create mode 100755 scripts/publish_local.js diff --git a/.buildkite/basic/react-native-ios-full-pipeline.yml b/.buildkite/basic/react-native-ios-full-pipeline.yml index 686c327351..557320073e 100644 --- a/.buildkite/basic/react-native-ios-full-pipeline.yml +++ b/.buildkite/basic/react-native-ios-full-pipeline.yml @@ -21,6 +21,7 @@ steps: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: build/rn0.68-hermes.ipa commands: + - npm run test:publish - npm run test:build-react-native-ios retry: automatic: @@ -39,6 +40,7 @@ steps: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: build/rn0.69.ipa commands: + - npm run test:publish - npm run test:build-react-native-ios retry: automatic: diff --git a/package.json b/package.json index 07d341ab39..db304a6247 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,7 @@ "test:build-react-native-ios": "bundle install && node -e 'require(\"./scripts/react-native-helper\").buildIOS()'", "test:build-react-native-maze-runner": "docker-compose build --pull react-native-maze-runner", "test:node": "npm run test:build-node-container && docker compose run --use-aliases node-maze-runner", + "test:publish": "node scripts/publish_local.js", "test:react-native:ios": "npm run test:build-react-native-ios && npm run test:build-react-native-maze-runner && APP_LOCATION=build/$REACT_NATIVE_VERSION.ipa docker-compose run --use-aliases react-native-maze-runner", "local-npm:start": "verdaccio --config test/electron/local-npm-config.yml --listen 0.0.0.0:5539", "local-npm:publish-all": "lerna publish \"$VERSION_IDENTIFIER\" --yes --force-publish --exact --no-push --no-git-reset --no-git-tag-version --registry 'http://0.0.0.0:5539'", diff --git a/scripts/generate-react-native-cli-fixture.js b/scripts/generate-react-native-cli-fixture.js index ff47439ce4..c551626487 100644 --- a/scripts/generate-react-native-cli-fixture.js +++ b/scripts/generate-react-native-cli-fixture.js @@ -40,7 +40,7 @@ const replacementFilesDir = resolve(ROOT_DIR, 'test/react-native-cli/features/fi function packLocalPackages () { // Build all packages first - execSync('npm install', { cwd: ROOT_DIR, stdio: 'inherit' }) + execSync('npm ci', { cwd: ROOT_DIR, stdio: 'inherit' }) execSync('npm run build', { cwd: ROOT_DIR, stdio: 'inherit' }) // Pack the react-native-cli package diff --git a/scripts/generate-react-native-fixture.js b/scripts/generate-react-native-fixture.js index f64afccdfc..8cb8f6d82f 100755 --- a/scripts/generate-react-native-fixture.js +++ b/scripts/generate-react-native-fixture.js @@ -105,7 +105,7 @@ if (process.env.BUILD_IOS === 'true' || process.env.BUILD_IOS === '1') { // Pack all the required Bugsnag packages function packLocalPackages () { // Build all packages first - execSync('npm install', { cwd: ROOT_DIR, stdio: 'inherit' }) + execSync('npm ci', { cwd: ROOT_DIR, stdio: 'inherit' }) execSync('npm run build', { cwd: ROOT_DIR, stdio: 'inherit' }) const packagesDir = resolve(ROOT_DIR, 'packages') diff --git a/scripts/publish_local.js b/scripts/publish_local.js new file mode 100755 index 0000000000..233bd315af --- /dev/null +++ b/scripts/publish_local.js @@ -0,0 +1,52 @@ +const { execSync } = require('child_process') +const { resolve } = require('path') +const fs = require('fs') + +const ROOT_DIR = resolve(__dirname, '..') + +function run(command, options = {}) { + console.log(`Running: ${command}`) + execSync(command, { stdio: 'inherit', ...options }) +} + +function packPackages() { + // Get all package directories + const packagesDir = resolve(ROOT_DIR, 'packages') + const packages = fs.readdirSync(packagesDir) + .filter(dir => { + // Filter out any non-directories or hidden directories + const stat = fs.statSync(resolve(packagesDir, dir)) + return stat.isDirectory() && !dir.startsWith('.') + }) + + // Create a dist directory if it doesn't exist + const distDir = resolve(ROOT_DIR, 'dist') + if (!fs.existsSync(distDir)) { + fs.mkdirSync(distDir) + } + + console.log('\nPacking packages...') + for (const pkg of packages) { + const packagePath = resolve(packagesDir, pkg) + run(`npm pack "${packagePath}"`, { cwd: distDir }) + } +} + +async function main() { + try { + console.log('Installing dependencies...') + run('npm ci', { cwd: ROOT_DIR }) + + console.log('\nBuilding packages...') + run('npm run build', { cwd: ROOT_DIR }) + + packPackages() + + console.log('\nDone! Packages are available in the dist directory') + } catch (error) { + console.error('Error:', error) + process.exit(1) + } +} + +main() diff --git a/scripts/react-native-helper.js b/scripts/react-native-helper.js index 720a138d9b..16af3be308 100644 --- a/scripts/react-native-helper.js +++ b/scripts/react-native-helper.js @@ -1,6 +1,7 @@ // This script is designed to be run within the react-native-android-builder Docker image // It copies just the files it needs from the source 'fixtures' directory in the destination, // before running gradlew (to avoid the need to download gradle multiple times). +const { resolve } = require('path') const common = require('./common') const fs = require('fs') @@ -67,7 +68,6 @@ module.exports = { try { const version = process.env.NOTIFIER_VERSION || common.getCommitId() const rnVersion = process.env.REACT_NATIVE_VERSION - const registryUrl = process.env.REGISTRY_URL const fixtureDir = 'test/react-native/features/fixtures' const targetDir = `${fixtureDir}/${rnVersion}` const initialDir = process.cwd() @@ -83,28 +83,31 @@ module.exports = { } // We're not in docker so check the above are set - if (rnVersion === undefined || registryUrl === undefined) { - throw new Error('Both REACT_NATIVE_VERSION and REGISTRY_URL environment variables must be set') + if (rnVersion === undefined) { + throw new Error('REACT_NATIVE_VERSION environment variables must be set') } // Copy the JS code into the test fixture console.log(`Copying JS app data from ${fixtureDir}/app to ${targetDir}`) common.run(`rsync -a ${fixtureDir}/app/${jsSourceDir}/ ${targetDir}`, true) + const reactNativePath = resolve('dist', 'bugsnag-react-native-cli-*.tgz') + // JavaScript layer console.log(`Changing directory to: ${targetDir} and running "npm install"`) common.changeDir(`${targetDir}`) - common.run(`npm install --registry ${registryUrl}`, true) + common.run(`npm ci`, true) // Install notifier - console.log(`Installing notifier: ${version}`) - const command = `npm install @bugsnag/react-native@${version} --registry ${registryUrl} --legacy-peer-deps` + console.log(`Installing notifier`) + const command = `npm install ${reactNativePath}` common.run(command, true) // Install react-native-file-access - const RNFACommand = `npm install react-native-file-access@3.0.4 --registry ${registryUrl}` + const RNFACommand = `npm install react-native-file-access@3.0.4` common.run(RNFACommand, true) + // TODO: What does this do? Do we need it? // Install any required secondary files if (fs.existsSync('./install.sh')) { common.run(`BUGSNAG_VERSION=${version} ./install.sh`, true) From 153b6de94c27b7dd32dd8ebdffd79c4ec29623ee Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 19 Jun 2025 17:33:21 +0100 Subject: [PATCH 10/13] add new publish script --- .buildkite/pipeline.yml | 17 +++++++++++++++++ .../{publish_local.js => publish-packages.js} | 0 2 files changed, 17 insertions(+) rename scripts/{publish_local.js => publish-packages.js} (100%) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 5bd701b08f..bd0d77f4c8 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -38,6 +38,23 @@ steps: - exit_status: "*" limit: 1 + - label: "Build and publish JS packages (new)" + key: "publish-new" + timeout_in_minutes: 10 + agents: + queue: "macos-node-18" + env: + NODE_VERSION: "18" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" + command: + - "node scripts/publish-packages.js" + - "zip -r packages.zip dist/*.tgz" + artifact_paths: "packages.zip" + retry: + automatic: + - exit_status: "*" + limit: 1 + # # Core tests and checks # diff --git a/scripts/publish_local.js b/scripts/publish-packages.js similarity index 100% rename from scripts/publish_local.js rename to scripts/publish-packages.js From f5c5bef21c3baa858b8f9293d1ff8e42ca8f72d9 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Fri, 20 Jun 2025 10:20:05 +0100 Subject: [PATCH 11/13] use local publish pipeline --- .../basic/react-native-ios-pipeline.yml | 8 ++++++ .buildkite/pipeline.yml | 4 +-- scripts/generate-react-native-fixture.js | 27 ++++++++++++------- scripts/publish-packages.js | 8 +++--- scripts/react-native-helper.js | 6 ++--- 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/.buildkite/basic/react-native-ios-pipeline.yml b/.buildkite/basic/react-native-ios-pipeline.yml index 625aa4e0cb..9faafe9af9 100644 --- a/.buildkite/basic/react-native-ios-pipeline.yml +++ b/.buildkite/basic/react-native-ios-pipeline.yml @@ -11,6 +11,10 @@ steps: # - label: ':mac: Build RN {{matrix}} test fixture ipa (Old Arch)' key: "build-react-native-ios-fixture-old-arch" + depends_on: "publish-js-new" + plugins: + artifacts#v1.9.0: + download: "packages.zip" timeout_in_minutes: 20 agents: queue: "macos-15" @@ -35,6 +39,10 @@ steps: - label: ':mac: Build RN {{matrix}} test fixture ipa (New Arch)' key: "build-react-native-ios-fixture-new-arch" + depends_on: "publish-js-new" + plugins: + artifacts#v1.9.0: + download: "packages.zip" timeout_in_minutes: 20 agents: queue: "macos-15" diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index bd0d77f4c8..d125f06cf7 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -38,8 +38,8 @@ steps: - exit_status: "*" limit: 1 - - label: "Build and publish JS packages (new)" - key: "publish-new" + - label: "Build and publish JS packages (local)" + key: "publish-js-new" timeout_in_minutes: 10 agents: queue: "macos-node-18" diff --git a/scripts/generate-react-native-fixture.js b/scripts/generate-react-native-fixture.js index 8cb8f6d82f..6d777263d2 100755 --- a/scripts/generate-react-native-fixture.js +++ b/scripts/generate-react-native-fixture.js @@ -102,13 +102,9 @@ if (process.env.BUILD_IOS === 'true' || process.env.BUILD_IOS === '1') { iosUtils.buildIPA(fixtureDir) } -// Pack all the required Bugsnag packages -function packLocalPackages () { - // Build all packages first - execSync('npm ci', { cwd: ROOT_DIR, stdio: 'inherit' }) - execSync('npm run build', { cwd: ROOT_DIR, stdio: 'inherit' }) - - const packagesDir = resolve(ROOT_DIR, 'packages') +// Move all the required Bugsnag packages to the fixture directory +function getLocalPackages () { + const packagesDir = resolve(ROOT_DIR, 'dist') const packages = [ 'react-native', 'plugin-react-native-navigation', @@ -117,13 +113,24 @@ function packLocalPackages () { // Pack each package and move the tarballs to the fixture directory for (const pkg of packages) { - execSync(`npm pack "${resolve(packagesDir, pkg)}" --pack-destination "${fixtureDir}"`, { stdio: 'inherit' }) + // move the tarball to the fixture directory + const tarballName = `bugsnag-${pkg}-*.tgz` + const tarballFiles = fs.readdirSync(packagesDir).filter(file => file.match(new RegExp(tarballName.replace('*', '.*')))) + if (tarballFiles.length === 0) { + console.warn(`No tarball found for ${tarballName} in ${packagesDir}. Please ensure the package is built and available.`) + continue + } + + const tarballFile = tarballFiles[0] + const tarballPath = resolve(packagesDir, tarballFile); + fs.copyFileSync(tarballPath, resolve(fixtureDir, tarballFile)); + console.log(`Copied ${tarballFile} to ${fixtureDir}`); } } function installFixtureDependencies () { - // Pack local packages first - packLocalPackages() + // Get local packages first + getLocalPackages() // Install non-Bugsnag dependencies const externalDependencies = [] diff --git a/scripts/publish-packages.js b/scripts/publish-packages.js index 233bd315af..9aa49ade3a 100755 --- a/scripts/publish-packages.js +++ b/scripts/publish-packages.js @@ -1,15 +1,17 @@ +#!/usr/bin/env node + const { execSync } = require('child_process') const { resolve } = require('path') const fs = require('fs') const ROOT_DIR = resolve(__dirname, '..') -function run(command, options = {}) { +function run (command, options = {}) { console.log(`Running: ${command}`) execSync(command, { stdio: 'inherit', ...options }) } -function packPackages() { +function packPackages () { // Get all package directories const packagesDir = resolve(ROOT_DIR, 'packages') const packages = fs.readdirSync(packagesDir) @@ -32,7 +34,7 @@ function packPackages() { } } -async function main() { +async function main () { try { console.log('Installing dependencies...') run('npm ci', { cwd: ROOT_DIR }) diff --git a/scripts/react-native-helper.js b/scripts/react-native-helper.js index 16af3be308..8fb8ec52aa 100644 --- a/scripts/react-native-helper.js +++ b/scripts/react-native-helper.js @@ -96,15 +96,15 @@ module.exports = { // JavaScript layer console.log(`Changing directory to: ${targetDir} and running "npm install"`) common.changeDir(`${targetDir}`) - common.run(`npm ci`, true) + common.run('npm ci', true) // Install notifier - console.log(`Installing notifier`) + console.log('Installing notifier') const command = `npm install ${reactNativePath}` common.run(command, true) // Install react-native-file-access - const RNFACommand = `npm install react-native-file-access@3.0.4` + const RNFACommand = 'npm install react-native-file-access@3.0.4' common.run(RNFACommand, true) // TODO: What does this do? Do we need it? From 25391fa3b83300d082309db117ab7bcc3ee9875f Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Fri, 20 Jun 2025 10:53:07 +0100 Subject: [PATCH 12/13] unzip packages --- .buildkite/basic/react-native-ios-pipeline.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.buildkite/basic/react-native-ios-pipeline.yml b/.buildkite/basic/react-native-ios-pipeline.yml index 9faafe9af9..e64e79515a 100644 --- a/.buildkite/basic/react-native-ios-pipeline.yml +++ b/.buildkite/basic/react-native-ios-pipeline.yml @@ -29,6 +29,7 @@ steps: - "test/react-native/features/fixtures/generated/old-arch/**/output/reactnative.ipa" commands: - "bundle install" + - "unzip -q packages.zip" - "node scripts/generate-react-native-fixture.js" matrix: - "0.79" @@ -57,6 +58,7 @@ steps: - "test/react-native/features/fixtures/generated/new-arch/**/output/reactnative.ipa" commands: - "bundle install" + - "unzip -q packages.zip" - "node scripts/generate-react-native-fixture.js" matrix: - "0.79" From e5653df4bc0f89606901a0efc0b96c619cbbc27f Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Fri, 20 Jun 2025 10:54:27 +0100 Subject: [PATCH 13/13] fix linting errors --- package.json | 2 +- scripts/generate-react-native-fixture.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index db304a6247..638617bb6c 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "test:build-react-native-ios": "bundle install && node -e 'require(\"./scripts/react-native-helper\").buildIOS()'", "test:build-react-native-maze-runner": "docker-compose build --pull react-native-maze-runner", "test:node": "npm run test:build-node-container && docker compose run --use-aliases node-maze-runner", - "test:publish": "node scripts/publish_local.js", + "test:publish": "node scripts/publish-packages.js", "test:react-native:ios": "npm run test:build-react-native-ios && npm run test:build-react-native-maze-runner && APP_LOCATION=build/$REACT_NATIVE_VERSION.ipa docker-compose run --use-aliases react-native-maze-runner", "local-npm:start": "verdaccio --config test/electron/local-npm-config.yml --listen 0.0.0.0:5539", "local-npm:publish-all": "lerna publish \"$VERSION_IDENTIFIER\" --yes --force-publish --exact --no-push --no-git-reset --no-git-tag-version --registry 'http://0.0.0.0:5539'", diff --git a/scripts/generate-react-native-fixture.js b/scripts/generate-react-native-fixture.js index 6d777263d2..88ed73e77e 100755 --- a/scripts/generate-react-native-fixture.js +++ b/scripts/generate-react-native-fixture.js @@ -119,12 +119,12 @@ function getLocalPackages () { if (tarballFiles.length === 0) { console.warn(`No tarball found for ${tarballName} in ${packagesDir}. Please ensure the package is built and available.`) continue - } - + } + const tarballFile = tarballFiles[0] - const tarballPath = resolve(packagesDir, tarballFile); - fs.copyFileSync(tarballPath, resolve(fixtureDir, tarballFile)); - console.log(`Copied ${tarballFile} to ${fixtureDir}`); + const tarballPath = resolve(packagesDir, tarballFile) + fs.copyFileSync(tarballPath, resolve(fixtureDir, tarballFile)) + console.log(`Copied ${tarballFile} to ${fixtureDir}`) } }