diff --git a/.github/workflows/workspaces.yml b/.github/workflows/workspaces.yml new file mode 100644 index 000000000..84d586ec4 --- /dev/null +++ b/.github/workflows/workspaces.yml @@ -0,0 +1,24 @@ +# This is temporary until/if: +# https://github.com/gap-actions/run-pkg-tests/pull/24 +# is merged, or something equivalent, then remove the script ci/run-tests.sh, +# and use the save/load.g files as commented out below +name: "Workspaces" +on: + workflow_dispatch: + pull_request: + push: + branches: + - "main" + - "stable-*.*" + schedule: + # Every day at 3:15 AM UTC + - cron: '15 3 * * *' + +jobs: + workspaces: + name: "GAP 4.12.2 / ubuntu / 64" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: "Run Semigroups packages' workspace tests" + run: ci/launch-gap-docker-container.sh diff --git a/ci/launch-gap-docker-container.sh b/ci/launch-gap-docker-container.sh new file mode 100755 index 000000000..7c32e9740 --- /dev/null +++ b/ci/launch-gap-docker-container.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# This file is temporarily copied from libsemigroups/ci/ file of the same name. +set -e + +CONTAINER_NAME="jamesdbmitchell/gap-docker-minimal:version-4.12.2" + +# Pull the docker container +docker pull "$CONTAINER_NAME" + +# Start the docker container detached +ID=$(docker run --rm -i -d "$CONTAINER_NAME") + +# Copy the libsemigroups directory into the container +docker cp . "$ID:/home/gap/semigroups" + +# Run the ci/docker-gap.sh script in the running container +docker exec -i "$ID" semigroups/ci/run-gap-tests-in-docker-container.sh ; exit + +# Attach to the container +docker attach "$ID" diff --git a/ci/run-gap-tests-in-docker-container.sh b/ci/run-gap-tests-in-docker-container.sh new file mode 100755 index 000000000..f16566fac --- /dev/null +++ b/ci/run-gap-tests-in-docker-container.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Next commands executed in the container... +set -e + +sudo apt-get --yes update +sudo apt-get install git --yes +sudo apt-get install pkg-config m4 libtool automake autoconf --yes +sudo apt-get install libtool-bin --yes + +GAP_VERSION=$(ls inst) +GAP_SH="$HOME/inst/$GAP_VERSION/bin/gap.sh" + +sudo chown 1000:1000 -R semigroups/ + +# Remove packaged GAP version of Semigroups package +rm -rf $HOME/inst/$GAP_VERSION/pkg/semigroups-*.*.* +mv semigroups $HOME/inst/$GAP_VERSION/pkg/ +cd $HOME/inst/$GAP_VERSION/pkg/semigroups + +./prerequisites.sh +./autogen.sh +./configure --disable-hpcombi +make -j4 + +cd .. +git clone -b master --depth=1 https://github.com/gap-packages/PackageManager.git + +INSTALL_PKGS="if not InstallPackage(\"digraphs\", false) then QuitGap(1); fi;" +INSTALL_PKGS+="if not InstallPackage(\"io\", false) then QuitGap(1); fi;" +INSTALL_PKGS+="if not (InstallPackage(\"orb\", false) and CompilePackage(\"orb\")) then QuitGap(1); fi;" +INSTALL_PKGS+="if not InstallPackage(\"genss\", false) then QuitGap(1); fi;" +INSTALL_PKGS+="if not InstallPackage(\"images\", false) then QuitGap(1); fi;" +INSTALL_PKGS+="if not InstallPackage(\"autodoc\", false) then QuitGap(1); fi;" + +echo "LoadPackage(\"PackageManager\"); UpdatePackage(\"PackageManager\", false); $INSTALL_PKGS QUIT;" | $GAP_SH -A -T || exit 1 +cd $HOME/inst/$GAP_VERSION/pkg/semigroups + +export ABI="64" +# Run the tests defined in Semigroups +ci/run-tests.sh diff --git a/ci/run-tests.sh b/ci/run-tests.sh index 395f191bd..d5fd03c86 100755 --- a/ci/run-tests.sh +++ b/ci/run-tests.sh @@ -1,16 +1,13 @@ #!/usr/bin/env bash # -# This file is no longer used by the ci of the Semigroups package but it is -# used by the libsemigroups ci, so don't delete it until that it is not the -# case. +# This file is also used by the libsemigroups ci! # If a command fails, exit this script with an error code set -e set -o pipefail if [ -z "$GAP_HOME" ]; then - echo -e "\nError, the environment variable \"GAP_HOME\" must be set" - exit 1 + GAP_HOME=${GAPROOT-$HOME/gap} elif [ "$ABI" != "32" ] && [ "$ABI" != "64" ]; then echo -e "\nError, the environment variable \"ABI\" must be set to \"32\" or \"64\", found \"$ABI\"" exit 1 diff --git a/tst/workspaces/load.g b/tst/workspaces/load.g new file mode 100644 index 000000000..6090f5819 --- /dev/null +++ b/tst/workspaces/load.g @@ -0,0 +1,12 @@ +############################################################################# +## +#W load.g +#Y Copyright (C) 2023 James D Mitchell +## +## Licensing information can be found in the README file of this package. +## +############################################################################# +## + +LoadPackage("semigroups", false);; +QuitGap(Test("load-workspace.tst") and SemigroupsTestInstall()); diff --git a/tst/workspaces/save.g b/tst/workspaces/save.g new file mode 100644 index 000000000..d8e96800e --- /dev/null +++ b/tst/workspaces/save.g @@ -0,0 +1,12 @@ +############################################################################# +## +#W save.g +#Y Copyright (C) 2023 James D Mitchell +## +## Licensing information can be found in the README file of this package. +## +############################################################################# +## + +LoadPackage("semigroups", false);; +QuitGap(SemigroupsTestInstall() and Test("save-workspace.tst"));