Skip to content

Commit dbc9a80

Browse files
committed
wip: standalone build for a local lease, runner cache, no job names
1 parent 21ca70f commit dbc9a80

3 files changed

Lines changed: 40 additions & 13 deletions

File tree

‎.claude/skills/verify-clerk-expo/src/host.ts‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
writeFileSync,
1212
} from 'node:fs';
1313
import { createRequire } from 'node:module';
14-
import { join, relative } from 'node:path';
14+
import { basename, join, relative } from 'node:path';
1515
import { fileURLToPath } from 'node:url';
1616
import { isRunning, run, sleep } from './core/exec.ts';
1717
import { remoteBackend } from './core/remote/backend.ts';
@@ -494,13 +494,21 @@ async function ensureServed(
494494
return current;
495495
}
496496

497-
export function productFor(backend: BackendKind): BuildProduct {
498-
return backend === 'remote' ? 'standalone' : 'dev-client';
497+
export function productFor(backend: BackendKind, env: NodeJS.ProcessEnv = process.env): BuildProduct {
498+
if (backend === 'remote') return 'standalone';
499+
const asked = env.VERIFY_LOCAL_BUILD;
500+
if (asked === undefined || asked === '' || asked === 'dev-client') return 'dev-client';
501+
if (asked === 'standalone') return 'standalone';
502+
throw new VerifyFailure(
503+
'USAGE',
504+
`VERIFY_LOCAL_BUILD=${asked} is not dev-client or standalone`,
505+
'unset VERIFY_LOCAL_BUILD or set it to standalone',
506+
);
499507
}
500508

501-
function keepBuild(platform: Platform, built: string, into: string): string {
509+
function keepBuild(built: string, into: string): string {
502510
mkdirSync(into, { recursive: true });
503-
const path = join(into, platform === 'ios' ? `${IOS_PRODUCT}.app` : 'app-debug.apk');
511+
const path = join(into, basename(built));
504512
rmSync(path, { recursive: true, force: true });
505513
cpSync(built, path, { recursive: true, verbatimSymlinks: true });
506514
return path;
@@ -534,24 +542,26 @@ export const host: HostAdapter<(typeof SCREENS)[number]> = {
534542
appId: () => APP_ID,
535543
buildInputs: (platform, backend) => buildInputs(platform, productFor(backend)),
536544
async build(platform, key, into, progress) {
545+
const product = productFor('local');
537546
const path = await withFixtureLock(progress, async () => {
538-
const watching = readRuntime('watch') !== null;
547+
const watching = product === 'dev-client' && readRuntime('watch') !== null;
539548
if (watching)
540549
progress('build the running watch build keeps packages/expo/dist current, so turbo build is skipped');
541550
else stopRuntime();
542551
const built = await buildFixture({
543552
platform,
544-
product: 'dev-client',
553+
product,
545554
nativeKey: key,
546555
buildPackages: !watching,
547556
progress,
548557
});
549-
return keepBuild(platform, built, into);
558+
return keepBuild(built, into);
550559
});
551560
return { platform, key, appId: APP_ID, path: path as ScratchPath, source: 'local' };
552561
},
553562
async runtime(lease, progress) {
554-
if (lease.backend === 'remote') return { entry: { kind: 'binary' }, processes: [] };
563+
if (lease.backend === 'remote' || productFor(lease.backend) === 'standalone')
564+
return { entry: { kind: 'binary' }, processes: [] };
555565
const port = metroPort(lease);
556566
return withCleanup(
557567
stopRuntime,

‎.claude/skills/verify-clerk-expo/test/remote-host.test.ts‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,19 @@ describe('where the clerk-expo host runs a device', () => {
7070

7171
describe('the two build products', () => {
7272
it('builds a dev client for a device on this machine and a standalone app for a runner', () => {
73-
assert.equal(productFor('local'), 'dev-client');
74-
assert.equal(productFor('remote'), 'standalone');
73+
assert.equal(productFor('local', {}), 'dev-client');
74+
assert.equal(productFor('remote', {}), 'standalone');
75+
});
76+
77+
it('builds a standalone app for a device on this machine when VERIFY_LOCAL_BUILD asks for one', () => {
78+
assert.equal(productFor('local', { VERIFY_LOCAL_BUILD: 'standalone' }), 'standalone');
79+
assert.equal(productFor('local', { VERIFY_LOCAL_BUILD: 'dev-client' }), 'dev-client');
80+
assert.equal(productFor('local', { VERIFY_LOCAL_BUILD: '' }), 'dev-client');
81+
assert.equal(productFor('remote', { VERIFY_LOCAL_BUILD: 'dev-client' }), 'standalone');
82+
assert.throws(
83+
() => productFor('local', { VERIFY_LOCAL_BUILD: 'release' }),
84+
(error: VerifyFailure) => error.code === 'USAGE' && error.message.startsWith('VERIFY_LOCAL_BUILD=release'),
85+
);
7586
});
7687

7788
it('keys a dev client on native inputs only, so a JS edit reaches it through Metro with no rebuild', () => {

‎.github/workflows/verify-device-specs.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ concurrency:
2626
jobs:
2727
plan:
2828
if: ${{ github.head_ref != 'changeset-release/main' }}
29-
name: Plan device specs
3029
runs-on: ubuntu-latest
3130
timeout-minutes: 5
3231
outputs:
@@ -57,7 +56,6 @@ jobs:
5756
device-specs:
5857
needs: plan
5958
if: needs.plan.outputs.run == 'true'
60-
name: Device specs (${{ matrix.platform }})
6159
runs-on: ${{ matrix.runner }}
6260
timeout-minutes: 45
6361
strategy:
@@ -72,6 +70,7 @@ jobs:
7270
SKILL: .claude/skills/verify-clerk-expo
7371
CLI: .claude/skills/verify-clerk-expo/bin/control-clerk-expo
7472
PLATFORM: ${{ matrix.platform }}
73+
VERIFY_LOCAL_BUILD: standalone
7574
VERIFY_THROWAWAY_HOURS: '2'
7675
steps:
7776
- name: Checkout repo
@@ -140,6 +139,13 @@ jobs:
140139
run: |
141140
"$CLI" up --platform "$PLATFORM" --backend local
142141
142+
- name: Cache the XCTest runner
143+
if: matrix.platform == 'ios'
144+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
145+
with:
146+
path: ~/.agent-device/apple-runner
147+
key: verify-agent-device-${{ runner.os }}-${{ hashFiles('.claude/skills/verify-clerk-expo/package-lock.json') }}
148+
143149
- name: Compile the XCTest runner before the first spec launches
144150
if: matrix.platform == 'ios'
145151
timeout-minutes: 20

0 commit comments

Comments
 (0)