File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -38,14 +38,34 @@ jobs:
38
38
java-version : ' 21'
39
39
cache : maven
40
40
41
+ - uses : actions/setup-node@v3
42
+ with :
43
+ node-version : ' 20'
44
+ - run : npm install xml2js
45
+
46
+ - name : Extract modules from pom.xml
47
+ id : extract-modules
48
+ uses : actions/github-script@v7
49
+ with :
50
+ script : |
51
+ const fs = require('fs');
52
+ const xml2js = require('xml2js');
53
+
54
+ const pomXml = fs.readFileSync('${{ env.STUDENT_REPO_PATH }}/pom.xml', 'utf8');
55
+ const parser = new xml2js.Parser();
56
+ const result = await parser.parseStringPromise(pomXml);
57
+ const modules = result.project.modules[0].module || [];
58
+
59
+ core.setOutput('modules', modules.join(' '));
60
+
61
+ return modules.join(' ');
62
+
41
63
- name : Run tests
42
64
id : test
43
65
run : |
44
66
cd ${{ env.STUDENT_REPO_PATH }}
45
67
chmod +x mvnw
46
- # Extract module names from pom.xml
47
- MODULES=$(xmllint --xpath "//modules/module/text()" pom.xml)
48
- for dir in $MODULES; do
68
+ for dir in ${{ steps.extract-modules.outputs.modules }}; do
49
69
if [ -d "$dir" ]; then
50
70
echo "Running tests for $dir..."
51
71
./mvnw test -B --projects $dir || true
You can’t perform that action at this time.
0 commit comments