@invarn/cibuild 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +10 -10
- package/dist/src/commands/ios-scanner.d.ts +44 -8
- package/dist/src/commands/ios-scanner.d.ts.map +1 -1
- package/dist/src/commands/ios-scanner.js +52 -10
- package/dist/src/commands/ios-scheme-ranking.test.js +109 -2
- package/dist/src/yaml/a-declared-secret-reaches-the-file-step.test.d.ts +20 -0
- package/dist/src/yaml/a-declared-secret-reaches-the-file-step.test.d.ts.map +1 -0
- package/dist/src/yaml/a-declared-secret-reaches-the-file-step.test.js +201 -0
- package/dist/src/yaml/env-resolver.d.ts +33 -0
- package/dist/src/yaml/env-resolver.d.ts.map +1 -1
- package/dist/src/yaml/env-resolver.js +54 -2
- package/dist/src/yaml/steps/git-fetch-retry-exec.test.d.ts +10 -0
- package/dist/src/yaml/steps/git-fetch-retry-exec.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/git-fetch-retry-exec.test.js +156 -0
- package/dist/src/yaml/steps/git-fetch-retry.d.ts +62 -0
- package/dist/src/yaml/steps/git-fetch-retry.d.ts.map +1 -0
- package/dist/src/yaml/steps/git-fetch-retry.js +155 -0
- package/dist/src/yaml/steps/git-fetch-retry.test.d.ts +5 -0
- package/dist/src/yaml/steps/git-fetch-retry.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/git-fetch-retry.test.js +86 -0
- package/dist/src/yaml/steps/ios-deps.d.ts.map +1 -1
- package/dist/src/yaml/steps/ios-deps.js +14 -4
- package/dist/src/yaml/steps/xcode-resolve-retry.test.d.ts +9 -0
- package/dist/src/yaml/steps/xcode-resolve-retry.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/xcode-resolve-retry.test.js +111 -0
- package/dist/src/yaml/steps/xcode.d.ts.map +1 -1
- package/dist/src/yaml/steps/xcode.js +28 -0
- package/package.json +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency resolution is separated from the build and retried.
|
|
3
|
+
*
|
|
4
|
+
* Resolution takes seconds and the build that follows takes minutes, so a
|
|
5
|
+
* refused fetch should cost a retry of the cheap half, not a re-run of the
|
|
6
|
+
* expensive one. These assert the split actually lands in the emitted script.
|
|
7
|
+
*/
|
|
8
|
+
import { describe, test, expect } from '@jest/globals';
|
|
9
|
+
import { XcodeBuildStepExecutor, XcodeBuildForTestStepExecutor } from './xcode.js';
|
|
10
|
+
import { CocoapodsInstallStepExecutor } from './ios-deps.js';
|
|
11
|
+
import { testConfig } from './test-config.js';
|
|
12
|
+
const countOccurrences = (haystack, needle) => haystack.split(needle).length - 1;
|
|
13
|
+
describe('xcode-build-for-test resolves before it builds', () => {
|
|
14
|
+
const build = async (inputs = {}) => {
|
|
15
|
+
const executor = new XcodeBuildForTestStepExecutor();
|
|
16
|
+
const result = await executor.execute({ project_path: 'MyApp.xcworkspace', scheme: 'MyApp', ...inputs }, {}, testConfig);
|
|
17
|
+
return result.script;
|
|
18
|
+
};
|
|
19
|
+
test('resolves package dependencies as its own command', async () => {
|
|
20
|
+
expect(await build()).toContain('xcodebuild -resolvePackageDependencies');
|
|
21
|
+
});
|
|
22
|
+
test('resolves BEFORE build-for-testing', async () => {
|
|
23
|
+
const script = await build();
|
|
24
|
+
expect(script.indexOf('xcodebuild -resolvePackageDependencies')).toBeLessThan(script.indexOf('xcodebuild build-for-testing'));
|
|
25
|
+
});
|
|
26
|
+
test('resolves into the same derived data the build will read', async () => {
|
|
27
|
+
// Otherwise the resolve is wasted work and the build fetches all over again.
|
|
28
|
+
const script = await build();
|
|
29
|
+
const resolveLine = script
|
|
30
|
+
.split('\n')
|
|
31
|
+
.find((l) => l.includes('-resolvePackageDependencies'));
|
|
32
|
+
expect(resolveLine).toContain('-derivedDataPath "$OUTPUT_DIR/DerivedData"');
|
|
33
|
+
});
|
|
34
|
+
test('passes the same project type and scheme as the build', async () => {
|
|
35
|
+
const resolveLine = (await build())
|
|
36
|
+
.split('\n')
|
|
37
|
+
.find((l) => l.includes('-resolvePackageDependencies'));
|
|
38
|
+
expect(resolveLine).toContain('"$PROJECT_TYPE"');
|
|
39
|
+
expect(resolveLine).toContain("'MyApp.xcworkspace'");
|
|
40
|
+
expect(resolveLine).toContain("-scheme 'MyApp'");
|
|
41
|
+
});
|
|
42
|
+
test('wraps the resolve in the refused-fetch retry', async () => {
|
|
43
|
+
const script = await build();
|
|
44
|
+
expect(script).toContain('cibuild_fetch_was_refused');
|
|
45
|
+
expect(script).toContain('CIBUILD_FETCH_MAX_ATTEMPTS');
|
|
46
|
+
});
|
|
47
|
+
test('defines the retry helpers exactly once', async () => {
|
|
48
|
+
const script = await build();
|
|
49
|
+
expect(countOccurrences(script, 'cibuild_diagnose_refused_fetch()')).toBe(1);
|
|
50
|
+
expect(countOccurrences(script, 'cibuild_fetch_was_refused()')).toBe(1);
|
|
51
|
+
});
|
|
52
|
+
test('does not retry the expensive build step itself', async () => {
|
|
53
|
+
const script = await build();
|
|
54
|
+
// exactly one retry loop, and it is the resolve
|
|
55
|
+
expect(countOccurrences(script, 'CIBUILD_FETCH_MAX_ATTEMPTS=')).toBe(1);
|
|
56
|
+
const loopStart = script.indexOf('CIBUILD_FETCH_MAX_ATTEMPTS=');
|
|
57
|
+
expect(loopStart).toBeLessThan(script.indexOf('xcodebuild build-for-testing'));
|
|
58
|
+
});
|
|
59
|
+
test('still builds and still exports its outputs', async () => {
|
|
60
|
+
const script = await build();
|
|
61
|
+
expect(script).toContain('xcodebuild build-for-testing');
|
|
62
|
+
expect(script).toContain('envman add --key CIBUILD_XCTESTRUN_FILE_PATH');
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe('xcodebuild resolves before it builds', () => {
|
|
66
|
+
const build = async (inputs = {}) => {
|
|
67
|
+
const executor = new XcodeBuildStepExecutor();
|
|
68
|
+
const result = await executor.execute({ project_path: 'MyApp.xcodeproj', scheme: 'MyApp', ...inputs }, {}, testConfig);
|
|
69
|
+
return result.script;
|
|
70
|
+
};
|
|
71
|
+
test('resolves package dependencies before building', async () => {
|
|
72
|
+
const script = await build();
|
|
73
|
+
expect(script).toContain('xcodebuild -resolvePackageDependencies');
|
|
74
|
+
expect(script.indexOf('xcodebuild -resolvePackageDependencies')).toBeLessThan(script.indexOf('xcodebuild build '));
|
|
75
|
+
});
|
|
76
|
+
test('wraps the resolve in the refused-fetch retry', async () => {
|
|
77
|
+
expect(await build()).toContain('cibuild_fetch_was_refused');
|
|
78
|
+
});
|
|
79
|
+
test('leaves the build invocation itself unwrapped', async () => {
|
|
80
|
+
expect(countOccurrences(await build(), 'CIBUILD_FETCH_MAX_ATTEMPTS=')).toBe(1);
|
|
81
|
+
});
|
|
82
|
+
test('still honours a clean build', async () => {
|
|
83
|
+
expect(await build({ is_clean_build: true })).toContain('xcodebuild clean build');
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
describe('cocoapods-install retries a refused pod source fetch', () => {
|
|
87
|
+
const build = async (inputs = {}) => {
|
|
88
|
+
const executor = new CocoapodsInstallStepExecutor();
|
|
89
|
+
const result = await executor.execute(inputs, {}, testConfig);
|
|
90
|
+
return result.script;
|
|
91
|
+
};
|
|
92
|
+
test('wraps the pod command in the retry', async () => {
|
|
93
|
+
const script = await build();
|
|
94
|
+
expect(script).toContain('cibuild_fetch_was_refused');
|
|
95
|
+
expect(script).toContain('CIBUILD_FETCH_MAX_ATTEMPTS');
|
|
96
|
+
});
|
|
97
|
+
test('still chooses between bundle exec and bare pod', async () => {
|
|
98
|
+
const script = await build();
|
|
99
|
+
expect(script).toContain('bundle exec pod');
|
|
100
|
+
expect(script).toContain('USE_BUNDLE_EXEC');
|
|
101
|
+
});
|
|
102
|
+
test('runs the pod command exactly once in the script', async () => {
|
|
103
|
+
// The old shape invoked pod in both branches of an if/else; the retry
|
|
104
|
+
// needs a single invocation or it would be wrapped twice.
|
|
105
|
+
expect(countOccurrences(await build(), 'CIBUILD_FETCH_MAX_ATTEMPTS=')).toBe(1);
|
|
106
|
+
});
|
|
107
|
+
test('still reports completion', async () => {
|
|
108
|
+
expect(await build()).toContain('CocoaPods');
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=xcode-resolve-retry.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xcode.d.ts","sourceRoot":"","sources":["../../../../src/yaml/steps/xcode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"xcode.d.ts","sourceRoot":"","sources":["../../../../src/yaml/steps/xcode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,gBAAgB;IAC1D,yBAAyB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EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;CAkHhH"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { existsSync } from 'node:fs';
|
|
5
5
|
import { BaseStepExecutor } from './base.js';
|
|
6
6
|
import { resolveDestinationInput } from './xcode-destination.js';
|
|
7
|
+
import { refusedFetchHelpers, retryOnRefusedFetch } from './git-fetch-retry.js';
|
|
7
8
|
/**
|
|
8
9
|
* Xcodebuild step executor
|
|
9
10
|
* Builds iOS/macOS projects using xcodebuild
|
|
@@ -78,6 +79,20 @@ export class XcodeBuildStepExecutor extends BaseStepExecutor {
|
|
|
78
79
|
commands.push('else');
|
|
79
80
|
commands.push(' PROJECT_TYPE="-project"');
|
|
80
81
|
commands.push('fi');
|
|
82
|
+
// Resolve the package graph before building, and retry that on a refused
|
|
83
|
+
// fetch. Resolution is seconds and the build is minutes, so the retry is
|
|
84
|
+
// spent on the cheap half. No -derivedDataPath here: this step does not
|
|
85
|
+
// set one for the build either, so both use the default location and the
|
|
86
|
+
// build finds the graph this just resolved.
|
|
87
|
+
commands.push('');
|
|
88
|
+
commands.push('# Resolve package dependencies first — see git-fetch-retry');
|
|
89
|
+
commands.push(...refusedFetchHelpers());
|
|
90
|
+
commands.push(...retryOnRefusedFetch({
|
|
91
|
+
label: 'Package resolution',
|
|
92
|
+
command: 'xcodebuild -resolvePackageDependencies' +
|
|
93
|
+
` "$PROJECT_TYPE" '${escapedPath}'` +
|
|
94
|
+
` -scheme '${this.escapeBash(scheme)}'`,
|
|
95
|
+
}));
|
|
81
96
|
// Build xcodebuild command
|
|
82
97
|
commands.push('');
|
|
83
98
|
commands.push('# Build xcodebuild command');
|
|
@@ -792,6 +807,19 @@ export class XcodeBuildForTestStepExecutor extends BaseStepExecutor {
|
|
|
792
807
|
commands.push(' PROJECT_TYPE="-project"');
|
|
793
808
|
commands.push('fi');
|
|
794
809
|
commands.push('');
|
|
810
|
+
// Resolve the package graph on its own, ahead of the build, so a refused
|
|
811
|
+
// fetch costs a retry of something that takes seconds rather than a re-run
|
|
812
|
+
// of build-for-testing, which takes minutes. The build that follows reads
|
|
813
|
+
// the same derived data and finds the graph already resolved.
|
|
814
|
+
commands.push('# Resolve package dependencies first — see git-fetch-retry');
|
|
815
|
+
commands.push(...refusedFetchHelpers());
|
|
816
|
+
commands.push(...retryOnRefusedFetch({
|
|
817
|
+
label: 'Package resolution',
|
|
818
|
+
command: 'xcodebuild -resolvePackageDependencies' +
|
|
819
|
+
` "$PROJECT_TYPE" '${escapedPath}'` +
|
|
820
|
+
` -scheme '${escapedScheme}'` +
|
|
821
|
+
' -derivedDataPath "$OUTPUT_DIR/DerivedData"',
|
|
822
|
+
}));
|
|
795
823
|
// Build command
|
|
796
824
|
let cmd = 'xcodebuild build-for-testing';
|
|
797
825
|
cmd += ` "$PROJECT_TYPE" '${escapedPath}'`;
|