From 183b0201e9e645b155d98b8ddba74133f825916e Mon Sep 17 00:00:00 2001 From: stertooy <5571903+stertooy@users.noreply.github.com> Date: Tue, 30 Jun 2026 18:57:33 +0200 Subject: [PATCH 1/4] Add `minimal` as a possible input for `gap-version` --- .github/workflows/CI.yml | 13 ++++++++++++- README.md | 5 ++++- action.yml | 26 +++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 89e6d3a..899da2e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -32,6 +32,9 @@ jobs: - os: macos-latest configflags: '--with-gmp=builtin' include: + - os: ubuntu-latest + gap-version: minimal + configflags: '' - os: ubuntu-latest gap-version: latest configflags: '' @@ -49,15 +52,23 @@ jobs: configflags: '' steps: + - name: "Clone the Example package" + uses: actions/checkout@v7 + if: ${{ matrix.gap-version == 'minimal' }} + with: + repository: gap-packages/example + - name: "Checkout" uses: actions/checkout@v7 + with: + path: this-action/ - name: "Setup Cygwin" if: ${{ matrix.os == 'windows-latest' }} uses: gap-actions/setup-cygwin@v2 - name: "Setup GAP" - uses: ./ + uses: ./this-action/ with: gap-version: ${{ matrix.gap-version }} configflags: ${{ matrix.configflags }} diff --git a/README.md b/README.md index 04e0219..b0c7283 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,8 @@ Its behaviour can be customized via the inputs below. All of the following inputs are optional. - `gap-version`: - - The gap version or branch to build. You may specify "latest" for the latest release, or "devel" for the development version. + - The gap version or branch to build. You may specify "latest" for the latest release, "devel" for the development version, + or "minimal" for the minimal version supported by the GAP package in the current directory. See "Changes to inputs" under "What's new in v3" for more details. - default: `latest` - `repository` @@ -40,6 +41,8 @@ you will have to change the inputs accordingly. We also recommend replacing bran - The `GAPBRANCH` input has been replaced by `gap-version`, which accepts the following input types: - `latest`: this will use the latest release of GAP. This will **not** point to the latest pre-release if it is more recent than the latest release. + - `minimal`: this will use oldest version of GAP that is supported by both the GAP package in the current directory, and this + action. - version numbers: e.g. `v4.14.0`, `v4.15.0-beta1`, etc. The leading `v` is optional, the oldest available release is `v4.10.0`. - incomplete version numbers: e.g. `v4`, `v4.10`, etc. These will be expanded to the most recent release starting with the incomplete version number, e.g. `v4.10` is equivalent to `v4.10.2`. This will **not** expand to pre-releases, and again the leading `v` is diff --git a/action.yml b/action.yml index 9c0c022..18d8034 100644 --- a/action.yml +++ b/action.yml @@ -89,6 +89,8 @@ runs: - name: "Determine GAP version" id: version shell: bash + env: + OLDEST_VER: "4.9" run: | VERSION="" IS_RELEASE=true @@ -104,8 +106,30 @@ runs: GIT_RELS=$(cat $RUNNER_TEMP/gap_releases.json | jq -r '.[].tagName' | sort -V) GIT_NPRS=$(cat $RUNNER_TEMP/gap_releases.json | jq -r '.[] | select(.isPrerelease == false) | .tagName' | sort -V) - # Add "v" in front if missing REL=${{ inputs.gap-version }} + if [[ "$REL" == "minimal" ]]; then + # Get from PackageInfo.g + REGEX="GAP[[:space:]]*:=[[:space:]]*\"([^\"]*)\"" + + if [[ $(cat PackageInfo.g) =~ ${REGEX} ]]; then + # Get from capture group in regex + PKG_VER="${BASH_REMATCH[1]}" + echo "Version: PackageInfo.g contains \"${PKG_VER}\"" + + # Remove leading stuff is present + PKG_VER=${PKG_VER##*[>= ]} + + # Replace by oldest supported version if necessary + REL=$(printf '%s\n' "${PKG_VER}" "${OLDEST_VER}" | sort -V | tail -n1) + echo "Version: turned \"${PKG_VER}\" into \"${REL}\"" + else + # Hard-coded minimal version supported by this action + REL="${OLDEST_VER}" + echo "Version: could not find in PackageInfo.g, defaulting to \"${REL}\"" + fi + fi + + # Ensure a "v" is in front REL=v${REL#v} if echo "$GIT_RELS" | grep -qx "$REL" ; then From 3ad0ca179707c5725d287a5a7629603180606b28 Mon Sep 17 00:00:00 2001 From: stertooy <5571903+stertooy@users.noreply.github.com> Date: Tue, 30 Jun 2026 20:44:53 +0200 Subject: [PATCH 2/4] Fix typo in action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 18d8034..316f14c 100644 --- a/action.yml +++ b/action.yml @@ -116,7 +116,7 @@ runs: PKG_VER="${BASH_REMATCH[1]}" echo "Version: PackageInfo.g contains \"${PKG_VER}\"" - # Remove leading stuff is present + # Remove leading stuff if present PKG_VER=${PKG_VER##*[>= ]} # Replace by oldest supported version if necessary From 47a420b871ce3dc2fbe9c8b709e61339c726b7be Mon Sep 17 00:00:00 2001 From: stertooy <5571903+stertooy@users.noreply.github.com> Date: Wed, 1 Jul 2026 11:07:58 +0200 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Max Horn --- README.md | 2 +- action.yml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b0c7283..734feb0 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ you will have to change the inputs accordingly. We also recommend replacing bran - `latest`: this will use the latest release of GAP. This will **not** point to the latest pre-release if it is more recent than the latest release. - `minimal`: this will use oldest version of GAP that is supported by both the GAP package in the current directory, and this - action. + action (which currently means GAP 4.9). - version numbers: e.g. `v4.14.0`, `v4.15.0-beta1`, etc. The leading `v` is optional, the oldest available release is `v4.10.0`. - incomplete version numbers: e.g. `v4`, `v4.10`, etc. These will be expanded to the most recent release starting with the incomplete version number, e.g. `v4.10` is equivalent to `v4.10.2`. This will **not** expand to pre-releases, and again the leading `v` is diff --git a/action.yml b/action.yml index 316f14c..9e4dd00 100644 --- a/action.yml +++ b/action.yml @@ -108,7 +108,9 @@ runs: REL=${{ inputs.gap-version }} if [[ "$REL" == "minimal" ]]; then - # Get from PackageInfo.g + # Attempt to extract the minimal support GAP version from + # PackageInfo.g via a regex (while in theory this can not always + # work, in practice it does work quite well) REGEX="GAP[[:space:]]*:=[[:space:]]*\"([^\"]*)\"" if [[ $(cat PackageInfo.g) =~ ${REGEX} ]]; then @@ -119,7 +121,7 @@ runs: # Remove leading stuff if present PKG_VER=${PKG_VER##*[>= ]} - # Replace by oldest supported version if necessary + # Ensure the extracted version is not below the oldest GAP version supported by this GAP acttion REL=$(printf '%s\n' "${PKG_VER}" "${OLDEST_VER}" | sort -V | tail -n1) echo "Version: turned \"${PKG_VER}\" into \"${REL}\"" else From 2ff724306a82f26738e97515eccb01f2b46c2848 Mon Sep 17 00:00:00 2001 From: stertooy <5571903+stertooy@users.noreply.github.com> Date: Wed, 1 Jul 2026 11:12:44 +0200 Subject: [PATCH 4/4] Throw error if version could not be extracted from `PackageInfo.g` --- action.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 9e4dd00..eb06021 100644 --- a/action.yml +++ b/action.yml @@ -113,7 +113,10 @@ runs: # work, in practice it does work quite well) REGEX="GAP[[:space:]]*:=[[:space:]]*\"([^\"]*)\"" - if [[ $(cat PackageInfo.g) =~ ${REGEX} ]]; then + if [[ ! -f "PackageInfo.g" ]]; then + echo "::error::Could not find PackageInfo.g." + exit 1 + elif [[ $(cat PackageInfo.g) =~ ${REGEX} ]]; then # Get from capture group in regex PKG_VER="${BASH_REMATCH[1]}" echo "Version: PackageInfo.g contains \"${PKG_VER}\"" @@ -125,9 +128,8 @@ runs: REL=$(printf '%s\n' "${PKG_VER}" "${OLDEST_VER}" | sort -V | tail -n1) echo "Version: turned \"${PKG_VER}\" into \"${REL}\"" else - # Hard-coded minimal version supported by this action - REL="${OLDEST_VER}" - echo "Version: could not find in PackageInfo.g, defaulting to \"${REL}\"" + echo "::error::Could not extract minimal supported version from PackageInfo.g." + exit 1 fi fi