-
Notifications
You must be signed in to change notification settings - Fork 1
First version using only bash #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5981e43
First version using only bash
stertooy cd5be25
`version` in get_archive_url shouldn't be local
stertooy 3176e8f
Extract with strip-components=1
stertooy 3364d3d
Update CI suite to check if packages were installed
stertooy 0b1339f
Updates, fixes, readme
stertooy 896ad4e
Use gap-actions/setup-cygwin again
stertooy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,48 +1,87 @@ | ||
| name: 'Install packages' | ||
| description: 'Install additional GAP packages' | ||
|
|
||
| inputs: | ||
| packages: | ||
| description: 'Space-separated list of packages to install' | ||
| description: 'Space-separated or newline-separated list of packages to install' | ||
| required: true | ||
| default: '' | ||
| ignore-errors: | ||
| description: 'Ignore errors when installing' | ||
| required: false | ||
| default: 'false' | ||
| use-latex: | ||
| description: "Install and use latex (only works on Linux)" | ||
| required: false | ||
| default: "false" | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: "Install TeX Live" | ||
| if: ${{ inputs.use-latex == 'true' }} | ||
|
|
||
| - name: Install bsdtar | ||
| if: ${{ runner.os == 'Linux' }} | ||
| shell: bash | ||
| run: | | ||
| sudo apt-get install --no-install-recommends texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended | ||
| - name: "Run tests" | ||
| run: sudo apt install -y libarchive-tools # bsdtar | ||
|
|
||
| - name: Install GAP packages | ||
| shell: bash | ||
| run: | | ||
| # Convert newlines to spaces | ||
| PKGS=$(echo "${{ inputs.packages }}" | tr '\n' ' ') | ||
|
|
||
| error_found=false | ||
| # Use `gap` instead of `$GAP` to avoid quitonbreak | ||
| for pkg in $PKGS; do | ||
| if ! gap -A <<GAPInput | ||
| LoadPackage("PackageManager"); | ||
| QUIT_GAP(InstallPackage("${pkg}")); | ||
| GAPInput | ||
| then | ||
| error_found=true | ||
| echo "::error::Installation of ${pkg} may have failed" | ||
| fi | ||
| done | ||
|
|
||
| # Exit unless ignore-errors is set to true | ||
| if [[ "${{ inputs.ignore-errors }}" != "true" && "$error_found" = "true" ]]; then | ||
| exit 1 | ||
| PACKAGES=$(echo "${{ inputs.packages }}" | tr '\n' ' ') | ||
|
|
||
| if [[ "${RUNNER_OS}" = "Windows" ]]; then | ||
| TMPDIR=$(cygpath -u "${RUNNER_TEMP}/install-pkg") | ||
| else | ||
| TMPDIR="${RUNNER_TEMP}/install-pkg" | ||
| fi | ||
|
|
||
| mkdir -p "${TMPDIR}" | ||
| DEST="${GAPROOT}/pkg" | ||
| PKG_DISTRO="${TMPDIR}/package-infos.json" | ||
|
|
||
| # Needed to get reasonable API limits | ||
| WGET_HEADER="Authorization: token ${{ github.token }}" | ||
|
|
||
| # Load helper functions | ||
| source "${GITHUB_ACTION_PATH}/install-pkg-functions.sh" | ||
|
|
||
| for pkg in ${PACKAGES}; do | ||
| echo "::group::Installing ${pkg}" | ||
|
|
||
| version="latest" | ||
|
|
||
| # Split off version, if present | ||
| if [[ "${pkg}" == *@* ]]; then | ||
| version="${pkg##*@}" | ||
| pkg="${pkg%@*}" | ||
| fi | ||
|
|
||
| # Set the $name variable | ||
| get_pkg_name "${pkg}" | ||
| pkgdir="${DEST}/${name}" | ||
|
|
||
| if [[ "${pkg}" =~ ^https?://.*\.(tar\.gz|tar\.bz2|zip)$ ]]; then | ||
| echo "Input is an archive" | ||
|
|
||
| download_and_extract "${pkg}" "${pkgdir}" | ||
| else | ||
| # Set the $repo variable | ||
| if [[ "${pkg}" =~ .*/.* ]]; then | ||
| echo "Input is a package repository" | ||
| repo="${pkg}" | ||
| else | ||
| echo "Input is a package name" | ||
| get_repo_from_name "${name}" | ||
| fi | ||
|
|
||
| if [[ "${version}" = "devel" ]]; then | ||
| echo "Cloning development branch of ${repo} to ${pkgdir}" | ||
| clear_dest "${pkgdir}" | ||
| git clone -q --depth=1 --single-branch "https://github.com/${repo}.git" "${pkgdir}" | ||
| else | ||
| # Set the $archive_url variable and update the $version variable | ||
| get_archive_url "${repo}" "${version}" | ||
|
|
||
| # Check if package version is already available | ||
| if check_pkg_availability "${name}" "${version}"; then | ||
| echo "Package ${name} ${version} is already available, skipping." | ||
| continue | ||
| fi | ||
|
|
||
| download_and_extract "${archive_url}" "${pkgdir}" | ||
| fi | ||
| fi | ||
| done | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why exactly do we need bsdtar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good that you asked... made me realise I forgot the
--strip-componentsoption when extracting.bsdtarisn't absolutely necessary, but it makes things a lot easier. If usingGNU tarwe can't use that to extract.ziparchives, so we'd have to useunzip. But that doesn't support--strip-components, so we have to manually move files up one level. And on Windows/Cygwin we have to ensure we're working with Cygwin versions oftarandunzipinstead of Windows ones. It's a mess, really.