@@ -16,6 +16,11 @@ inputs:
16
16
required : false
17
17
type : boolean
18
18
default : false
19
+ warnings-as-errors :
20
+ description : ' If set to true then any errors produced whilst loading the package will be treated as errors'
21
+ required : false
22
+ type : boolean
23
+ default : false
19
24
env :
20
25
CHERE_INVOKING : 1
21
26
@@ -59,14 +64,33 @@ runs:
59
64
if IsEmpty(GAP_TESTFILE) or not IsExistingFile(GAP_TESTFILE) then
60
65
GAP_TESTFILE := info.TestFile;
61
66
fi;
62
- # Load the package with debug info
67
+
63
68
SetInfoLevel(InfoPackageLoading, PACKAGE_DEBUG);
64
69
SetPackagePath(info.PackageName, "/tmp/gaproot/pkg/$(basename $PWD)");
70
+
71
+ # Capture the output of loading
72
+ output := "";
73
+ output_stream := OutputTextString(output, true);
74
+ SetPrintFormattingStatus(output_stream, false);
75
+ OutputLogTo(output_stream);
76
+
77
+ # Load the package with debug info
65
78
if ${{ inputs.only-needed }} = true then
66
79
LoadPackage(info.PackageName : OnlyNeeded);
67
80
else
68
81
LoadPackage(info.PackageName);
69
82
fi;
83
+
84
+ OutputLogTo();
85
+ CloseStream(output_stream);
86
+
87
+ # Treat warnings as errors if specified
88
+ if ${{ inputs.warnings-as-errors }} = 'true' ; then
89
+ if PositionSublist(output, "warning") <> fail then
90
+ Error("Warnings were found when loading the package");
91
+ fi;
92
+ fi;
93
+
70
94
SetInfoLevel(InfoPackageLoading, PACKAGE_ERROR);
71
95
Print("Now running tests from ", GAP_TESTFILE, "\n");
72
96
if EndsWith(GAP_TESTFILE, ".tst") then
0 commit comments