-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathaction.yml
More file actions
235 lines (214 loc) · 8.93 KB
/
action.yml
File metadata and controls
235 lines (214 loc) · 8.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: 'Setup GAP for package testing'
description: 'Download and compile GAP and its packages'
inputs:
gap-version:
description: 'The GAP version or branch to build'
required: false
default: 'latest'
repository:
description: 'The GitHub repository from which to clone GAP'
required: false
default: 'gap-system/gap'
configflags:
description: 'Arguments to pass to the GAP configure script (e.g. --enable-debug)'
required: false
default: ''
GAP_PKGS_TO_CLONE:
description: 'the GAP packages to clone'
required: false
default: 'REMOVED'
GAP_PKGS_TO_BUILD:
description: 'the GAP packages to build'
required: false
default: 'REMOVED'
GAPBRANCH:
description: 'the gap branch to clone'
required: false
default: 'REMOVED'
HPCGAP:
description: 'build HPC-GAP if set to yes'
required: false
default: 'REMOVED'
ABI:
description: 'set to 32 to use 32bit build flags for the package'
required: false
default: 'REMOVED'
GAP_BOOTSTRAP:
description: 'make bootstrap-pkg-? (i.e. full/minimal)'
required: false
default: 'REMOVED'
runs:
using: "composite"
steps:
- name: "Error on obsolete dependencies"
shell: bash
run: |
error_found=false
if [[ "${{ inputs.GAP_PKGS_TO_CLONE }}" != "REMOVED" ]] ; then
error_found=true
echo "::error::Input 'GAP_PKGS_TO_CLONE' is obsolete. The cloning of packages must be done in a separate step in your workflow."
fi
if [[ "${{ inputs.GAP_PKGS_TO_BUILD }}" != "REMOVED" ]] ; then
error_found=true
echo "::error::Input 'GAP_PKGS_TO_BUILD' is obsolete. The building of packages must be done in a separate step in your workflow."
fi
if [[ "${{ inputs.GAPBRANCH }}" != "REMOVED" ]] ; then
error_found=true
echo "::error::Input 'GAPBRANCH' is obsolete, and needs to be converted to 'gap-version'."
fi
if [[ "${{ inputs.HPCGAP }}" != "REMOVED" ]] ; then
error_found=true
echo "::error::Input 'HPCGAP' is obsolete. Building HPC-GAP is no longer supported."
fi
if [[ "${{ inputs.ABI }}" != "REMOVED" ]] ; then
error_found=true
echo "::error::Input 'ABI' is obsolete. Building 32bit-versions of GAP is no longer supported."
fi
if [[ "${{ inputs.GAP_BOOTSTRAP }}" != "REMOVED" ]] ; then
error_found=true
echo "::error::Input 'GAP_BOOTSTRAP' is obsolete. Building GAP with minimal packages is no longer supported."
fi
if ${error_found}; then
echo "::error::Please see 'https://github.com/gap-actions/setup-gap/blob/main/README.md' for further information."
exit 1
fi
- name: "Install dependencies"
shell: bash
if: ${{ runner.os != 'Windows' }}
run: |
if [[ "${{ runner.os }}" == "Linux" ]] ; then
sudo apt-get install libgmp-dev libreadline-dev zlib1g-dev
elif [[ "${{ runner.os }}" = "macOS" ]] ; then
# Note: readline is installed by default, adding it here causes warnings in GitHub runners
brew install zlib autoconf && brew link zlib --force
fi
- name: "Determine GAP version"
id: version
shell: bash
run: |
VERSION=""
IS_RELEASE=true
# We only check for releases in the official repository
if [[ "${{ inputs.repository }}" == "gap-system/gap" ]] ; then
wget -q -O $RUNNER_TEMP/gap_releases.json https://raw.githubusercontent.com/gap-system/GapWWW/master/releases.json
if [[ "${{ inputs.gap-version }}" == "latest" ]] ; then
echo "Version: latest release"
VERSION=$(cat $RUNNER_TEMP/gap_releases.json | jq -r '.[] | select(.isLatest == true) | .tagName ')
else
echo "Checking releases"
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 }}
REL=v${REL#v}
if echo "$GIT_RELS" | grep -qx "$REL" ; then
echo "Version: exact release match"
VERSION=$REL
elif echo "$GIT_NPRS" | grep -q "^$REL\." ; then
echo "Version: expanded to release"
VERSION=$(echo "$GIT_NPRS" | grep "^$REL\." | tail -n 1)
fi
fi
fi
# If we use a different repo or didn't match a release, we try branches and tags instead
if [[ -z "$VERSION" ]] ; then
IS_RELEASE=false
# Use the repository's default branch. We autocorrect to the default one if "master" or "main" was given
if [[ "${{ inputs.gap-version }}" =~ ^(master|main|devel)$ ]] ; then
echo "Version: default branch"
VERSION=$(git ls-remote --symref https://github.com/${{ inputs.repository }}.git HEAD | head -n 1 | sed 's|ref: refs/heads/||; s|\tHEAD||')
elif git ls-remote --heads https://github.com/${{ inputs.repository }}.git | sed 's|.*refs/heads/||' | grep -qx "${{ inputs.gap-version }}" ; then
echo "Version: exact branch match"
VERSION=${{ inputs.gap-version }}
elif git ls-remote --tags --refs https://github.com/${{ inputs.repository }}.git | sed 's|.*refs/tags/||' | grep -qx "${{ inputs.gap-version }}" ; then
echo "Version: exact tag match"
VERSION=${{ inputs.gap-version }}
else
echo "::error::No release, branch or tag with name ${{ inputs.gap-version }} found"
exit 1
fi
fi
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
echo "IS_RELEASE=$IS_RELEASE" >> "$GITHUB_OUTPUT"
- name: "Set GAPROOT"
shell: bash
run: |
GAPROOT="$HOME/gap"
mkdir -p $GAPROOT
echo "GAPROOT=$GAPROOT" >> "$GITHUB_ENV"
- name: "Download or clone GAP"
shell: bash
env:
VERSION: ${{ steps.version.outputs.VERSION }}
IS_RELEASE: ${{ steps.version.outputs.IS_RELEASE }}
run: |
if [[ "$IS_RELEASE" == "true" ]] ; then
WGET="wget -q -N --no-check-certificate --tries=5 --waitretry=5 --retry-connrefused -O gap-archive"
URL=$(cat $RUNNER_TEMP/gap_releases.json | jq -r --arg VERSION "$VERSION" '.[] | select(.tagName == $VERSION) | .url ')
SHA=$(cat $RUNNER_TEMP/gap_releases.json | jq -r --arg VERSION "$VERSION" '.[] | select(.tagName == $VERSION) | .sha256 ')
# Download archive
$WGET $URL
# Recalculate checksum
CHK=$(shasum -a 256 gap-archive | awk '{print $1}')
# Remove leading backslash if present, this can happen on Cygwin
CHK=${CHK#\\}
# Compare checksums
if [[ "$SHA" != "$CHK" ]] ; then
echo "::error::Checksum is wrong!"
exit 1
fi
# Extract archive
tar xf gap-archive -C $GAPROOT --strip-components=1
rm gap-archive
else
git clone --branch $VERSION --depth=1 --single-branch https://github.com/${{ inputs.repository }}.git $GAPROOT
fi
- name: "Build GAP"
shell: bash
run: |
cd $GAPROOT
CONFIGFLAGS="${{ inputs.configflags }}"
if [ ! -x "configure" ] ; then
echo "::group:: Running autogen"
./autogen.sh
fi
if [[ "${{ runner.os }}" = "macOS" ]] ; then
BP=$(brew --prefix)
CONFIGFLAGS="--with-gmp=$BP --with-readline=$BP/opt/readline $CONFIGFLAGS"
NPROC=$(sysctl -n hw.ncpu)
else
NPROC=$(nproc)
fi
echo "::group:: Running configure with flags $CONFIGFLAGS"
./configure $CONFIGFLAGS
echo "::group:: Running make"
make -j$NPROC V=1
- name: "Make GAP executable"
shell: bash
run: |
mkdir -p /tmp/gaproot/pkg/
ln -f -s $PWD /tmp/gaproot/pkg/
if [ -f "$GAPROOT/gap" ] ; then
EXEC="$GAPROOT/gap"
else
EXEC="sh $GAPROOT/bin/gap.sh"
fi
echo -e '#!/bin/bash\n'"$EXEC"' -l "/tmp/gaproot;" "$@"\n' > /usr/local/bin/gap
# Make it executable
chmod +x /usr/local/bin/gap
echo "GAP=gap --quitonbreak" >> "$GITHUB_ENV"
- name: "Download GAP packages"
shell: bash
if: ${{ steps.version.outputs.IS_RELEASE == 'false' }}
run: |
cd $GAPROOT
WGET="wget -q -N --no-check-certificate --tries=5 --waitretry=5 --retry-connrefused"
# For GAP >= 4.11 set DOWNLOAD, for older versions set WGET
make bootstrap-pkg-full DOWNLOAD="$WGET" WGET="$WGET"
# FIXME/HACK: for the time being, build the io package, until we have
# dealt with <https://github.com/gap-packages/RepnDecomp/issues/23>
- name: "Build the IO package"
shell: bash
run: |
cd ${GAPROOT}/pkg
../bin/BuildPackages.sh --strict io*