-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-dry-run.js
More file actions
executable file
·61 lines (52 loc) · 1.62 KB
/
test-dry-run.js
File metadata and controls
executable file
·61 lines (52 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env node
/**
* Integration test script for testing the nais CLI setup action locally
* This demonstrates how to test the action without installing binaries permanently
*/
import { execSync } from 'child_process';
console.log('🧪 Testing nais CLI setup action in dry-run mode...\n');
// Set environment variables for dry-run mode
const env = {
...process.env,
NODE_ENV: 'test',
NAIS_CLI_DRY_RUN: 'true',
RUNNER_OS: 'Linux',
RUNNER_ARCH: 'X64',
RUNNER_TEMP: '/tmp',
INPUT_VERSION: 'latest',
};
try {
console.log('Environment variables:');
console.log('- NODE_ENV:', env.NODE_ENV);
console.log('- NAIS_CLI_DRY_RUN:', env.NAIS_CLI_DRY_RUN);
console.log('- RUNNER_OS:', env.RUNNER_OS);
console.log('- RUNNER_ARCH:', env.RUNNER_ARCH);
console.log('- INPUT_VERSION:', env.INPUT_VERSION);
console.log('');
// Build the action first
console.log('📦 Building action...');
execSync('npm run build', { stdio: 'pipe' });
console.log('✅ Build completed\n');
// Run the action
console.log('🚀 Running action in dry-run mode...');
const output = execSync('node dist/index.js', {
env,
encoding: 'utf8',
stdio: 'pipe',
});
console.log('📝 Action output:');
console.log(output);
console.log('\n✅ Dry-run test completed successfully!');
console.log(
'🎉 The action downloaded and verified the binary without installing it permanently.'
);
} catch (error) {
console.error('❌ Test failed:', error.message);
if (error.stdout) {
console.error('stdout:', error.stdout);
}
if (error.stderr) {
console.error('stderr:', error.stderr);
}
process.exit(1);
}