mirror of
https://github.com/hanzoai/Detox.git
synced 2026-09-24 16:55:12 +00:00
build: move to yarn 4 (#4881)
This commit is contained in:
committed by
GitHub
parent
8c5f1e03c9
commit
4b8791d414
@@ -10,7 +10,7 @@
|
||||
key: 'android_package'
|
||||
command:
|
||||
- "nvm install"
|
||||
- "npm install"
|
||||
- "./scripts/install.sh"
|
||||
- "npm run package:android"
|
||||
env:
|
||||
DETOX_DISABLE_POSTINSTALL: true
|
||||
@@ -24,7 +24,7 @@
|
||||
- 'ios_package'
|
||||
command:
|
||||
- "nvm install 20"
|
||||
- "npm install"
|
||||
- "./scripts/install.sh"
|
||||
- "npm run release"
|
||||
env:
|
||||
DETOX_DISABLE_POD_INSTALL: true
|
||||
|
||||
@@ -24,28 +24,30 @@ jobs:
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
- name: Bootstrap Lerna
|
||||
run: npx lerna@6 bootstrap --no-ci
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
env:
|
||||
DETOX_DISABLE_POD_INSTALL: true
|
||||
DETOX_DISABLE_POSTINSTALL: true
|
||||
- name: Lint source project
|
||||
run: npm run lint
|
||||
run: yarn lint
|
||||
working-directory: detox
|
||||
- name: Lint test project
|
||||
run: npm run lint
|
||||
run: yarn lint
|
||||
working-directory: detox/test
|
||||
- name: Typings
|
||||
run: npm test
|
||||
run: yarn test
|
||||
working-directory: detox/test
|
||||
- name: Unit tests
|
||||
run: npm run unit
|
||||
run: yarn unit
|
||||
working-directory: detox
|
||||
- name: Integration tests
|
||||
run: npm run integration
|
||||
run: yarn integration
|
||||
working-directory: detox/test
|
||||
- name: Generation tests
|
||||
run: npm test
|
||||
run: yarn test
|
||||
working-directory: generation
|
||||
- name: Pack Allure results
|
||||
run: zip -r allure-results.zip detox/allure-results detox/test/allure-results generation/allure-results
|
||||
@@ -63,16 +65,18 @@ jobs:
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
- name: Bootstrap Lerna (Light)
|
||||
run: npx lerna@6 bootstrap --no-ci --include-dependents --include-dependencies --scope=detox-test
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
env:
|
||||
DETOX_DISABLE_POD_INSTALL: true
|
||||
DETOX_DISABLE_POSTINSTALL: true
|
||||
- name: Unit tests
|
||||
run: npm run unit -- --coverageThreshold "{}"
|
||||
run: yarn unit --coverageThreshold "{}"
|
||||
working-directory: detox
|
||||
- name: Integration tests
|
||||
run: npm run integration
|
||||
run: yarn integration
|
||||
working-directory: detox/test
|
||||
- name: Pack Allure results
|
||||
run: |
|
||||
|
||||
+13
-1
@@ -220,7 +220,15 @@ detox/DetoxBuild
|
||||
examples/demo-native-ios/Build
|
||||
examples/demo-native-ios/ModuleCache
|
||||
|
||||
yarn.lock
|
||||
# Yarn
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
.pnp.*
|
||||
|
||||
detox/ios_src
|
||||
package-lock.json
|
||||
/detox/src/devices/detox/notifications/notification.json
|
||||
@@ -232,6 +240,8 @@ detox/test/artifacts
|
||||
|
||||
Detox-android/
|
||||
Detox-ios-src.tbz
|
||||
Detox-ios-framework.tbz
|
||||
Detox-ios-xcuitest.tbz
|
||||
Detox-ios.tbz
|
||||
|
||||
|
||||
@@ -241,3 +251,5 @@ Detox-ios.tbz
|
||||
#ignore yalc
|
||||
.yalc/
|
||||
yalc.lock
|
||||
/scripts/publishing-e2e/
|
||||
.npmrc
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Strip registry-specific URLs from yarn.lock to keep it portable
|
||||
if [ -f yarn.lock ] && git diff --cached --name-only | grep -q "yarn.lock"; then
|
||||
if grep -q "__archiveUrl" yarn.lock; then
|
||||
echo "[husky::precommit] stripping __archiveUrl entries from yarn.lock..." >&2
|
||||
|
||||
# Cross-platform sed in-place (macOS requires '', Linux doesn't)
|
||||
# Handle both formats: ::__archiveUrl= and %3A%3A__archiveUrl= (URL-encoded)
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
sed -i '' 's/::__archiveUrl=[^"]*//g' yarn.lock
|
||||
sed -i '' 's/%3A%3A__archiveUrl=[^"]*//g' yarn.lock
|
||||
else
|
||||
sed -i 's/::__archiveUrl=[^"]*//g' yarn.lock
|
||||
sed -i 's/%3A%3A__archiveUrl=[^"]*//g' yarn.lock
|
||||
fi
|
||||
|
||||
git add yarn.lock
|
||||
fi
|
||||
|
||||
echo "[husky::precommit] validating yarn.lock..." >&2
|
||||
yarn install --immutable --mode skip-build || {
|
||||
echo "[husky::precommit] error: yarn.lock validation failed" >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
compressionLevel: mixed
|
||||
|
||||
enableGlobalCache: false
|
||||
|
||||
nmHoistingLimits: workspaces
|
||||
|
||||
nmMode: hardlinks-local
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
npmMinimalAgeGate: 14d
|
||||
|
||||
@@ -25,5 +25,8 @@
|
||||
"dependencies": {
|
||||
"chalk": "^4.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/wix/Detox"
|
||||
"homepage": "https://github.com/wix/Detox",
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -2,14 +2,15 @@
|
||||
"name": "detox",
|
||||
"description": "E2E tests and automation for mobile",
|
||||
"version": "20.46.0",
|
||||
"bin": {
|
||||
"detox": "local-cli/cli.js"
|
||||
},
|
||||
"bin": "local-cli/cli.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/wix/Detox.git"
|
||||
},
|
||||
"nativePackage": true,
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/wix/Detox/issues"
|
||||
},
|
||||
|
||||
@@ -366,14 +366,10 @@
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-example-ci/Pods-example-ci-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-example-ci/Pods-example-ci-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example-ci/Pods-example-ci-frameworks.sh\"\n";
|
||||
@@ -387,14 +383,10 @@
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks.sh\"\n";
|
||||
@@ -446,14 +438,10 @@
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh\"\n";
|
||||
@@ -467,14 +455,10 @@
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-example-ci/Pods-example-ci-resources-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-example-ci/Pods-example-ci-resources-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example-ci/Pods-example-ci-resources.sh\"\n";
|
||||
@@ -725,7 +709,10 @@
|
||||
"-DFOLLY_CFG_NO_COROUTINES=1",
|
||||
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
|
||||
);
|
||||
OTHER_LDFLAGS = "$(inherited) ";
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
" ",
|
||||
);
|
||||
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
|
||||
@@ -794,7 +781,10 @@
|
||||
"-DFOLLY_CFG_NO_COROUTINES=1",
|
||||
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
|
||||
);
|
||||
OTHER_LDFLAGS = "$(inherited) ";
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
" ",
|
||||
);
|
||||
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
||||
SDKROOT = iphoneos;
|
||||
USE_HERMES = true;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test:types": "tsc -p types/tsconfig.json",
|
||||
"test": "npm run lint && npm run test:types",
|
||||
"test": "yarn lint && yarn test:types",
|
||||
"postinstall": "node scripts/postinstall.js",
|
||||
"start": "react-native start",
|
||||
"packager": "react-native start",
|
||||
@@ -22,7 +22,7 @@
|
||||
"e2e-unhappy:android": "scripts/ci_unhappy.sh android",
|
||||
"integration": "jest --clearCache && jest --config integration/jest.config.js",
|
||||
"integration:console": "node integration/utils/printConsole.mjs info",
|
||||
"integration-update-snapshots": "npm run integration -- -u",
|
||||
"integration-update-snapshots": "yarn integration -u",
|
||||
"build:ios": "detox build -c ios.sim.release",
|
||||
"build:ios-debug": "detox build -c ios.sim.debug",
|
||||
"build:android": "detox build -c android.emu.release",
|
||||
@@ -70,6 +70,7 @@
|
||||
"detox": "^20.46.0",
|
||||
"detox-allure2-adapter": "1.0.0-alpha.34",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-plugin-jest": "^28.11.0",
|
||||
"eslint-plugin-unicorn": "^50.0.1",
|
||||
"execa": "^5.1.1",
|
||||
"express": "^4.15.3",
|
||||
|
||||
@@ -16,36 +16,51 @@ Currently, we require `lts/iron` (Node.js 20.x) for our development environment.
|
||||
|
||||
:::tip
|
||||
|
||||
The exhaustive list of LTS codenames (e.g. `lts/iron`) can be found at [CODENAMES.md](https://github.com/nodejs/Release/blob/main/CODENAMES.md) in the Node.js repository.
|
||||
The exhaustive list of LTS codenames (e.g. `lts/iron`) can be found at [CODENAMES.md](https://github.com/nodejs/Release/blob/main/CODENAMES.md) in the Node.js repository.
|
||||
|
||||
:::
|
||||
|
||||
## Setting Up The Monorepo Management
|
||||
## Setting Up The Monorepo
|
||||
|
||||
Our repository is a monorepo, which means it contains multiple Detox-related projects and packages. [Read more about our repository structure](../code/overview.md#repository-structure).
|
||||
Our repository is a monorepo managed with Yarn workspaces. [Read more about our repository structure](../code/overview.md#repository-structure).
|
||||
|
||||
To set up the monorepo locally, follow these steps:
|
||||
|
||||
Install the monorepo management tool, `lerna`:
|
||||
### 1. Enable Corepack
|
||||
|
||||
Corepack is Node.js's built-in package manager manager. Enable it to use the correct Yarn version:
|
||||
|
||||
```bash
|
||||
npm install [email protected] --global
|
||||
corepack enable
|
||||
```
|
||||
|
||||
Clone the repository and navigate to the project directory:
|
||||
### 2. Clone the Repository
|
||||
|
||||
```bash
|
||||
git clone [email protected]:wix/Detox.git
|
||||
cd detox
|
||||
cd Detox
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
From the project's root directory, install and link the internal projects:
|
||||
### 3. Install Dependencies
|
||||
|
||||
```bash
|
||||
lerna bootstrap
|
||||
yarn install
|
||||
```
|
||||
|
||||
:::note For Wix Internal Contributors
|
||||
|
||||
Set the internal registry before installing:
|
||||
|
||||
```bash
|
||||
export YARN_NPM_REGISTRY_SERVER="<company's private npm registry>"
|
||||
yarn install
|
||||
```
|
||||
|
||||
You can add this export to your shell profile (`~/.zshrc` or `~/.bashrc`) to make it permanent.
|
||||
|
||||
:::
|
||||
|
||||
## Installing Common Dependencies
|
||||
|
||||
### React-Native CLI
|
||||
@@ -72,6 +87,25 @@ brew install watchman
|
||||
gem install xcpretty
|
||||
```
|
||||
|
||||
## Switching React Native Versions
|
||||
|
||||
To test against different React Native versions:
|
||||
|
||||
```bash
|
||||
REACT_NATIVE_VERSION=0.77.0 ./scripts/change_all_react_native_versions.sh
|
||||
```
|
||||
|
||||
This updates the relevant `package.json` files and regenerates the lock file.
|
||||
|
||||
## Common Commands
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `yarn install` | Install all dependencies |
|
||||
| `yarn workspaces foreach -A run build` | Build all packages |
|
||||
| `yarn workspace detox test` | Run detox tests |
|
||||
| `yarn workspace detox lint` | Run linting |
|
||||
|
||||
[react-native-cli]: https://www.npmjs.com/package/react-native-cli
|
||||
[Watchman]: https://facebook.github.io/watchman/
|
||||
[xcpretty]: https://github.com/xcpretty/xcpretty
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
"name": "demo-react-native-detox-instruments",
|
||||
"version": "20.46.0",
|
||||
"private": true,
|
||||
"scripts": {},
|
||||
"devDependencies": {
|
||||
"detox": "^20.46.0"
|
||||
},
|
||||
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"lerna": "6.6.2",
|
||||
"useWorkspaces": false,
|
||||
"packages": [
|
||||
"detox",
|
||||
"detox-cli",
|
||||
"detox/test",
|
||||
"examples/demo-native-android",
|
||||
"examples/demo-native-ios",
|
||||
"examples/demo-react-native",
|
||||
"examples/demo-react-native-detox-instruments",
|
||||
"examples/demo-react-native-jest",
|
||||
"examples/demo-plugin",
|
||||
"generation",
|
||||
"."
|
||||
],
|
||||
"version": "20.46.0",
|
||||
"npmClient": "npm",
|
||||
"command": {
|
||||
"publish": {
|
||||
"ignoreChanges": [
|
||||
"demo-react-native-jest",
|
||||
"demo-plugin",
|
||||
"examples/demo-react-native-detox-instruments",
|
||||
"detox-demo-native-android",
|
||||
"detox-demo-native-ios",
|
||||
"detox-demo-react-native",
|
||||
"detox-test",
|
||||
"generation",
|
||||
"."
|
||||
]
|
||||
},
|
||||
"bootstrap": {
|
||||
"npmClientArgs": [
|
||||
"--no-package-lock",
|
||||
"--legacy-peer-deps"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
-5
@@ -1,13 +1,23 @@
|
||||
{
|
||||
"name": "root",
|
||||
"private": true,
|
||||
"packageManager": "[email protected]",
|
||||
"workspaces": [
|
||||
"detox",
|
||||
"detox-cli",
|
||||
"detox/test",
|
||||
"examples/*",
|
||||
"generation",
|
||||
"website"
|
||||
],
|
||||
"scripts": {
|
||||
"prepare": "husky",
|
||||
"docs:markdownlint": "markdownlint -p .remarkignore '**/*.md'",
|
||||
"docs:remark": "remark .",
|
||||
"docs:lint": "npm run docs:markdownlint && npm run docs:remark",
|
||||
"docs:fix": "npm run docs:remark -- -o && npm run docs:markdownlint -- --fix",
|
||||
"test:e2e:ios": "pushd detox/test && npm run e2e:ios && popd",
|
||||
"test:e2e:android": "pushd detox/test && npm run e2e:android && popd",
|
||||
"docs:lint": "yarn docs:markdownlint && yarn docs:remark",
|
||||
"docs:fix": "yarn docs:remark -o && yarn docs:markdownlint --fix",
|
||||
"test:e2e:ios": "cd detox/test && yarn e2e:ios",
|
||||
"test:e2e:android": "cd detox/test && yarn e2e:android",
|
||||
"release": "node scripts/ci.release.js",
|
||||
"package:android": "node scripts/ci.android-release.js",
|
||||
"package:ios": "scripts/ci.ios-release.sh",
|
||||
@@ -24,7 +34,7 @@
|
||||
"devDependencies": {
|
||||
"chalk": "^4.0.0",
|
||||
"dictionary-en": "^3.1.0",
|
||||
"lerna": "^6.6.2",
|
||||
"husky": "^9.0.0",
|
||||
"lodash": "4.17.x",
|
||||
"markdownlint-cli": "^0.29.0",
|
||||
"remark": "^14.0.1",
|
||||
|
||||
@@ -4,4 +4,7 @@ if [ ! -z ${REACT_NATIVE_VERSION} ]; then
|
||||
node scripts/change_react_native_version.js "examples/demo-react-native" ${REACT_NATIVE_VERSION} "dependencies"
|
||||
node scripts/change_react_native_version.js "detox/test" ${REACT_NATIVE_VERSION} "dependencies"
|
||||
node scripts/change_react_native_version.js "detox" ${REACT_NATIVE_VERSION} "devDependencies"
|
||||
|
||||
# Update lockfile for the new RN version
|
||||
yarn install --mode update-lockfile
|
||||
fi
|
||||
|
||||
@@ -4,17 +4,17 @@ const {log, logSection, getVersionSafe, getReleaseNpmTag, getReleaseVersionType}
|
||||
function run() {
|
||||
logSection('Initializing');
|
||||
exec.execSync('bash scripts/change_all_react_native_versions.sh')
|
||||
exec.execSync('lerna bootstrap --no-ci');
|
||||
exec.execSync('yarn install');
|
||||
|
||||
const versionType = getReleaseVersionType();
|
||||
logSection(`Pre-calculating future version... (versionType=${versionType})`);
|
||||
|
||||
const npmTag = getReleaseNpmTag();
|
||||
const preid = npmTag === 'latest'? '': `--preid=${npmTag}`;
|
||||
exec.execSync(`lerna version --yes ${versionType} ${preid} --no-git-tag-version --force-publish=detox --no-push`);
|
||||
const preid = npmTag === 'latest' ? '' : `--preid=${npmTag}`;
|
||||
exec.execSync(`npm version ${versionType} ${preid} --no-git-tag-version`);
|
||||
const futureVersion = getVersionSafe();
|
||||
log('Version is: ' + futureVersion);
|
||||
|
||||
|
||||
logSection('Packing up Android artifacts...');
|
||||
log('Accepting all Android SDK licenses...');
|
||||
exec.execSync(`yes | ${process.env.ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --licenses`);
|
||||
|
||||
@@ -10,12 +10,12 @@ source $(dirname "$0")/ci.sh
|
||||
|
||||
### JS integration tests
|
||||
pushd detox/test
|
||||
run_f "npm run integration"
|
||||
run_f "yarn integration"
|
||||
popd
|
||||
|
||||
### Android native unit tests
|
||||
pushd detox/android
|
||||
run_f "npm run unit:android-release"
|
||||
run_f "yarn unit:android-release"
|
||||
popd
|
||||
|
||||
mkdir -p coverage
|
||||
@@ -23,22 +23,22 @@ mkdir -p coverage
|
||||
### E2E self-tests
|
||||
pushd detox/test
|
||||
|
||||
run_f "npm run build:android-debug" # Workaround for asyncstorage issue https://github.com/react-native-async-storage/async-storage/issues/1216. Can be removed after fixing it
|
||||
run_f "npm run build:android"
|
||||
run_f "yarn build:android-debug" # Workaround for asyncstorage issue https://github.com/react-native-async-storage/async-storage/issues/1216. Can be removed after fixing it
|
||||
run_f "yarn build:android"
|
||||
|
||||
if [ "$USE_GENYCLOUD_ARM64" = "true" ]; then
|
||||
run_f "npm run e2e:android:genycloud-arm64"
|
||||
run_f "yarn e2e:android:genycloud-arm64"
|
||||
cp coverage/lcov.info ../../coverage/e2e-genycloud-ci.lcov
|
||||
else
|
||||
run_f "npm run e2e:android"
|
||||
run_f "yarn e2e:android"
|
||||
cp coverage/lcov.info ../../coverage/e2e-emulator-ci.lcov
|
||||
|
||||
# Sanity-test support for genycloud (though not ARM)
|
||||
run_f "npm run e2e:android:genycloud -- e2e/01* e2e/02* e2e/03.actions*"
|
||||
run_f "yarn e2e:android:genycloud -- e2e/01* e2e/02* e2e/03.actions*"
|
||||
cp coverage/lcov.info ../../coverage/e2e-genycloud-ci.lcov
|
||||
fi
|
||||
|
||||
run_f "scripts/ci_unhappy.sh android"
|
||||
|
||||
# run_f "npm run verify-artifacts:android"
|
||||
# run_f "yarn verify-artifacts:android"
|
||||
popd
|
||||
|
||||
+3
-3
@@ -22,11 +22,11 @@ pushd detox/test
|
||||
## After this command sims are available again
|
||||
xcrun simctl list > /dev/null
|
||||
|
||||
run_f "npm run build:ios"
|
||||
run_f "npm run e2e:ios"
|
||||
run_f "yarn build:ios"
|
||||
run_f "yarn e2e:ios"
|
||||
cp coverage/lcov.info ../../coverage/e2e-ios-ci.lcov
|
||||
|
||||
run_f "scripts/ci_unhappy.sh ios"
|
||||
|
||||
# run_f "npm run verify-artifacts:ios"
|
||||
# run_f "yarn verify-artifacts:ios"
|
||||
popd
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* tslint:disable: no-console */
|
||||
const fs = require('fs');
|
||||
const {exec} = require('shell-utils');
|
||||
|
||||
const {
|
||||
@@ -13,7 +12,6 @@ function run() {
|
||||
|
||||
log('Configuring stuff...');
|
||||
setupGitConfig();
|
||||
setupNpmConfig();
|
||||
getPackagesFromPreviousBuilds();
|
||||
versionTagAndPublish();
|
||||
}
|
||||
@@ -32,19 +30,6 @@ function setupGitConfig() {
|
||||
exec.execSyncSilent(`git remote set-url origin "https://${process.env.GIT_USER}:${process.env.GIT_TOKEN}@${remoteUrl}"`);
|
||||
}
|
||||
|
||||
function setupNpmConfig() {
|
||||
exec.execSync(`rm -f package-lock.json`);
|
||||
const content = `
|
||||
email=\${NPM_EMAIL}
|
||||
//registry.npmjs.org/:_authToken=\${NPM_TOKEN}
|
||||
`;
|
||||
fs.writeFileSync(`.npmrc`, content);
|
||||
|
||||
// Workaround. see https://github.com/lerna/lerna/issues/361
|
||||
fs.copyFileSync('.npmrc', 'detox/.npmrc');
|
||||
fs.copyFileSync('.npmrc', 'detox-cli/.npmrc');
|
||||
}
|
||||
|
||||
function versionTagAndPublish() {
|
||||
logSection('Preparing to tag/release');
|
||||
|
||||
|
||||
+1
-2
@@ -5,5 +5,4 @@ source $(dirname "$0")/install.sh
|
||||
|
||||
source $(dirname "$0")/change_all_react_native_versions.sh
|
||||
|
||||
run_f "lerna bootstrap --no-ci"
|
||||
run_f "lerna run build"
|
||||
run_f "yarn workspaces foreach -A run build"
|
||||
|
||||
@@ -11,12 +11,12 @@ SCRIPTS_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
source $SCRIPTS_PATH/demo-projects.sh
|
||||
|
||||
pushd detox
|
||||
run_f "npm run build:android"
|
||||
run_f "yarn build:android"
|
||||
popd
|
||||
|
||||
pushd examples/demo-react-native
|
||||
run_f "npm run build:android-debug"
|
||||
run_f "npm run test:android-debug"
|
||||
run_f "yarn build:android-debug"
|
||||
run_f "yarn test:android-debug"
|
||||
|
||||
# Run tests in release mode with bloated JS bundle:
|
||||
source $SCRIPTS_PATH/demo-rn-bloat-bundle-test.sh android
|
||||
@@ -29,12 +29,12 @@ if [ "$REACT_NATIVE_COMPAT_TEST" = "true" ]; then
|
||||
fi
|
||||
|
||||
pushd examples/demo-plugin
|
||||
run_f "npm run test:plugin"
|
||||
run_f "yarn test:plugin"
|
||||
popd
|
||||
|
||||
# Detox Native
|
||||
##
|
||||
|
||||
pushd detox
|
||||
run_f "npm run build:android-native"
|
||||
run_f "yarn build:android-native"
|
||||
popd
|
||||
|
||||
@@ -13,10 +13,9 @@ pushd examples/demo-react-native
|
||||
run_f "pod install"
|
||||
popd
|
||||
|
||||
run_f "npm run build:ios-debug"
|
||||
run_f "npm run test:ios-debug"
|
||||
run_f "yarn build:ios-debug"
|
||||
run_f "yarn test:ios-debug"
|
||||
|
||||
# Run tests with bloated JS bundle:
|
||||
source $SCRIPTS_PATH/demo-rn-bloat-bundle-test.sh ios
|
||||
popd
|
||||
|
||||
|
||||
@@ -12,9 +12,11 @@ if [ "$REACT_NATIVE_COMPAT_TEST" != "true" ]; then
|
||||
node scripts/change_react_native_version.js "detox" ${REACT_NATIVE_VERSION} "devDependencies"
|
||||
fi
|
||||
|
||||
# Update the dependencies of the test project because bootstrap will run and fail
|
||||
# Update the dependencies of the test project
|
||||
node scripts/change_react_native_version.js "detox/test" ${REACT_NATIVE_VERSION} "dependencies"
|
||||
# Only update the demo-react-native project; others will use this binary
|
||||
node scripts/change_react_native_version.js "examples/demo-react-native" ${REACT_NATIVE_VERSION} "dependencies"
|
||||
|
||||
run_f "lerna bootstrap --no-ci"
|
||||
# Update lockfile for new RN version
|
||||
run_f "yarn install --mode update-lockfile"
|
||||
run_f "yarn install"
|
||||
|
||||
@@ -13,11 +13,11 @@ echo "Bloating the demo project bundle for $OS_PLATFORM"
|
||||
cp $BUNDLE_PATH $BUNDLE_PATH.original
|
||||
|
||||
# Bloat the bundle:
|
||||
npm run bloat-bundle -- ./$BUNDLE_FILE
|
||||
yarn bloat-bundle ./$BUNDLE_FILE
|
||||
|
||||
# Run the tests:
|
||||
npm run build:$OS_PLATFORM-release
|
||||
npm run test:$OS_PLATFORM-release
|
||||
yarn build:$OS_PLATFORM-release
|
||||
yarn test:$OS_PLATFORM-release
|
||||
|
||||
# Reverse the bloating:
|
||||
mv $BUNDLE_PATH.original $BUNDLE_PATH
|
||||
|
||||
+4
-2
@@ -3,5 +3,7 @@
|
||||
echo "Node version:"
|
||||
node --version
|
||||
|
||||
npm install -g [email protected]
|
||||
npm install -g react-native-cli >/dev/null 2>&1
|
||||
corepack enable
|
||||
echo "Yarn version: $(yarn --version)"
|
||||
|
||||
yarn install --immutable
|
||||
|
||||
+10
-2
@@ -8,8 +8,16 @@ fi
|
||||
echo "[Publish] VERSION_TYPE=$VERSION_TYPE"
|
||||
echo ""
|
||||
|
||||
echo "[Publish] Starting lerna publish..."
|
||||
lerna publish --cd-version "$VERSION_TYPE" --yes --skip-git
|
||||
echo "[Publish] Bumping version..."
|
||||
yarn version $VERSION_TYPE
|
||||
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
|
||||
echo "[Publish] Publishing detox@$VERSION..."
|
||||
cd detox && npm publish && cd ..
|
||||
|
||||
echo "[Publish] Publishing detox-cli@$VERSION..."
|
||||
cd detox-cli && npm publish && cd ..
|
||||
|
||||
echo "[Publish] Updating Github..."
|
||||
git add -A
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/* tslint:disable: no-console */
|
||||
const exec = require('shell-utils').exec;
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const {
|
||||
log,
|
||||
@@ -32,31 +34,84 @@ function publishNewVersion() {
|
||||
}
|
||||
|
||||
function validatePrerequisites() {
|
||||
const lernaBin = exec.which('lerna');
|
||||
if (!lernaBin) {
|
||||
throw new Error(`Cannot publish: lerna not installed!`);
|
||||
const yarnVersion = exec.execSyncRead('yarn --version').trim();
|
||||
if (!yarnVersion.startsWith('4')) {
|
||||
throw new Error(`Cannot publish: Yarn 4.x required, got ${yarnVersion}`);
|
||||
}
|
||||
}
|
||||
|
||||
function getPublishablePackages() {
|
||||
const output = exec.execSyncRead('yarn workspaces list --json --no-private');
|
||||
return output
|
||||
.trim()
|
||||
.split('\n')
|
||||
.filter(Boolean)
|
||||
.map(line => JSON.parse(line).location);
|
||||
}
|
||||
|
||||
function projectSetup() {
|
||||
logSection('Project setup');
|
||||
exec.execSync(`git checkout ${process.env.BUILDKITE_BRANCH}`);
|
||||
}
|
||||
|
||||
function createNpmRc() {
|
||||
const content = `
|
||||
email=\${NPM_EMAIL}
|
||||
//registry.npmjs.org/:_authToken=\${NPM_TOKEN}
|
||||
`;
|
||||
fs.writeFileSync('.npmrc', content);
|
||||
log('Created .npmrc for npm authentication');
|
||||
}
|
||||
|
||||
function publishToNpm(npmTag) {
|
||||
logSection('Lerna publish');
|
||||
logSection('Yarn publish');
|
||||
const versionType = getReleaseVersionType();
|
||||
const dryRun = isDryRun();
|
||||
const skipNpm = isSkipNpm();
|
||||
|
||||
if (dryRun) {
|
||||
log('DRY RUN: Lerna-publishing without publishing to NPM');
|
||||
}
|
||||
else if (skipNpm) {
|
||||
log('SKIP NPM is set: Lerna-publishing without publishing to NPM');
|
||||
log('DRY RUN: Publishing without pushing to NPM');
|
||||
} else if (skipNpm) {
|
||||
log('SKIP NPM is set: Skipping NPM publish');
|
||||
}
|
||||
|
||||
const preid = versionType.includes("pre") ? `--preid=${npmTag}` : ``;
|
||||
exec.execSync(`lerna publish ${versionType} --yes --dist-tag ${npmTag} ${preid} ${dryRun ? '--no-push': ''} ${(dryRun || skipNpm) ? '--skip-npm' : ''} -m "Publish %v [ci skip]" --tag-version-prefix='' --force-publish=detox --loglevel trace`);
|
||||
// Bump version in root package.json using npm (supports --preid unlike yarn 4)
|
||||
const preid = versionType.includes("pre") ? `--preid=${npmTag}` : '';
|
||||
exec.execSync(`npm version ${versionType} ${preid} --no-git-tag-version`);
|
||||
|
||||
const rootPkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'));
|
||||
const newVersion = rootPkg.version;
|
||||
|
||||
// Update versions in workspace packages
|
||||
const packages = getPublishablePackages();
|
||||
log(`Publishing version ${newVersion} for packages: ${packages.join(', ')}`);
|
||||
|
||||
for (const pkg of packages) {
|
||||
const pkgPath = path.join(process.cwd(), pkg, 'package.json');
|
||||
if (fs.existsSync(pkgPath)) {
|
||||
const pkgJson = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
||||
pkgJson.version = newVersion;
|
||||
fs.writeFileSync(pkgPath, JSON.stringify(pkgJson, null, 2) + '\n');
|
||||
}
|
||||
}
|
||||
|
||||
if (!dryRun && !skipNpm) {
|
||||
createNpmRc();
|
||||
// Publish each public package
|
||||
for (const pkg of packages) {
|
||||
log(`Publishing ${pkg}@${newVersion} with tag ${npmTag}`);
|
||||
exec.execSync(`cd ${pkg} && npm publish --tag ${npmTag}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Git operations
|
||||
if (!dryRun) {
|
||||
exec.execSync(`git add -A`);
|
||||
exec.execSync(`git commit -m "Publish ${newVersion} [ci skip]"`);
|
||||
exec.execSync(`git tag ${newVersion}`);
|
||||
exec.execSync(`git push`);
|
||||
exec.execSync(`git push --tags`);
|
||||
}
|
||||
}
|
||||
|
||||
function releaseDocsVersion(newVersion, previousVersion) {
|
||||
|
||||
@@ -12,8 +12,8 @@ function buildDocsForVersion(version) {
|
||||
|
||||
try {
|
||||
process.chdir(docsPath);
|
||||
exec.execSync(`npm install`);
|
||||
exec.execSync(`npm run docusaurus docs:version ${version}`);
|
||||
exec.execSync(`yarn install`);
|
||||
exec.execSync(`yarn docusaurus docs:version ${version}`);
|
||||
exec.execSync(`git add .`);
|
||||
exec.execSync(`git diff --staged --quiet || git commit -m "Publish docs version ${version}"`);
|
||||
exec.execSync(`git push origin ${process.env.BUILDKITE_BRANCH}`);
|
||||
|
||||
+4
-10
@@ -20,18 +20,12 @@ The exhaustive list of LTS codenames (e.g. `lts/iron`) can be found at [CODENAM
|
||||
|
||||
:::
|
||||
|
||||
## Setting Up The Monorepo Management
|
||||
## Setting Up The Monorepo
|
||||
|
||||
Our repository is a monorepo, which means it contains multiple Detox-related projects and packages. [Read more about our repository structure](../code/overview.md#repository-structure).
|
||||
Our repository is a monorepo managed with [Yarn 4 workspaces](https://yarnpkg.com/features/workspaces), which means it contains multiple Detox-related projects and packages. [Read more about our repository structure](../code/overview.md#repository-structure).
|
||||
|
||||
To set up the monorepo locally, follow these steps:
|
||||
|
||||
Install the monorepo management tool, `lerna`:
|
||||
|
||||
```bash
|
||||
npm install [email protected] --global
|
||||
```
|
||||
|
||||
Clone the repository and navigate to the project directory:
|
||||
|
||||
```bash
|
||||
@@ -40,10 +34,10 @@ cd detox
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
From the project's root directory, install and link the internal projects:
|
||||
From the project's root directory, install dependencies and link the internal projects:
|
||||
|
||||
```bash
|
||||
lerna bootstrap
|
||||
yarn install
|
||||
```
|
||||
|
||||
## Installing Common Dependencies
|
||||
|
||||
Reference in New Issue
Block a user