1+ name : Test nvu full installation process
2+
3+ on :
4+ push :
5+ branches : [ master ]
6+ pull_request :
7+ branches : [ master ]
8+ workflow_dispatch :
9+
10+ jobs :
11+ test-nvu-installation :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v3
15+
16+ - name : Setup Node.js
17+ uses : actions/setup-node@v3
18+ with :
19+ node-version : ' 20'
20+
21+ - name : Install nvu
22+ run : |
23+ npm install -g node-version-use
24+
25+ - name : Test nvu installation of Node 24
26+ run : |
27+ echo "Installing Node 24 with nvu..."
28+ nvu install 24
29+
30+ echo "Checking installation..."
31+ nvu 24 node --version
32+ nvu 24 npm --version
33+
34+ - name : Test npm cache clean (reproduces CI issue)
35+ run : |
36+ echo "Testing npm cache clean - this is where the CI issue occurs..."
37+ nvu 24 npm cache clean --force
38+
39+ - name : Validate nvu installation structure
40+ run : |
41+ echo "Creating validation script..."
42+ cat > validate-nvu-installation.cjs << 'EOF'
43+ const fs = require('fs');
44+ const path = require('path');
45+
46+ function validateNvuInstallation(installPath) {
47+ console.log(`Validating nvu installation in ${installPath}`);
48+
49+ // Check for node executable
50+ const nodePath = path.join(installPath, 'bin', 'node');
51+ if (!fs.existsSync(nodePath)) {
52+ console.error('✗ node executable NOT FOUND');
53+ return false;
54+ }
55+ console.log('✓ node executable exists');
56+
57+ // Check for npm directory
58+ const npmPath = path.join(installPath, 'lib', 'node_modules', 'npm');
59+ if (!fs.existsSync(npmPath)) {
60+ console.error('✗ npm directory NOT FOUND');
61+ return false;
62+ }
63+ console.log('✓ npm directory exists');
64+
65+ // Check for npm package.json
66+ const npmPackageJsonPath = path.join(npmPath, 'package.json');
67+ if (!fs.existsSync(npmPackageJsonPath)) {
68+ console.error('✗ npm package.json NOT FOUND');
69+ return false;
70+ }
71+ console.log('✓ npm package.json exists');
72+
73+ // Check for the problematic minimatch file
74+ const minimatchPath = path.join(npmPath, 'node_modules', '@tufjs', 'models', 'node_modules', 'minimatch', 'dist', 'commonjs', 'index.js');
75+ if (!fs.existsSync(minimatchPath)) {
76+ console.error('✗ minimatch index.js NOT FOUND - This is the CI issue!');
77+
78+ // Debug info
79+ const tufjsDir = path.join(npmPath, 'node_modules', '@tufjs');
80+ if (fs.existsSync(tufjsDir)) {
81+ console.log('Contents of @tufjs directory:');
82+ const files = fs.readdirSync(tufjsDir);
83+ files.forEach(file => console.log(` ${file}`));
84+ }
85+
86+ return false;
87+ }
88+
89+ console.log('✓ minimatch index.js exists');
90+ console.log('SUCCESS: nvu installation is complete and valid!');
91+ return true;
92+ }
93+
94+ // Test the installation
95+ const installPath = path.join(process.env.HOME, '.nvu', 'installed', 'v24.12.0');
96+ if (fs.existsSync(installPath)) {
97+ process.exit(validateNvuInstallation(installPath) ? 0 : 1);
98+ } else {
99+ console.error('Installation directory not found');
100+ process.exit(1);
101+ }
102+ EOF
103+
104+ echo "Running validation..."
105+ node validate-nvu-installation.cjs
0 commit comments