@invarn/cibuild 1.3.16 → 1.3.17
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 +1 -1
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +987 -0
- package/dist/src/commands/android-scanner.d.ts +32 -0
- package/dist/src/commands/android-scanner.d.ts.map +1 -0
- package/dist/src/commands/android-scanner.js +667 -0
- package/dist/src/commands/build.d.ts +5 -0
- package/dist/src/commands/build.d.ts.map +1 -0
- package/dist/src/commands/build.js +1096 -0
- package/dist/src/commands/edit.d.ts +3 -0
- package/dist/src/commands/edit.d.ts.map +1 -0
- package/dist/src/commands/edit.js +651 -0
- package/dist/src/commands/file-secret-collector.d.ts +37 -0
- package/dist/src/commands/file-secret-collector.d.ts.map +1 -0
- package/dist/src/commands/file-secret-collector.js +199 -0
- package/dist/src/commands/github-workflow.d.ts +5 -0
- package/dist/src/commands/github-workflow.d.ts.map +1 -0
- package/dist/src/commands/github-workflow.js +45 -0
- package/dist/src/commands/ios-scanner.d.ts +27 -0
- package/dist/src/commands/ios-scanner.d.ts.map +1 -0
- package/dist/src/commands/ios-scanner.js +337 -0
- package/dist/src/commands/reset.d.ts +7 -0
- package/dist/src/commands/reset.d.ts.map +1 -0
- package/dist/src/commands/reset.js +81 -0
- package/dist/src/commands/secrets-sync-workflow.d.ts +15 -0
- package/dist/src/commands/secrets-sync-workflow.d.ts.map +1 -0
- package/dist/src/commands/secrets-sync-workflow.js +255 -0
- package/dist/src/commands/secrets-upload.d.ts +21 -0
- package/dist/src/commands/secrets-upload.d.ts.map +1 -0
- package/dist/src/commands/secrets-upload.js +177 -0
- package/dist/src/commands/secrets-upload.test.d.ts +5 -0
- package/dist/src/commands/secrets-upload.test.d.ts.map +1 -0
- package/dist/src/commands/secrets-upload.test.js +60 -0
- package/dist/src/config.d.ts +3 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +46 -0
- package/dist/src/envman/cli.d.ts +21 -0
- package/dist/src/envman/cli.d.ts.map +1 -0
- package/dist/src/envman/cli.js +240 -0
- package/dist/src/envman/envman.d.ts +83 -0
- package/dist/src/envman/envman.d.ts.map +1 -0
- package/dist/src/envman/envman.js +361 -0
- package/dist/src/envman/envman.test.d.ts +5 -0
- package/dist/src/envman/envman.test.d.ts.map +1 -0
- package/dist/src/envman/envman.test.js +236 -0
- package/dist/src/envman/index.d.ts +23 -0
- package/dist/src/envman/index.d.ts.map +1 -0
- package/dist/src/envman/index.js +23 -0
- package/dist/src/envman/types.d.ts +55 -0
- package/dist/src/envman/types.d.ts.map +1 -0
- package/dist/src/envman/types.js +12 -0
- package/dist/src/lib.d.ts +27 -0
- package/dist/src/lib.d.ts.map +1 -0
- package/dist/src/lib.js +32 -0
- package/dist/src/pipeline.d.ts +3 -0
- package/dist/src/pipeline.d.ts.map +1 -0
- package/dist/src/pipeline.js +57 -0
- package/dist/src/runner.d.ts +17 -0
- package/dist/src/runner.d.ts.map +1 -0
- package/dist/src/runner.js +234 -0
- package/dist/src/types.d.ts +57 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/yaml/bitrise-compat.d.ts +65 -0
- package/dist/src/yaml/bitrise-compat.d.ts.map +1 -0
- package/dist/src/yaml/bitrise-compat.js +206 -0
- package/dist/src/yaml/bitrise-compat.test.d.ts +5 -0
- package/dist/src/yaml/bitrise-compat.test.d.ts.map +1 -0
- package/dist/src/yaml/bitrise-compat.test.js +347 -0
- package/dist/src/yaml/converter.d.ts +33 -0
- package/dist/src/yaml/converter.d.ts.map +1 -0
- package/dist/src/yaml/converter.js +222 -0
- package/dist/src/yaml/converter.test.d.ts +5 -0
- package/dist/src/yaml/converter.test.d.ts.map +1 -0
- package/dist/src/yaml/converter.test.js +348 -0
- package/dist/src/yaml/e2e.test.d.ts +6 -0
- package/dist/src/yaml/e2e.test.d.ts.map +1 -0
- package/dist/src/yaml/e2e.test.js +446 -0
- package/dist/src/yaml/env-resolver.d.ts +120 -0
- package/dist/src/yaml/env-resolver.d.ts.map +1 -0
- package/dist/src/yaml/env-resolver.js +405 -0
- package/dist/src/yaml/env-resolver.test.d.ts +5 -0
- package/dist/src/yaml/env-resolver.test.d.ts.map +1 -0
- package/dist/src/yaml/env-resolver.test.js +502 -0
- package/dist/src/yaml/interactive-prompts.d.ts +71 -0
- package/dist/src/yaml/interactive-prompts.d.ts.map +1 -0
- package/dist/src/yaml/interactive-prompts.js +258 -0
- package/dist/src/yaml/missing-env-handler.d.ts +45 -0
- package/dist/src/yaml/missing-env-handler.d.ts.map +1 -0
- package/dist/src/yaml/missing-env-handler.js +64 -0
- package/dist/src/yaml/parser.d.ts +33 -0
- package/dist/src/yaml/parser.d.ts.map +1 -0
- package/dist/src/yaml/parser.js +145 -0
- package/dist/src/yaml/pipeline-with-secrets.d.ts +25 -0
- package/dist/src/yaml/pipeline-with-secrets.d.ts.map +1 -0
- package/dist/src/yaml/pipeline-with-secrets.js +76 -0
- package/dist/src/yaml/platform-detector.d.ts +83 -0
- package/dist/src/yaml/platform-detector.d.ts.map +1 -0
- package/dist/src/yaml/platform-detector.js +188 -0
- package/dist/src/yaml/platform-detector.test.d.ts +5 -0
- package/dist/src/yaml/platform-detector.test.d.ts.map +1 -0
- package/dist/src/yaml/platform-detector.test.js +414 -0
- package/dist/src/yaml/preflight-validation.d.ts +40 -0
- package/dist/src/yaml/preflight-validation.d.ts.map +1 -0
- package/dist/src/yaml/preflight-validation.js +152 -0
- package/dist/src/yaml/secrets-manager.d.ts +77 -0
- package/dist/src/yaml/secrets-manager.d.ts.map +1 -0
- package/dist/src/yaml/secrets-manager.js +219 -0
- package/dist/src/yaml/step-validator.d.ts +54 -0
- package/dist/src/yaml/step-validator.d.ts.map +1 -0
- package/dist/src/yaml/step-validator.js +403 -0
- package/dist/src/yaml/steps/android-sign.d.ts +35 -0
- package/dist/src/yaml/steps/android-sign.d.ts.map +1 -0
- package/dist/src/yaml/steps/android-sign.js +147 -0
- package/dist/src/yaml/steps/android-version.d.ts +26 -0
- package/dist/src/yaml/steps/android-version.d.ts.map +1 -0
- package/dist/src/yaml/steps/android-version.js +128 -0
- package/dist/src/yaml/steps/android-version.test.d.ts +5 -0
- package/dist/src/yaml/steps/android-version.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/android-version.test.js +196 -0
- package/dist/src/yaml/steps/android.d.ts +95 -0
- package/dist/src/yaml/steps/android.d.ts.map +1 -0
- package/dist/src/yaml/steps/android.js +916 -0
- package/dist/src/yaml/steps/app-store-deploy.d.ts +48 -0
- package/dist/src/yaml/steps/app-store-deploy.d.ts.map +1 -0
- package/dist/src/yaml/steps/app-store-deploy.js +162 -0
- package/dist/src/yaml/steps/base.d.ts +238 -0
- package/dist/src/yaml/steps/base.d.ts.map +1 -0
- package/dist/src/yaml/steps/base.js +345 -0
- package/dist/src/yaml/steps/bitrise-android-tools.d.ts +26 -0
- package/dist/src/yaml/steps/bitrise-android-tools.d.ts.map +1 -0
- package/dist/src/yaml/steps/bitrise-android-tools.js +198 -0
- package/dist/src/yaml/steps/bitrise-android-tools.test.d.ts +5 -0
- package/dist/src/yaml/steps/bitrise-android-tools.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/bitrise-android-tools.test.js +280 -0
- package/dist/src/yaml/steps/bitrise-apk-info.d.ts +22 -0
- package/dist/src/yaml/steps/bitrise-apk-info.d.ts.map +1 -0
- package/dist/src/yaml/steps/bitrise-apk-info.js +144 -0
- package/dist/src/yaml/steps/bitrise-apk-info.test.d.ts +5 -0
- package/dist/src/yaml/steps/bitrise-apk-info.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/bitrise-apk-info.test.js +331 -0
- package/dist/src/yaml/steps/bitrise-slack.d.ts +49 -0
- package/dist/src/yaml/steps/bitrise-slack.d.ts.map +1 -0
- package/dist/src/yaml/steps/bitrise-slack.js +280 -0
- package/dist/src/yaml/steps/bitrise-slack.test.d.ts +5 -0
- package/dist/src/yaml/steps/bitrise-slack.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/bitrise-slack.test.js +484 -0
- package/dist/src/yaml/steps/bitrise-ssh.d.ts +27 -0
- package/dist/src/yaml/steps/bitrise-ssh.d.ts.map +1 -0
- package/dist/src/yaml/steps/bitrise-ssh.js +134 -0
- package/dist/src/yaml/steps/bitrise-ssh.test.d.ts +5 -0
- package/dist/src/yaml/steps/bitrise-ssh.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/bitrise-ssh.test.js +205 -0
- package/dist/src/yaml/steps/cache.d.ts +52 -0
- package/dist/src/yaml/steps/cache.d.ts.map +1 -0
- package/dist/src/yaml/steps/cache.js +351 -0
- package/dist/src/yaml/steps/fastlane.d.ts +27 -0
- package/dist/src/yaml/steps/fastlane.d.ts.map +1 -0
- package/dist/src/yaml/steps/fastlane.js +79 -0
- package/dist/src/yaml/steps/file.d.ts +27 -0
- package/dist/src/yaml/steps/file.d.ts.map +1 -0
- package/dist/src/yaml/steps/file.js +35 -0
- package/dist/src/yaml/steps/flutter.d.ts +63 -0
- package/dist/src/yaml/steps/flutter.d.ts.map +1 -0
- package/dist/src/yaml/steps/flutter.js +215 -0
- package/dist/src/yaml/steps/git-clone.d.ts +26 -0
- package/dist/src/yaml/steps/git-clone.d.ts.map +1 -0
- package/dist/src/yaml/steps/git-clone.js +111 -0
- package/dist/src/yaml/steps/google-play-deploy.d.ts +37 -0
- package/dist/src/yaml/steps/google-play-deploy.d.ts.map +1 -0
- package/dist/src/yaml/steps/google-play-deploy.js +193 -0
- package/dist/src/yaml/steps/google-play-deploy.test.d.ts +5 -0
- package/dist/src/yaml/steps/google-play-deploy.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/google-play-deploy.test.js +310 -0
- package/dist/src/yaml/steps/index.d.ts +10 -0
- package/dist/src/yaml/steps/index.d.ts.map +1 -0
- package/dist/src/yaml/steps/index.js +1361 -0
- package/dist/src/yaml/steps/ios-deps.d.ts +43 -0
- package/dist/src/yaml/steps/ios-deps.d.ts.map +1 -0
- package/dist/src/yaml/steps/ios-deps.js +141 -0
- package/dist/src/yaml/steps/ios-deps.test.d.ts +5 -0
- package/dist/src/yaml/steps/ios-deps.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/ios-deps.test.js +90 -0
- package/dist/src/yaml/steps/ios-signing.d.ts +31 -0
- package/dist/src/yaml/steps/ios-signing.d.ts.map +1 -0
- package/dist/src/yaml/steps/ios-signing.js +144 -0
- package/dist/src/yaml/steps/ios-version.d.ts +47 -0
- package/dist/src/yaml/steps/ios-version.d.ts.map +1 -0
- package/dist/src/yaml/steps/ios-version.js +151 -0
- package/dist/src/yaml/steps/linting.d.ts +47 -0
- package/dist/src/yaml/steps/linting.d.ts.map +1 -0
- package/dist/src/yaml/steps/linting.js +148 -0
- package/dist/src/yaml/steps/phase2.test.d.ts +6 -0
- package/dist/src/yaml/steps/phase2.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/phase2.test.js +197 -0
- package/dist/src/yaml/steps/phase3.test.d.ts +5 -0
- package/dist/src/yaml/steps/phase3.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/phase3.test.js +144 -0
- package/dist/src/yaml/steps/phase4.test.d.ts +5 -0
- package/dist/src/yaml/steps/phase4.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/phase4.test.js +166 -0
- package/dist/src/yaml/steps/phase5.test.d.ts +6 -0
- package/dist/src/yaml/steps/phase5.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/phase5.test.js +263 -0
- package/dist/src/yaml/steps/registry.d.ts +88 -0
- package/dist/src/yaml/steps/registry.d.ts.map +1 -0
- package/dist/src/yaml/steps/registry.js +125 -0
- package/dist/src/yaml/steps/registry.test.d.ts +5 -0
- package/dist/src/yaml/steps/registry.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/registry.test.js +235 -0
- package/dist/src/yaml/steps/release.d.ts +50 -0
- package/dist/src/yaml/steps/release.d.ts.map +1 -0
- package/dist/src/yaml/steps/release.js +154 -0
- package/dist/src/yaml/steps/script.d.ts +23 -0
- package/dist/src/yaml/steps/script.d.ts.map +1 -0
- package/dist/src/yaml/steps/script.js +63 -0
- package/dist/src/yaml/steps/spec-validation.test.d.ts +6 -0
- package/dist/src/yaml/steps/spec-validation.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/spec-validation.test.js +130 -0
- package/dist/src/yaml/steps/steps.test.d.ts +6 -0
- package/dist/src/yaml/steps/steps.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/steps.test.js +474 -0
- package/dist/src/yaml/steps/test-config.d.ts +3 -0
- package/dist/src/yaml/steps/test-config.d.ts.map +1 -0
- package/dist/src/yaml/steps/test-config.js +16 -0
- package/dist/src/yaml/steps/xcode-new.test.d.ts +5 -0
- package/dist/src/yaml/steps/xcode-new.test.d.ts.map +1 -0
- package/dist/src/yaml/steps/xcode-new.test.js +211 -0
- package/dist/src/yaml/steps/xcode.d.ts +222 -0
- package/dist/src/yaml/steps/xcode.d.ts.map +1 -0
- package/dist/src/yaml/steps/xcode.js +999 -0
- package/dist/src/yaml/types.d.ts +68 -0
- package/dist/src/yaml/types.d.ts.map +1 -0
- package/dist/src/yaml/types.js +5 -0
- package/dist/src/yaml/validation-types.d.ts +96 -0
- package/dist/src/yaml/validation-types.d.ts.map +1 -0
- package/dist/src/yaml/validation-types.js +8 -0
- package/dist/src/yaml/yaml-updater.d.ts +24 -0
- package/dist/src/yaml/yaml-updater.d.ts.map +1 -0
- package/dist/src/yaml/yaml-updater.js +128 -0
- package/package.json +16 -4
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform detection logic for YAML pipelines
|
|
3
|
+
* Implements 3-tier priority detection: stack → platform → auto-detect from steps
|
|
4
|
+
*/
|
|
5
|
+
import type { YAMLPipeline, YAMLWorkflow, Platform, MachineType, PlatformInfo } from './types.js';
|
|
6
|
+
export declare class PlatformDetectionError extends Error {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* PlatformDetector analyzes a YAML workflow and determines the target platform
|
|
11
|
+
*/
|
|
12
|
+
export declare class PlatformDetector {
|
|
13
|
+
private pipeline;
|
|
14
|
+
private workflow;
|
|
15
|
+
private workflowName;
|
|
16
|
+
constructor(pipeline: YAMLPipeline, workflow: YAMLWorkflow, workflowName: string);
|
|
17
|
+
/**
|
|
18
|
+
* Detects the platform using 3-tier priority detection
|
|
19
|
+
* Priority 1: meta.cibuild.io.stack
|
|
20
|
+
* Priority 2: meta.platform
|
|
21
|
+
* Priority 3: auto-detect from workflow steps
|
|
22
|
+
*
|
|
23
|
+
* @returns Detected platform ('macos', 'linux', or 'windows')
|
|
24
|
+
* @throws PlatformDetectionError if detection fails or mixed platforms detected
|
|
25
|
+
*/
|
|
26
|
+
getPlatform(): Platform;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the full stack identifier if specified
|
|
29
|
+
* @returns Stack identifier (e.g., 'macos-xcode-26.4') or null
|
|
30
|
+
*/
|
|
31
|
+
getStack(): string | null;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the machine type if specified
|
|
34
|
+
* @returns Machine type ('standard' or 'performance') or null
|
|
35
|
+
*/
|
|
36
|
+
getMachineType(): MachineType | null;
|
|
37
|
+
/**
|
|
38
|
+
* Gets complete platform information
|
|
39
|
+
* @returns PlatformInfo object with platform, stack, and machineType
|
|
40
|
+
*/
|
|
41
|
+
getPlatformInfo(): PlatformInfo;
|
|
42
|
+
/**
|
|
43
|
+
* Extracts platform from stack name by parsing the prefix
|
|
44
|
+
* @param stack Stack identifier (e.g., 'macos-xcode-26.4')
|
|
45
|
+
* @returns Platform or null if pattern doesn't match
|
|
46
|
+
*/
|
|
47
|
+
private extractPlatformFromStack;
|
|
48
|
+
/**
|
|
49
|
+
* Auto-detects platform by analyzing workflow steps
|
|
50
|
+
* @returns Detected platform, defaults to 'linux' for platform-agnostic steps
|
|
51
|
+
* @throws PlatformDetectionError if mixed platforms detected
|
|
52
|
+
*/
|
|
53
|
+
private autoDetectFromSteps;
|
|
54
|
+
/**
|
|
55
|
+
* Extracts step names from workflow steps
|
|
56
|
+
* Parses step-name@version format to extract just the step name
|
|
57
|
+
* @returns Array of step names
|
|
58
|
+
*/
|
|
59
|
+
private extractStepNames;
|
|
60
|
+
/**
|
|
61
|
+
* Parses step name from "step-name@version" or "step-name" format
|
|
62
|
+
* @param stepNameWithVersion Full step identifier (e.g., "git-clone@4.0.17")
|
|
63
|
+
* @returns Step name without version (e.g., "git-clone")
|
|
64
|
+
*/
|
|
65
|
+
private parseStepName;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Helper function to detect platform for a specific workflow
|
|
69
|
+
* @param pipeline Parsed YAML pipeline
|
|
70
|
+
* @param workflowName Name of the workflow to analyze
|
|
71
|
+
* @returns Detected platform
|
|
72
|
+
* @throws Error if workflow doesn't exist
|
|
73
|
+
*/
|
|
74
|
+
export declare function detectPlatform(pipeline: YAMLPipeline, workflowName: string): Platform;
|
|
75
|
+
/**
|
|
76
|
+
* Helper function to get complete platform information for a workflow
|
|
77
|
+
* @param pipeline Parsed YAML pipeline
|
|
78
|
+
* @param workflowName Name of the workflow to analyze
|
|
79
|
+
* @returns PlatformInfo object
|
|
80
|
+
* @throws Error if workflow doesn't exist
|
|
81
|
+
*/
|
|
82
|
+
export declare function detectPlatformInfo(pipeline: YAMLPipeline, workflowName: string): PlatformInfo;
|
|
83
|
+
//# sourceMappingURL=platform-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-detector.d.ts","sourceRoot":"","sources":["../../../src/yaml/platform-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAElG,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAI5B;AAMD;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,YAAY,CAAS;gBAEjB,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM;IAMhF;;;;;;;;OAQG;IACH,WAAW,IAAI,QAAQ;IAmBvB;;;OAGG;IACH,QAAQ,IAAI,MAAM,GAAG,IAAI;IAIzB;;;OAGG;IACH,cAAc,IAAI,WAAW,GAAG,IAAI;IAIpC;;;OAGG;IACH,eAAe,IAAI,YAAY;IAQ/B;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAchC;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAqC3B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAkBxB;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAOtB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,GAAG,QAAQ,CAQrF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,GAAG,YAAY,CAQ7F"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform detection logic for YAML pipelines
|
|
3
|
+
* Implements 3-tier priority detection: stack → platform → auto-detect from steps
|
|
4
|
+
*/
|
|
5
|
+
export class PlatformDetectionError extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'PlatformDetectionError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
// Platform-specific step names
|
|
12
|
+
const MACOS_STEPS = new Set(['xcodebuild', 'xcode-test']);
|
|
13
|
+
const LINUX_STEPS = new Set(['gradle-build', 'android-lint', 'android-unit-test', 'set-java-version']);
|
|
14
|
+
/**
|
|
15
|
+
* PlatformDetector analyzes a YAML workflow and determines the target platform
|
|
16
|
+
*/
|
|
17
|
+
export class PlatformDetector {
|
|
18
|
+
pipeline;
|
|
19
|
+
workflow;
|
|
20
|
+
workflowName;
|
|
21
|
+
constructor(pipeline, workflow, workflowName) {
|
|
22
|
+
this.pipeline = pipeline;
|
|
23
|
+
this.workflow = workflow;
|
|
24
|
+
this.workflowName = workflowName;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Detects the platform using 3-tier priority detection
|
|
28
|
+
* Priority 1: meta.cibuild.io.stack
|
|
29
|
+
* Priority 2: meta.platform
|
|
30
|
+
* Priority 3: auto-detect from workflow steps
|
|
31
|
+
*
|
|
32
|
+
* @returns Detected platform ('macos', 'linux', or 'windows')
|
|
33
|
+
* @throws PlatformDetectionError if detection fails or mixed platforms detected
|
|
34
|
+
*/
|
|
35
|
+
getPlatform() {
|
|
36
|
+
// Priority 1: Extract from meta.cibuild.io.stack
|
|
37
|
+
if (this.pipeline.meta?.['cibuild.io']?.stack) {
|
|
38
|
+
const stack = this.pipeline.meta['cibuild.io'].stack;
|
|
39
|
+
const platform = this.extractPlatformFromStack(stack);
|
|
40
|
+
if (platform) {
|
|
41
|
+
return platform;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Priority 2: Use meta.platform
|
|
45
|
+
if (this.pipeline.meta?.platform) {
|
|
46
|
+
return this.pipeline.meta.platform;
|
|
47
|
+
}
|
|
48
|
+
// Priority 3: Auto-detect from workflow steps
|
|
49
|
+
return this.autoDetectFromSteps();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Gets the full stack identifier if specified
|
|
53
|
+
* @returns Stack identifier (e.g., 'macos-xcode-26.4') or null
|
|
54
|
+
*/
|
|
55
|
+
getStack() {
|
|
56
|
+
return this.pipeline.meta?.['cibuild.io']?.stack ?? null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Gets the machine type if specified
|
|
60
|
+
* @returns Machine type ('standard' or 'performance') or null
|
|
61
|
+
*/
|
|
62
|
+
getMachineType() {
|
|
63
|
+
return this.pipeline.meta?.['cibuild.io']?.machine_type ?? null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Gets complete platform information
|
|
67
|
+
* @returns PlatformInfo object with platform, stack, and machineType
|
|
68
|
+
*/
|
|
69
|
+
getPlatformInfo() {
|
|
70
|
+
return {
|
|
71
|
+
platform: this.getPlatform(),
|
|
72
|
+
stack: this.getStack() ?? undefined,
|
|
73
|
+
machineType: this.getMachineType() ?? undefined,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Extracts platform from stack name by parsing the prefix
|
|
78
|
+
* @param stack Stack identifier (e.g., 'macos-xcode-26.4')
|
|
79
|
+
* @returns Platform or null if pattern doesn't match
|
|
80
|
+
*/
|
|
81
|
+
extractPlatformFromStack(stack) {
|
|
82
|
+
const parts = stack.split('-');
|
|
83
|
+
if (parts.length === 0) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
const platformPrefix = parts[0];
|
|
87
|
+
if (platformPrefix === 'macos' || platformPrefix === 'linux' || platformPrefix === 'windows') {
|
|
88
|
+
return platformPrefix;
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Auto-detects platform by analyzing workflow steps
|
|
94
|
+
* @returns Detected platform, defaults to 'linux' for platform-agnostic steps
|
|
95
|
+
* @throws PlatformDetectionError if mixed platforms detected
|
|
96
|
+
*/
|
|
97
|
+
autoDetectFromSteps() {
|
|
98
|
+
const stepNames = this.extractStepNames();
|
|
99
|
+
const macosStepNames = [];
|
|
100
|
+
const linuxStepNames = [];
|
|
101
|
+
for (const stepName of stepNames) {
|
|
102
|
+
if (MACOS_STEPS.has(stepName)) {
|
|
103
|
+
macosStepNames.push(stepName);
|
|
104
|
+
}
|
|
105
|
+
if (LINUX_STEPS.has(stepName)) {
|
|
106
|
+
linuxStepNames.push(stepName);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Check for mixed platforms (FR-37)
|
|
110
|
+
if (macosStepNames.length > 0 && linuxStepNames.length > 0) {
|
|
111
|
+
throw new PlatformDetectionError(`Workflow '${this.workflowName}' contains steps for multiple platforms\n` +
|
|
112
|
+
` macOS steps: ${macosStepNames.join(', ')}\n` +
|
|
113
|
+
` Linux steps: ${linuxStepNames.join(', ')}\n` +
|
|
114
|
+
`Create separate workflows for each platform or use explicit meta.platform declaration.`);
|
|
115
|
+
}
|
|
116
|
+
// Return detected platform
|
|
117
|
+
if (macosStepNames.length > 0) {
|
|
118
|
+
return 'macos';
|
|
119
|
+
}
|
|
120
|
+
if (linuxStepNames.length > 0) {
|
|
121
|
+
return 'linux';
|
|
122
|
+
}
|
|
123
|
+
// Default to linux for platform-agnostic steps (script, git-clone, cache-*)
|
|
124
|
+
return 'linux';
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Extracts step names from workflow steps
|
|
128
|
+
* Parses step-name@version format to extract just the step name
|
|
129
|
+
* @returns Array of step names
|
|
130
|
+
*/
|
|
131
|
+
extractStepNames() {
|
|
132
|
+
const stepNames = [];
|
|
133
|
+
for (const stepObj of this.workflow.steps) {
|
|
134
|
+
// Each step is an object with one key: "step-name@version"
|
|
135
|
+
const stepKeys = Object.keys(stepObj);
|
|
136
|
+
if (stepKeys.length === 0) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
const stepNameWithVersion = stepKeys[0];
|
|
140
|
+
const stepName = this.parseStepName(stepNameWithVersion);
|
|
141
|
+
stepNames.push(stepName);
|
|
142
|
+
}
|
|
143
|
+
return stepNames;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Parses step name from "step-name@version" or "step-name" format
|
|
147
|
+
* @param stepNameWithVersion Full step identifier (e.g., "git-clone@4.0.17")
|
|
148
|
+
* @returns Step name without version (e.g., "git-clone")
|
|
149
|
+
*/
|
|
150
|
+
parseStepName(stepNameWithVersion) {
|
|
151
|
+
const atIndex = stepNameWithVersion.indexOf('@');
|
|
152
|
+
if (atIndex === -1) {
|
|
153
|
+
return stepNameWithVersion;
|
|
154
|
+
}
|
|
155
|
+
return stepNameWithVersion.substring(0, atIndex);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Helper function to detect platform for a specific workflow
|
|
160
|
+
* @param pipeline Parsed YAML pipeline
|
|
161
|
+
* @param workflowName Name of the workflow to analyze
|
|
162
|
+
* @returns Detected platform
|
|
163
|
+
* @throws Error if workflow doesn't exist
|
|
164
|
+
*/
|
|
165
|
+
export function detectPlatform(pipeline, workflowName) {
|
|
166
|
+
const workflow = pipeline.workflows[workflowName];
|
|
167
|
+
if (!workflow) {
|
|
168
|
+
throw new Error(`Workflow '${workflowName}' not found in pipeline`);
|
|
169
|
+
}
|
|
170
|
+
const detector = new PlatformDetector(pipeline, workflow, workflowName);
|
|
171
|
+
return detector.getPlatform();
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Helper function to get complete platform information for a workflow
|
|
175
|
+
* @param pipeline Parsed YAML pipeline
|
|
176
|
+
* @param workflowName Name of the workflow to analyze
|
|
177
|
+
* @returns PlatformInfo object
|
|
178
|
+
* @throws Error if workflow doesn't exist
|
|
179
|
+
*/
|
|
180
|
+
export function detectPlatformInfo(pipeline, workflowName) {
|
|
181
|
+
const workflow = pipeline.workflows[workflowName];
|
|
182
|
+
if (!workflow) {
|
|
183
|
+
throw new Error(`Workflow '${workflowName}' not found in pipeline`);
|
|
184
|
+
}
|
|
185
|
+
const detector = new PlatformDetector(pipeline, workflow, workflowName);
|
|
186
|
+
return detector.getPlatformInfo();
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=platform-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-detector.test.d.ts","sourceRoot":"","sources":["../../../src/yaml/platform-detector.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|