66 build_matrix :
77 description : Build matrix
88 value : ${{ steps.set-matrix.outputs.build_matrix }}
9-
109 full_matrix :
11- description : full matrix containing lava devails
10+ description : Full matrix containing lava details
1211 value : ${{ steps.set-matrix.outputs.full_matrix }}
1312
1413runs :
@@ -21,24 +20,49 @@ runs:
2120 script : |
2221 const fs = require('fs');
2322 const path = require('path');
24- const targetsPath = path.join(process.env.GITHUB_WORKSPACE, 'video-driver', 'ci', 'MACHINES.json');
23+
24+ // 1. Define possible paths for MACHINES.json
25+ // Path A: Workspace/video-driver/ci/MACHINES.json (Nested)
26+ const pathNested = path.join(process.env.GITHUB_WORKSPACE, 'video-driver', 'ci', 'MACHINES.json');
27+ // Path B: Workspace/ci/MACHINES.json (Root)
28+ const pathRoot = path.join(process.env.GITHUB_WORKSPACE, 'ci', 'MACHINES.json');
29+
30+ let targetsPath = '';
31+
32+ // 2. Check which path exists
33+ if (fs.existsSync(pathNested)) {
34+ console.log(`Found config at nested path: ${pathNested}`);
35+ targetsPath = pathNested;
36+ } else if (fs.existsSync(pathRoot)) {
37+ console.log(`Found config at root path: ${pathRoot}`);
38+ targetsPath = pathRoot;
39+ } else {
40+ // 3. Debugging: If neither exists, list files to help us see what is happening
41+ console.log('!!! Error: MACHINES.json not found in expected locations.');
42+ console.log(`Checked: ${pathNested}`);
43+ console.log(`Checked: ${pathRoot}`);
44+
45+ console.log('--- Workspace Root Contents ---');
46+ try {
47+ console.log(fs.readdirSync(process.env.GITHUB_WORKSPACE));
48+ } catch (e) { console.log(e.message); }
49+
50+ core.setFailed(`MACHINES.json not found.`);
51+ return;
52+ }
53+
54+ // 4. Parse the file
2555 let targets;
2656 try {
27- if (!fs.existsSync(targetsPath)) {
28- core.setFailed(`MACHINES.json not found at ${targetsPath}`);
29- return;
30- }
3157 targets = JSON.parse(fs.readFileSync(targetsPath, 'utf-8'));
3258 } catch (err) {
33- core.setFailed(`Failed to load or parse MACHINES.json: ${err.message}`);
59+ core.setFailed(`Failed to parse MACHINES.json: ${err.message}`);
3460 return;
3561 }
36- // Build matrix: machine, firmware
62+
63+ // 5. Generate Outputs
3764 const build_matrix = Object.values(targets).map(({ machine, firmware }) => ({ machine, firmware }));
3865 core.setOutput('build_matrix', JSON.stringify(build_matrix));
39- console.log("Build Matrix:", build_matrix);
4066
41- // Full matrix: machine, firmware, lavaname
4267 const full_matrix = Object.values(targets).map(({ machine, firmware, lavaname }) => ({ machine, firmware, lavaname }));
43- core.setOutput('full_matrix', JSON.stringify(full_matrix));
44- console.log("Full Matrix:", full_matrix);
68+ core.setOutput('full_matrix', JSON.stringify(full_matrix));
0 commit comments