Skip to content

Commit 65d30d4

Browse files
authored
Introduce Subshells for Devbox (#1116)
* correction in docs * cleanup workflow file * update devbox with slimmed subshells for ci * fix omit-nix-env * script refactor, publish workflow verification * fix script path issues * devbox run update-shells task * run format
1 parent a4570b0 commit 65d30d4

29 files changed

Lines changed: 943 additions & 242 deletions

.envrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/bash
22

33
# Automatically sets up your devbox environment whenever you cd into this
4-
# directory via our direnv integration:
4+
# directory via our direnv integration.
5+
# Uses omit-nix-env as a temporary workaround: https://github.com/jetify-com/devbox/issues/1509
56

6-
eval "$(devbox generate direnv --print-envrc)"
7+
eval "$(devbox shellenv --init-hook --install --no-refresh-alias --omit-nix-env=true)"
78

89
# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
910
# for more details
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: E2E (Nightly)
1+
name: E2E (Full)
22

33
on:
44
schedule:
55
- cron: '0 6 * * *'
66
workflow_dispatch:
77

88
concurrency:
9-
group: e2e-nightly-${{ github.ref }}
9+
group: e2e-full-${{ github.ref }}
1010
cancel-in-progress: false
1111

1212
jobs:
@@ -54,7 +54,7 @@ jobs:
5454
echo "IOS_RUNTIME=${PLATFORM_IOS_MAX_RUNTIME}" >> "$GITHUB_ENV"
5555
fi
5656
- name: iOS E2E Tests
57-
run: devbox shell --omit-nix-env -- devbox run test-ios
57+
run: devbox run --config=shells/devbox-ios.json test-ios
5858

5959
run-e2e-android:
6060
runs-on: ubuntu-24.04-arm
@@ -102,4 +102,4 @@ jobs:
102102
avd_name="${device}_API${api}_arm64_v8a"
103103
echo "DETOX_AVD=${avd_name}" >> "$GITHUB_ENV"
104104
- name: Android E2E Tests
105-
run: devbox run test-android
105+
run: devbox run --config=shells/devbox-android.json test-android
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
name: E2E (On-Demand)
1+
name: E2E (Latest)
22

33
on:
44
workflow_dispatch:
5-
push:
6-
branches: [ci2]
75

86
concurrency:
9-
group: e2e-optional-${{ github.ref }}
7+
group: e2e-latest-${{ github.ref }}
108
cancel-in-progress: false
119

1210
jobs:
@@ -44,7 +42,7 @@ jobs:
4442
echo "DETOX_IOS_DEVICE=${PLATFORM_IOS_MAX_DEVICE}" >> "$GITHUB_ENV"
4543
echo "IOS_RUNTIME=${PLATFORM_IOS_MAX_RUNTIME}" >> "$GITHUB_ENV"
4644
- name: iOS E2E Tests (latest)
47-
run: devbox shell --omit-nix-env -- devbox run test-ios
45+
run: devbox run --config=shells/devbox-ios.json test-ios
4846

4947
run-e2e-android:
5048
runs-on: ubuntu-24.04-arm
@@ -80,4 +78,4 @@ jobs:
8078
avd_name="${device}_API${api}_arm64_v8a"
8179
echo "DETOX_AVD=${avd_name}" >> "$GITHUB_ENV"
8280
- name: Android E2E Tests (latest)
83-
run: devbox run test-android
81+
run: devbox run --config=shells/devbox-android.json test-android

.github/workflows/ci-fast.yml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,9 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
- name: Aggressive disk cleanup (Ubuntu)
19-
run: |
20-
sudo rm -rf /usr/share/dotnet
21-
sudo rm -rf /opt/ghc
22-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
23-
sudo rm -rf /opt/hostedtoolcache/CodeQL
24-
sudo rm -rf /usr/local/lib/android
25-
sudo rm -rf /usr/local/lib/node_modules
26-
sudo rm -rf /usr/local/share/boost
27-
sudo rm -rf /usr/local/share/chromium
28-
sudo rm -rf /usr/local/share/powershell
29-
sudo rm -rf /usr/local/share/edge_driver
30-
sudo rm -rf /usr/local/share/gecko_driver
31-
sudo rm -rf /usr/local/share/phantomjs
32-
sudo rm -rf "$HOME/.cache"
33-
df -H
34-
- name: Free Disk Space (Ubuntu)
35-
uses: jlumbroso/free-disk-space@v1.3.1
3618
- name: devbox installer
3719
uses: jetify-com/devbox-install-action@v0.14.0
3820
with:
3921
enable-cache: 'false'
4022
- name: build
41-
run: devbox run build
23+
run: devbox run --config=shells/devbox-fast.json build

.github/workflows/publish.yml

Lines changed: 111 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,118 @@ on:
99
required: true
1010

1111
jobs:
12+
fast-checks:
13+
name: Build + Lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: devbox installer
18+
uses: jetify-com/devbox-install-action@v0.14.0
19+
with:
20+
enable-cache: 'false'
21+
- name: build
22+
run: devbox run --config=shells/devbox-fast.json build
23+
24+
e2e-ios:
25+
name: E2E iOS (min/max)
26+
runs-on: macos-26
27+
env:
28+
YARN_ENABLE_HARDENED_MODE: 0
29+
XCODE_VERSION: '26.2'
30+
strategy:
31+
matrix:
32+
include:
33+
- name: ios-min
34+
- name: ios-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Aggressive disk cleanup (macOS)
38+
run: |
39+
sudo rm -rf /usr/share/dotnet
40+
sudo rm -rf /opt/ghc
41+
sudo rm -rf "/usr/local/share/boost"
42+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
43+
sudo rm -rf /Applications/Android\ Studio.app
44+
sudo rm -rf /usr/local/share/miniconda
45+
sudo rm -rf /opt/homebrew
46+
sudo rm -rf "$HOME/Library/Android"
47+
sudo rm -rf "$HOME/.gradle"
48+
sudo rm -rf "$HOME/Library/Developer/CoreSimulator/Devices"
49+
sudo rm -rf "$HOME/Library/Developer/Xcode/DerivedData"
50+
df -H
51+
- uses: maxim-lobanov/setup-xcode@v1
52+
with:
53+
xcode-version: '26.2'
54+
- name: devbox installer
55+
uses: jetify-com/devbox-install-action@v0.14.0
56+
with:
57+
enable-cache: 'false'
58+
- name: Resolve iOS targets
59+
run: |
60+
. scripts/platform-versions.sh
61+
if [ "${{ matrix.name }}" = "ios-min" ]; then
62+
echo "DETOX_IOS_DEVICE=${PLATFORM_IOS_MIN_DEVICE}" >> "$GITHUB_ENV"
63+
echo "IOS_RUNTIME=${PLATFORM_IOS_MIN_RUNTIME}" >> "$GITHUB_ENV"
64+
else
65+
echo "DETOX_IOS_DEVICE=${PLATFORM_IOS_MAX_DEVICE}" >> "$GITHUB_ENV"
66+
echo "IOS_RUNTIME=${PLATFORM_IOS_MAX_RUNTIME}" >> "$GITHUB_ENV"
67+
fi
68+
- name: iOS E2E Tests
69+
run: devbox run --config=shells/devbox-ios.json test-ios
70+
71+
e2e-android:
72+
name: E2E Android (min/max)
73+
runs-on: ubuntu-24.04-arm
74+
env:
75+
EMU_HEADLESS: 1
76+
strategy:
77+
matrix:
78+
include:
79+
- name: android-min
80+
target: min
81+
- name: android-latest
82+
target: max
83+
steps:
84+
- uses: actions/checkout@v4
85+
- name: Aggressive disk cleanup (Ubuntu)
86+
run: |
87+
sudo rm -rf /usr/share/dotnet
88+
sudo rm -rf /opt/ghc
89+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
90+
sudo rm -rf /opt/hostedtoolcache/CodeQL
91+
sudo rm -rf /usr/local/lib/android
92+
sudo rm -rf /usr/local/lib/node_modules
93+
sudo rm -rf /usr/local/share/boost
94+
sudo rm -rf /usr/local/share/chromium
95+
sudo rm -rf /usr/local/share/powershell
96+
sudo rm -rf /usr/local/share/edge_driver
97+
sudo rm -rf /usr/local/share/gecko_driver
98+
sudo rm -rf /usr/local/share/phantomjs
99+
sudo rm -rf "$HOME/.cache"
100+
df -H
101+
- name: devbox installer
102+
uses: jetify-com/devbox-install-action@v0.14.0
103+
with:
104+
enable-cache: 'false'
105+
- name: Resolve Android targets
106+
run: |
107+
. scripts/platform-versions.sh
108+
if [ "${{ matrix.target }}" = "min" ]; then
109+
api="$PLATFORM_ANDROID_MIN_API"
110+
device="$PLATFORM_ANDROID_MIN_DEVICE"
111+
else
112+
api="$PLATFORM_ANDROID_MAX_API"
113+
device="$PLATFORM_ANDROID_MAX_DEVICE"
114+
fi
115+
avd_name="${device}_API${api}_arm64_v8a"
116+
echo "DETOX_AVD=${avd_name}" >> "$GITHUB_ENV"
117+
- name: Android E2E Tests
118+
run: devbox run --config=shells/devbox-android.json test-android
119+
12120
publish:
13121
name: Publish to npm
14122
environment: Publish
123+
needs: [fast-checks, e2e-ios, e2e-android]
15124
runs-on: ubuntu-latest
16125
permissions:
17126
contents: write # to be able to publish a GitHub release
@@ -23,22 +132,10 @@ jobs:
23132
fetch-depth: 0
24133
token: ${{ secrets.GH_TOKEN }}
25134

26-
# Workaround for corepack enable in node
27-
# Source: (https://github.com/actions/setup-node/issues/899#issuecomment-1828798029)
28-
- uses: actions/setup-node@v4
29-
with:
30-
node-version: 20
31-
- run: corepack enable
32-
- uses: actions/setup-node@v4
33-
with:
34-
node-version: 20
35-
cache: yarn
36-
# End workaround
37-
38135
- name: devbox installer
39136
uses: jetify-com/devbox-install-action@v0.14.0
40137
with:
41-
enable-cache: 'true'
138+
enable-cache: 'false'
42139

43140
- name: Config, Build, Release
44141
run: devbox run release
@@ -49,6 +146,4 @@ jobs:
49146

50147
- name: Update Apps
51148
run: |
52-
yarn install --no-immutable
53-
yarn e2e install --no-immutable
54-
yarn example install --no-immutable
149+
devbox run update-apps

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,6 @@ tsconfig.tsbuildinfo
9494
packages/core/src/info.ts
9595

9696
.pnpm/
97+
98+
AGENTS.md
99+

AGENTS.md

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

devbox.json

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
"jdk17": "latest",
1313
"gradle": "latest",
1414
"jq": "latest",
15+
"netcat": "latest",
1516
"path:./nix#android-sdk": ""
1617
},
1718
"shell": {
1819
"init_hook": [
1920
"echo 'Welcome to analytics-react-native devbox!' > /dev/null",
20-
". $DEVBOX_PROJECT_ROOT/scripts/android-env.sh",
21+
". $DEVBOX_PROJECT_ROOT/scripts/shared/common.sh",
22+
"if [ \"$(uname -s)\" = \"Darwin\" ]; then . $DEVBOX_PROJECT_ROOT/scripts/ios/env.sh; fi",
23+
". $DEVBOX_PROJECT_ROOT/scripts/android/env.sh",
2124
"echo 'Android SDK env configured (details: wiki/devbox.md#devbox-android).'"
2225
],
2326
"scripts": {
@@ -28,53 +31,40 @@
2831
"yarn cache clean",
2932
"find $DEVBOX_PROJECT_DIR -type d -name node_modules -exec rmdir {} \\;"
3033
],
31-
"build": [
32-
"yarn install --immutable",
33-
"yarn build",
34-
"yarn lint",
35-
"yarn test --coverage"
36-
],
37-
"test-android": [
38-
"devbox run setup-android",
39-
"yarn install",
40-
"yarn e2e install",
41-
"yarn build",
42-
"yarn e2e build:android",
43-
"yarn e2e test:android"
44-
],
45-
"test-ios": [
46-
"devbox run setup-ios",
47-
"yarn install",
48-
"yarn e2e install",
49-
"yarn e2e pods",
50-
"yarn build",
51-
"yarn e2e build:ios",
52-
"yarn e2e test:ios"
53-
],
34+
"build": ["bash $SCRIPTS_DIR/build.sh"],
35+
"format": ["treefmt"],
36+
"lint": ["treefmt --fail-on-change"],
37+
"test-android": ["bash $SCRIPTS_DIR/android/test.sh"],
38+
"test-ios": ["bash $SCRIPTS_DIR/ios/test.sh"],
5439
"act-ci": [
55-
"bash $DEVBOX_PROJECT_ROOT/scripts/act-ci.sh --platform ubuntu-latest=node:20-bullseye"
56-
],
57-
"setup-android": ["bash $DEVBOX_PROJECT_ROOT/scripts/android-setup.sh"],
58-
"setup-ios": ["bash $DEVBOX_PROJECT_ROOT/scripts/ios-setup.sh"],
59-
"start-emulator": [
60-
"bash $DEVBOX_PROJECT_ROOT/scripts/android-manager.sh start"
61-
],
62-
"start-ios": ["bash $DEVBOX_PROJECT_ROOT/scripts/ios-manager.sh start"],
63-
"start-android-minsdk": [
64-
"bash $DEVBOX_PROJECT_ROOT/scripts/android-manager.sh start"
40+
"bash $SCRIPTS_DIR/act-ci.sh --platform ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-24.04"
6541
],
42+
"setup-android": ["bash $SCRIPTS_DIR/android/setup.sh"],
43+
"setup-ios": ["bash $SCRIPTS_DIR/ios/setup.sh"],
44+
"start-emulator": ["bash $SCRIPTS_DIR/android/manager.sh start"],
45+
"start-ios": ["bash $SCRIPTS_DIR/ios/manager.sh start"],
46+
"start-android-minsdk": ["bash $SCRIPTS_DIR/android/manager.sh start"],
6647
"start-android-latest": [
67-
"AVD_FLAVOR=latest bash $DEVBOX_PROJECT_ROOT/scripts/android-manager.sh start"
68-
],
69-
"start-android": [
70-
"bash $DEVBOX_PROJECT_ROOT/scripts/android-manager.sh start"
48+
"AVD_FLAVOR=latest bash $SCRIPTS_DIR/android/manager.sh start"
7149
],
50+
"start-android": ["bash $SCRIPTS_DIR/android/manager.sh start"],
7251
"release": [
7352
"npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}",
7453
"yarn install --immutable",
7554
"yarn build",
7655
"yarn release"
7756
],
57+
"update-apps": [
58+
"yarn install --no-immutable",
59+
"yarn e2e install --no-immutable",
60+
"yarn example install --no-immutable"
61+
],
62+
"update-shells": [
63+
"devbox update",
64+
"devbox update --config=shells/devbox-fast.json",
65+
"devbox update --config=shells/devbox-android.json",
66+
"devbox update --config=shells/devbox-ios.json"
67+
],
7868
"reset-android": [
7969
"rm -rf ~/.android/avd",
8070
"rm -f ~/.android/adbkey*",

0 commit comments

Comments
 (0)