@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,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for Bitrise install-missing-android-tools step
|
|
3
|
+
*/
|
|
4
|
+
import { describe, test, expect } from '@jest/globals';
|
|
5
|
+
import { BitriseAndroidToolsStepExecutor } from './bitrise-android-tools.js';
|
|
6
|
+
describe('BitriseAndroidToolsStepExecutor', () => {
|
|
7
|
+
const mockConfig = {
|
|
8
|
+
artifactsDir: '/ci/artifacts',
|
|
9
|
+
interpreters: {
|
|
10
|
+
python: '/usr/bin/python3',
|
|
11
|
+
ruby: '/usr/bin/ruby',
|
|
12
|
+
node: '/usr/bin/node',
|
|
13
|
+
bash: '/bin/bash',
|
|
14
|
+
},
|
|
15
|
+
maxConcurrentJobs: 4,
|
|
16
|
+
paths: {
|
|
17
|
+
buildsDir: '/ci/builds',
|
|
18
|
+
cacheDir: '/ci/cache',
|
|
19
|
+
derivedDataDir: '/ci/derived_data',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
describe('Basic functionality', () => {
|
|
23
|
+
test('should create Android tools setup script with default values', async () => {
|
|
24
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
25
|
+
const env = {
|
|
26
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
27
|
+
};
|
|
28
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
29
|
+
expect(result.kind).toBe('script');
|
|
30
|
+
expect(result.name).toBe('install-missing-android-tools');
|
|
31
|
+
expect(result.script).toContain('Verifying Android development environment');
|
|
32
|
+
});
|
|
33
|
+
test('should verify ANDROID_HOME environment variable', async () => {
|
|
34
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
35
|
+
const env = {
|
|
36
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
37
|
+
};
|
|
38
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
39
|
+
expect(result.script).toContain('if [ -z "$ANDROID_HOME" ]; then');
|
|
40
|
+
expect(result.script).toContain('ANDROID_HOME is not set');
|
|
41
|
+
expect(result.script).toContain('Please install Android Studio or set ANDROID_HOME manually:');
|
|
42
|
+
});
|
|
43
|
+
test('should verify ANDROID_HOME directory exists', async () => {
|
|
44
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
45
|
+
const env = {
|
|
46
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
47
|
+
};
|
|
48
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
49
|
+
expect(result.script).toContain('if [ ! -d "$ANDROID_HOME" ]; then');
|
|
50
|
+
expect(result.script).toContain('ANDROID_HOME directory does not exist');
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
describe('Gradlew handling', () => {
|
|
54
|
+
test('should make default gradlew executable', async () => {
|
|
55
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
56
|
+
const env = {
|
|
57
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
58
|
+
};
|
|
59
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
60
|
+
expect(result.script).toContain('GRADLEW_FULL_PATH="./gradlew"');
|
|
61
|
+
expect(result.script).toContain('if [ -f "$GRADLEW_FULL_PATH" ]; then');
|
|
62
|
+
expect(result.script).toContain('chmod +x "$GRADLEW_FULL_PATH"');
|
|
63
|
+
expect(result.script).toContain('gradlew is now executable');
|
|
64
|
+
});
|
|
65
|
+
test('should use custom gradlew_path when provided', async () => {
|
|
66
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
67
|
+
const env = {
|
|
68
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
69
|
+
};
|
|
70
|
+
const inputs = {
|
|
71
|
+
gradlew_path: 'android/gradlew',
|
|
72
|
+
};
|
|
73
|
+
const result = await executor.execute(inputs, env, mockConfig);
|
|
74
|
+
expect(result.script).toContain('GRADLEW_FULL_PATH="android/gradlew"');
|
|
75
|
+
expect(result.script).toContain('if [ -f "$GRADLEW_FULL_PATH" ]; then');
|
|
76
|
+
expect(result.script).toContain('chmod +x "$GRADLEW_FULL_PATH"');
|
|
77
|
+
expect(result.script).toContain('gradlew is now executable');
|
|
78
|
+
});
|
|
79
|
+
test('should handle gradlew not found gracefully', async () => {
|
|
80
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
81
|
+
const env = {
|
|
82
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
83
|
+
};
|
|
84
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
85
|
+
expect(result.script).toContain('gradlew not found at $GRADLEW_FULL_PATH (will be checked at runtime by gradle steps)');
|
|
86
|
+
});
|
|
87
|
+
test('should verify Gradle works', async () => {
|
|
88
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
89
|
+
const env = {
|
|
90
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
91
|
+
};
|
|
92
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
93
|
+
expect(result.script).toContain('if [ -f "$GRADLEW_FULL_PATH" ] && [ -z "$SKIP_GRADLE_CHECK" ]; then');
|
|
94
|
+
expect(result.script).toContain('./gradlew --version');
|
|
95
|
+
expect(result.script).toContain('Gradle is working correctly');
|
|
96
|
+
});
|
|
97
|
+
test('should test custom gradlew path version', async () => {
|
|
98
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
99
|
+
const env = {
|
|
100
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
101
|
+
};
|
|
102
|
+
const inputs = {
|
|
103
|
+
gradlew_path: 'custom/path/gradlew',
|
|
104
|
+
};
|
|
105
|
+
const result = await executor.execute(inputs, env, mockConfig);
|
|
106
|
+
expect(result.script).toContain('GRADLEW_FULL_PATH="custom/path/gradlew"');
|
|
107
|
+
expect(result.script).toContain('./gradlew --version');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe('NDK handling', () => {
|
|
111
|
+
test('should display NDK information when ndk_revision is provided', async () => {
|
|
112
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
113
|
+
const env = {
|
|
114
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
115
|
+
};
|
|
116
|
+
const inputs = {
|
|
117
|
+
ndk_revision: '21.3.6528147',
|
|
118
|
+
};
|
|
119
|
+
const result = await executor.execute(inputs, env, mockConfig);
|
|
120
|
+
expect(result.script).toContain('Requested NDK revision: 21.3.6528147');
|
|
121
|
+
expect(result.script).toContain('if [ -d "$ANDROID_HOME/ndk" ]; then');
|
|
122
|
+
});
|
|
123
|
+
test('should not include NDK information when ndk_revision is not provided', async () => {
|
|
124
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
125
|
+
const env = {
|
|
126
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
127
|
+
};
|
|
128
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
129
|
+
expect(result.script).not.toContain('Requested NDK revision');
|
|
130
|
+
});
|
|
131
|
+
test('should handle empty ndk_revision', async () => {
|
|
132
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
133
|
+
const env = {
|
|
134
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
135
|
+
};
|
|
136
|
+
const inputs = {
|
|
137
|
+
ndk_revision: '',
|
|
138
|
+
};
|
|
139
|
+
const result = await executor.execute(inputs, env, mockConfig);
|
|
140
|
+
expect(result.script).not.toContain('Requested NDK revision');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
describe('Android SDK information', () => {
|
|
144
|
+
test('should display Android SDK location', async () => {
|
|
145
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
146
|
+
const env = {
|
|
147
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
148
|
+
};
|
|
149
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
150
|
+
expect(result.script).toContain('Android SDK location: $ANDROID_HOME');
|
|
151
|
+
});
|
|
152
|
+
test('should check for platform-tools', async () => {
|
|
153
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
154
|
+
const env = {
|
|
155
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
156
|
+
};
|
|
157
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
158
|
+
expect(result.script).toContain('if [ -d "$ANDROID_HOME/platform-tools" ]; then');
|
|
159
|
+
expect(result.script).toContain('Platform tools: Available');
|
|
160
|
+
});
|
|
161
|
+
test('should check for build-tools', async () => {
|
|
162
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
163
|
+
const env = {
|
|
164
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
165
|
+
};
|
|
166
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
167
|
+
expect(result.script).toContain('if [ -d "$ANDROID_HOME/build-tools" ]; then');
|
|
168
|
+
expect(result.script).toContain('Build tools: Available');
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
describe('PATH configuration', () => {
|
|
172
|
+
test('should add Android SDK tools to PATH', async () => {
|
|
173
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
174
|
+
const env = {
|
|
175
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
176
|
+
};
|
|
177
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
178
|
+
expect(result.script).toContain('export PATH="$ANDROID_HOME/platform-tools:$PATH"');
|
|
179
|
+
expect(result.script).toContain('export PATH="$ANDROID_HOME/tools:$PATH"');
|
|
180
|
+
expect(result.script).toContain('export PATH="$ANDROID_HOME/tools/bin:$PATH"');
|
|
181
|
+
});
|
|
182
|
+
test('should display ADB version if available', async () => {
|
|
183
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
184
|
+
const env = {
|
|
185
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
186
|
+
};
|
|
187
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
188
|
+
expect(result.script).toContain('if command -v adb >/dev/null 2>&1; then');
|
|
189
|
+
expect(result.script).toContain('adb version');
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
describe('Script structure', () => {
|
|
193
|
+
test('should include bash error handling directives', async () => {
|
|
194
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
195
|
+
const env = {
|
|
196
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
197
|
+
};
|
|
198
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
199
|
+
expect(result.script).toContain('#!/bin/bash');
|
|
200
|
+
expect(result.script).toContain('set -e');
|
|
201
|
+
expect(result.script).toContain('set -o pipefail');
|
|
202
|
+
});
|
|
203
|
+
test('should include informative messages', async () => {
|
|
204
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
205
|
+
const env = {
|
|
206
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
207
|
+
};
|
|
208
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
209
|
+
expect(result.script).toContain('Bitrise install-missing-android-tools step → CI Build Android environment setup');
|
|
210
|
+
expect(result.script).toContain('Verifying Android development environment');
|
|
211
|
+
expect(result.script).toContain('Android development environment verified successfully');
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
describe('Special characters handling', () => {
|
|
215
|
+
test('should escape special characters in gradlew path', async () => {
|
|
216
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
217
|
+
const env = {
|
|
218
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
219
|
+
};
|
|
220
|
+
const inputs = {
|
|
221
|
+
gradlew_path: "path/with'quotes/gradlew",
|
|
222
|
+
};
|
|
223
|
+
const result = await executor.execute(inputs, env, mockConfig);
|
|
224
|
+
// Should escape single quotes properly
|
|
225
|
+
expect(result.script).toContain('gradlew');
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
describe('Integration scenarios', () => {
|
|
229
|
+
test('should work with custom gradlew path and NDK revision', async () => {
|
|
230
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
231
|
+
const env = {
|
|
232
|
+
ANDROID_HOME: '/opt/android-sdk',
|
|
233
|
+
};
|
|
234
|
+
const inputs = {
|
|
235
|
+
gradlew_path: 'android/gradlew',
|
|
236
|
+
ndk_revision: '23.1.7779620',
|
|
237
|
+
};
|
|
238
|
+
const result = await executor.execute(inputs, env, mockConfig);
|
|
239
|
+
expect(result.script).toContain('GRADLEW_FULL_PATH="android/gradlew"');
|
|
240
|
+
expect(result.script).toContain('chmod +x "$GRADLEW_FULL_PATH"');
|
|
241
|
+
expect(result.script).toContain('./gradlew --version');
|
|
242
|
+
expect(result.script).toContain('Requested NDK revision: 23.1.7779620');
|
|
243
|
+
});
|
|
244
|
+
test('should work with minimal configuration', async () => {
|
|
245
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
246
|
+
const env = {
|
|
247
|
+
ANDROID_HOME: '/android-sdk',
|
|
248
|
+
};
|
|
249
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
250
|
+
expect(result.kind).toBe('script');
|
|
251
|
+
expect(result.name).toBe('install-missing-android-tools');
|
|
252
|
+
expect(result.script).toContain('./gradlew');
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
describe('Bitrise compatibility', () => {
|
|
256
|
+
test('should map to CI Build Android environment setup pattern', async () => {
|
|
257
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
258
|
+
const env = {
|
|
259
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
260
|
+
};
|
|
261
|
+
const result = await executor.execute({}, env, mockConfig);
|
|
262
|
+
// Should include CI Build branding
|
|
263
|
+
expect(result.script).toContain('CI Build Android environment setup');
|
|
264
|
+
});
|
|
265
|
+
test('should support Bitrise input naming conventions', async () => {
|
|
266
|
+
const executor = new BitriseAndroidToolsStepExecutor();
|
|
267
|
+
const env = {
|
|
268
|
+
ANDROID_HOME: '/usr/local/android-sdk',
|
|
269
|
+
};
|
|
270
|
+
const inputs = {
|
|
271
|
+
gradlew_path: './gradlew',
|
|
272
|
+
ndk_revision: '21.4.7075529',
|
|
273
|
+
};
|
|
274
|
+
const result = await executor.execute(inputs, env, mockConfig);
|
|
275
|
+
expect(result.script).toBeDefined();
|
|
276
|
+
expect(result.kind).toBe('script');
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
//# sourceMappingURL=bitrise-android-tools.test.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bitrise apk-info step implementation
|
|
3
|
+
* Extracts metadata from Android APK files
|
|
4
|
+
*/
|
|
5
|
+
import { BaseStepExecutor } from './base.js';
|
|
6
|
+
import type { StepDef, CIConfig } from '../../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Inputs for apk-info step
|
|
9
|
+
*/
|
|
10
|
+
export interface BitriseApkInfoInputs {
|
|
11
|
+
apk_path?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Bitrise apk-info step executor (FR-7)
|
|
15
|
+
* Extracts and displays Android APK metadata
|
|
16
|
+
*
|
|
17
|
+
* Supports Bitrise step versions: apk-info@1
|
|
18
|
+
*/
|
|
19
|
+
export declare class BitriseApkInfoStepExecutor extends BaseStepExecutor {
|
|
20
|
+
execute(inputs: BitriseApkInfoInputs, env: Record<string, string>, config: CIConfig): Promise<StepDef>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=bitrise-apk-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitrise-apk-info.d.ts","sourceRoot":"","sources":["../../../../src/yaml/steps/bitrise-apk-info.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,qBAAa,0BAA2B,SAAQ,gBAAgB;IACxD,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;CAkJ7G"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bitrise apk-info step implementation
|
|
3
|
+
* Extracts metadata from Android APK files
|
|
4
|
+
*/
|
|
5
|
+
import { BaseStepExecutor } from './base.js';
|
|
6
|
+
/**
|
|
7
|
+
* Bitrise apk-info step executor (FR-7)
|
|
8
|
+
* Extracts and displays Android APK metadata
|
|
9
|
+
*
|
|
10
|
+
* Supports Bitrise step versions: apk-info@1
|
|
11
|
+
*/
|
|
12
|
+
export class BitriseApkInfoStepExecutor extends BaseStepExecutor {
|
|
13
|
+
async execute(inputs, env, config) {
|
|
14
|
+
const stepName = 'apk-info';
|
|
15
|
+
// Get APK path (FR-7.2)
|
|
16
|
+
const apkPath = this.getInput(inputs, 'apk_path', '');
|
|
17
|
+
const commands = [];
|
|
18
|
+
commands.push('# Bitrise apk-info step → CI Build APK metadata extraction');
|
|
19
|
+
commands.push('echo "📱 Extracting APK metadata..."');
|
|
20
|
+
commands.push('');
|
|
21
|
+
// Find APK file (FR-7.2, OQ-5)
|
|
22
|
+
commands.push('# Locate APK file');
|
|
23
|
+
commands.push('APK_FILE=""');
|
|
24
|
+
commands.push('');
|
|
25
|
+
if (apkPath) {
|
|
26
|
+
// User specified APK path
|
|
27
|
+
commands.push(`# User specified APK path: ${this.escapeBash(apkPath)}`);
|
|
28
|
+
commands.push(`APK_FILE="${this.escapeBash(apkPath)}"`);
|
|
29
|
+
commands.push('');
|
|
30
|
+
commands.push('if [ ! -f "$APK_FILE" ]; then');
|
|
31
|
+
commands.push(' echo "❌ Error: APK file not found: $APK_FILE"');
|
|
32
|
+
commands.push(' exit 1');
|
|
33
|
+
commands.push('fi');
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
// Auto-detect APK in standard locations (FR-7.2, OQ-5)
|
|
37
|
+
commands.push('# Auto-detect APK file in build/outputs/apk/');
|
|
38
|
+
commands.push('if [ -d "build/outputs/apk" ]; then');
|
|
39
|
+
commands.push(' # Find most recently modified APK file (OQ-5)');
|
|
40
|
+
commands.push(' APK_FILE=$(find build/outputs/apk -name "*.apk" -type f -print0 | xargs -0 ls -t | head -n 1)');
|
|
41
|
+
commands.push(' ');
|
|
42
|
+
commands.push(' if [ -n "$APK_FILE" ]; then');
|
|
43
|
+
commands.push(' echo "Found APK: $APK_FILE"');
|
|
44
|
+
commands.push(' else');
|
|
45
|
+
commands.push(' echo "❌ Error: No APK files found in build/outputs/apk/"');
|
|
46
|
+
commands.push(' exit 1');
|
|
47
|
+
commands.push(' fi');
|
|
48
|
+
commands.push('else');
|
|
49
|
+
commands.push(' echo "❌ Error: build/outputs/apk/ directory not found"');
|
|
50
|
+
commands.push(' echo " Please specify apk_path input or ensure APK is built to standard location"');
|
|
51
|
+
commands.push(' exit 1');
|
|
52
|
+
commands.push('fi');
|
|
53
|
+
}
|
|
54
|
+
commands.push('');
|
|
55
|
+
// Check for aapt/aapt2 (FR-7.3)
|
|
56
|
+
commands.push('# Check for aapt or aapt2');
|
|
57
|
+
commands.push('AAPT_CMD=""');
|
|
58
|
+
commands.push('if command -v aapt2 >/dev/null 2>&1; then');
|
|
59
|
+
commands.push(' AAPT_CMD="aapt2"');
|
|
60
|
+
commands.push(' echo "Using aapt2 for APK analysis"');
|
|
61
|
+
commands.push('elif command -v aapt >/dev/null 2>&1; then');
|
|
62
|
+
commands.push(' AAPT_CMD="aapt"');
|
|
63
|
+
commands.push(' echo "Using aapt for APK analysis"');
|
|
64
|
+
commands.push('else');
|
|
65
|
+
commands.push(' echo "❌ Error: aapt or aapt2 not found"');
|
|
66
|
+
commands.push(' echo " Install Android SDK build-tools or set ANDROID_HOME"');
|
|
67
|
+
commands.push(' exit 1');
|
|
68
|
+
commands.push('fi');
|
|
69
|
+
commands.push('');
|
|
70
|
+
// Extract APK metadata (FR-7.4)
|
|
71
|
+
commands.push('# Extract APK metadata using aapt/aapt2');
|
|
72
|
+
commands.push('echo ""');
|
|
73
|
+
commands.push('echo "╔═══════════════════════════════════════════════╗"');
|
|
74
|
+
commands.push('echo "║ APK Information ║"');
|
|
75
|
+
commands.push('echo "╚═══════════════════════════════════════════════╝"');
|
|
76
|
+
commands.push('echo ""');
|
|
77
|
+
commands.push('');
|
|
78
|
+
// Display file information (FR-7.5)
|
|
79
|
+
commands.push('# Display file information');
|
|
80
|
+
commands.push('echo "File: $APK_FILE"');
|
|
81
|
+
commands.push('');
|
|
82
|
+
commands.push('# Get file size in human-readable format (FR-7.5)');
|
|
83
|
+
commands.push('if command -v du >/dev/null 2>&1; then');
|
|
84
|
+
commands.push(' FILE_SIZE=$(du -h "$APK_FILE" | cut -f1)');
|
|
85
|
+
commands.push(' echo "Size: $FILE_SIZE"');
|
|
86
|
+
commands.push('fi');
|
|
87
|
+
commands.push('echo ""');
|
|
88
|
+
commands.push('');
|
|
89
|
+
// Run aapt dump badging to extract metadata
|
|
90
|
+
commands.push('# Extract metadata with aapt dump badging');
|
|
91
|
+
commands.push('AAPT_OUTPUT=$($AAPT_CMD dump badging "$APK_FILE" 2>&1)');
|
|
92
|
+
commands.push('');
|
|
93
|
+
// Extract package name (FR-7.4)
|
|
94
|
+
commands.push('# Extract package name');
|
|
95
|
+
commands.push('PACKAGE_NAME=$(echo "$AAPT_OUTPUT" | grep "^package:" | sed -E "s/.*name=\'([^\']*)\'.*/\\1/")');
|
|
96
|
+
commands.push('echo "Package name: $PACKAGE_NAME"');
|
|
97
|
+
commands.push('');
|
|
98
|
+
// Extract version code (FR-7.4)
|
|
99
|
+
commands.push('# Extract version code');
|
|
100
|
+
commands.push('VERSION_CODE=$(echo "$AAPT_OUTPUT" | grep "^package:" | sed -E "s/.*versionCode=\'([^\']*)\'.*/\\1/")');
|
|
101
|
+
commands.push('echo "Version code: $VERSION_CODE"');
|
|
102
|
+
commands.push('');
|
|
103
|
+
// Extract version name (FR-7.4)
|
|
104
|
+
commands.push('# Extract version name');
|
|
105
|
+
commands.push('VERSION_NAME=$(echo "$AAPT_OUTPUT" | grep "^package:" | sed -E "s/.*versionName=\'([^\']*)\'.*/\\1/")');
|
|
106
|
+
commands.push('echo "Version name: $VERSION_NAME"');
|
|
107
|
+
commands.push('');
|
|
108
|
+
// Extract min SDK (FR-7.4)
|
|
109
|
+
commands.push('# Extract minimum SDK version');
|
|
110
|
+
commands.push('MIN_SDK=$(echo "$AAPT_OUTPUT" | grep "sdkVersion:" | sed -E "s/.*sdkVersion:\'([^\']*)\'.*/\\1/")');
|
|
111
|
+
commands.push('echo "Minimum SDK: $MIN_SDK"');
|
|
112
|
+
commands.push('');
|
|
113
|
+
// Extract target SDK (FR-7.4)
|
|
114
|
+
commands.push('# Extract target SDK version');
|
|
115
|
+
commands.push('TARGET_SDK=$(echo "$AAPT_OUTPUT" | grep "targetSdkVersion:" | sed -E "s/.*targetSdkVersion:\'([^\']*)\'.*/\\1/")');
|
|
116
|
+
commands.push('echo "Target SDK: $TARGET_SDK"');
|
|
117
|
+
commands.push('');
|
|
118
|
+
// Export metadata as environment variables (FR-7.6)
|
|
119
|
+
commands.push('echo ""');
|
|
120
|
+
commands.push('echo "Exporting metadata as environment variables..."');
|
|
121
|
+
commands.push('');
|
|
122
|
+
commands.push('# Export metadata for subsequent steps (FR-7.6)');
|
|
123
|
+
commands.push('export APK_FILE_PATH="$APK_FILE"');
|
|
124
|
+
commands.push('export APK_PACKAGE_NAME="$PACKAGE_NAME"');
|
|
125
|
+
commands.push('export APK_VERSION_CODE="$VERSION_CODE"');
|
|
126
|
+
commands.push('export APK_VERSION_NAME="$VERSION_NAME"');
|
|
127
|
+
commands.push('export APK_MIN_SDK="$MIN_SDK"');
|
|
128
|
+
commands.push('export APK_TARGET_SDK="$TARGET_SDK"');
|
|
129
|
+
commands.push('');
|
|
130
|
+
commands.push('# Display exported variables');
|
|
131
|
+
commands.push('echo "Exported environment variables:"');
|
|
132
|
+
commands.push('echo " APK_FILE_PATH=$APK_FILE_PATH"');
|
|
133
|
+
commands.push('echo " APK_PACKAGE_NAME=$APK_PACKAGE_NAME"');
|
|
134
|
+
commands.push('echo " APK_VERSION_CODE=$APK_VERSION_CODE"');
|
|
135
|
+
commands.push('echo " APK_VERSION_NAME=$APK_VERSION_NAME"');
|
|
136
|
+
commands.push('echo " APK_MIN_SDK=$APK_MIN_SDK"');
|
|
137
|
+
commands.push('echo " APK_TARGET_SDK=$APK_TARGET_SDK"');
|
|
138
|
+
commands.push('');
|
|
139
|
+
commands.push('echo "✅ APK metadata extracted successfully"');
|
|
140
|
+
const script = this.createBashScriptFromCommands(commands, stepName);
|
|
141
|
+
return this.createScriptStep(script, stepName);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=bitrise-apk-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitrise-apk-info.test.d.ts","sourceRoot":"","sources":["../../../../src/yaml/steps/bitrise-apk-info.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|