Skip to content

Commit

Permalink
ci: try to add test for workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Oct 6, 2023
1 parent cd67baa commit 77d4051
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/workspaces.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions ci/launch-gap-docker-container.sh
Original file line number Diff line number Diff line change
@@ -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"
40 changes: 40 additions & 0 deletions ci/run-gap-tests-in-docker-container.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 2 additions & 5 deletions ci/run-tests.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 12 additions & 0 deletions tst/workspaces/load.g
Original file line number Diff line number Diff line change
@@ -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());
12 changes: 12 additions & 0 deletions tst/workspaces/save.g
Original file line number Diff line number Diff line change
@@ -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"));

0 comments on commit 77d4051

Please sign in to comment.