Skip to content

Commit

Permalink
Allow testing with only needed dependencies loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Jun 19, 2023
1 parent e4aab55 commit 6404554
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ inputs:
NO_COVERAGE:
description: 'set to a non-empty string to suppress gathering coverage'
required: false
type: string
default: ''
GAP_TESTFILE:
description: 'Name of the GAP file to be read for executing the package tests (overrides TestFile in PackageInfo.g)'
required: false
type: string
default: ''
only-needed:
description: 'If set to true then only needed dependencies of the package being tested are loaded'
required: false
type: boolean
default: false
env:
CHERE_INVOKING: 1

Expand All @@ -33,6 +40,10 @@ runs:
# start GAP with custom GAP root, to ensure correct package version is loaded
GAP="$GAPROOT/bin/gap.sh -l /tmp/gaproot; --quitonbreak"
if ${{ inputs.only-needed }} = 'true' ; then
GAP="$GAP -A"
fi
# Unless explicitly turned off by setting the NO_COVERAGE environment variable,
# we collect coverage data
if [[ -z "${{ inputs.NO_COVERAGE }}" ]]; then
Expand All @@ -51,7 +62,11 @@ runs:
# Load the package with debug info
SetInfoLevel(InfoPackageLoading, PACKAGE_DEBUG);
SetPackagePath(info.PackageName, "/tmp/gaproot/pkg/$(basename $PWD)");
LoadPackage(info.PackageName);
if ${{ inputs.only-needed }} = true then
LoadPackage(info.PackageName : OnlyNeeded);
else
LoadPackage(info.PackageName);
fi;
SetInfoLevel(InfoPackageLoading, PACKAGE_ERROR);
Print("Now running tests from ", GAP_TESTFILE, "\n");
if EndsWith(GAP_TESTFILE, ".tst") then
Expand Down

0 comments on commit 6404554

Please sign in to comment.