forked from digraphs/Digraphs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9c1f47
commit a994f59
Showing
8 changed files
with
162 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,88 @@ | ||
name: 'Run package tests' | ||
description: 'Run package tests' | ||
name: Run package tests | ||
description: Run package tests | ||
inputs: | ||
NO_COVERAGE: | ||
description: 'set to a non-empty string to suppress gathering coverage' | ||
description: set to a non-empty string to suppress gathering coverage | ||
required: false | ||
type: string | ||
default: '' | ||
default: "" | ||
GAP_TESTFILE: | ||
description: 'Name of the GAP file to be read for executing the package tests (overrides TestFile in PackageInfo.g)' | ||
description: Name of the GAP file to be read for executing the package tests (overrides TestFile in PackageInfo.g) | ||
required: false | ||
type: string | ||
default: '' | ||
default: "" | ||
only-needed: | ||
description: 'If set to true then only needed dependencies of the package being tested are loaded' | ||
description: If set to true then only needed dependencies of the package being tested are loaded | ||
required: false | ||
type: boolean | ||
default: false | ||
pre-gap: | ||
description: 'Commands to be prepended to gap' | ||
description: Commands to be prepended to gap | ||
required: false | ||
type: string | ||
default: '' | ||
default: "" | ||
|
||
env: | ||
CHERE_INVOKING: 1 | ||
|
||
runs: | ||
using: "composite" | ||
using: composite | ||
steps: | ||
- name: "Run tests" | ||
run: | | ||
set -ex | ||
- name: Run tests | ||
run: | | ||
set -ex | ||
GAPROOT=${GAPROOT-$HOME/gap} | ||
GAPROOT=${GAPROOT-$HOME/gap} | ||
# set up a custom GAP root containing only this package, so that | ||
# we can force GAP to load the correct version of this package | ||
# (we already did that in build_pkg.sh, but we do it again here, | ||
# to allow the occasional instance where a package wants to also | ||
# run the tests of others packages, by invoking this script multiple | ||
# times in different directories) | ||
mkdir -p /tmp/gaproot/pkg/ | ||
ln -f -s $PWD /tmp/gaproot/pkg/ | ||
# set up a custom GAP root containing only this package, so that | ||
# we can force GAP to load the correct version of this package | ||
# (we already did that in build_pkg.sh, but we do it again here, | ||
# to allow the occasional instance where a package wants to also | ||
# run the tests of others packages, by invoking this script multiple | ||
# times in different directories) | ||
mkdir -p /tmp/gaproot/pkg/ | ||
ln -f -s $PWD /tmp/gaproot/pkg/ | ||
# start GAP with custom GAP root, to ensure correct package version is loaded | ||
GAP="${{ inputs.pre-gap }} $GAPROOT/gap -l /tmp/gaproot; --quitonbreak" | ||
# start GAP with custom GAP root, to ensure correct package version is loaded | ||
GAP="${{ inputs.pre-gap }} $GAPROOT/gap -l /tmp/gaproot; --quitonbreak" | ||
if ${{ inputs.only-needed }} = 'true' ; then | ||
GAP="$GAP -A" | ||
fi | ||
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 | ||
mkdir -p ${COVDIR-coverage} | ||
GAP="$GAP --cover ${COVDIR-coverage}/$(mktemp XXXXXX).coverage" | ||
fi | ||
# Unless explicitly turned off by setting the NO_COVERAGE environment variable, | ||
# we collect coverage data | ||
if [[ -z "${{ inputs.NO_COVERAGE }}" ]]; then | ||
mkdir -p ${COVDIR-coverage} | ||
GAP="$GAP --cover ${COVDIR-coverage}/$(mktemp XXXXXX).coverage" | ||
fi | ||
cat > __TEST_RUNNNER__.g <<EOF | ||
cat > __TEST_RUNNNER__.g <<EOF | ||
GAP_TESTFILE:="${{ inputs.GAP_TESTFILE }}"; | ||
Read("PackageInfo.g"); | ||
info := GAPInfo.PackageInfoCurrent; | ||
if IsEmpty(GAP_TESTFILE) or not IsExistingFile(GAP_TESTFILE) then | ||
GAP_TESTFILE := info.TestFile; | ||
fi; | ||
# Load the package with debug info | ||
SetInfoLevel(InfoPackageLoading, PACKAGE_DEBUG); | ||
SetPackagePath(info.PackageName, "/tmp/gaproot/pkg/$(basename $PWD)"); | ||
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 | ||
QUIT_GAP(Test(GAP_TESTFILE, rec(compareFunction := "uptowhitespace"))); | ||
else | ||
Read(GAP_TESTFILE); | ||
Error("Package TestFile did not exit gap"); | ||
fi; | ||
EOF | ||
GAP_TESTFILE:="${{ inputs.GAP_TESTFILE }}"; | ||
Read("PackageInfo.g"); | ||
info := GAPInfo.PackageInfoCurrent; | ||
if IsEmpty(GAP_TESTFILE) or not IsExistingFile(GAP_TESTFILE) then | ||
GAP_TESTFILE := info.TestFile; | ||
fi; | ||
# Load the package with debug info | ||
SetInfoLevel(InfoPackageLoading, PACKAGE_DEBUG); | ||
SetPackagePath(info.PackageName, "/tmp/gaproot/pkg/$(basename $PWD)"); | ||
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 | ||
QUIT_GAP(Test(GAP_TESTFILE, rec(compareFunction := "uptowhitespace"))); | ||
else | ||
Read(GAP_TESTFILE); | ||
Error("Package TestFile did not exit gap"); | ||
fi; | ||
EOF | ||
$GAP __TEST_RUNNNER__.g | ||
$GAP __TEST_RUNNNER__.g | ||
shell: bash | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.