Skip to content

Commit

Permalink
Improve support for SUSE based containers/self-hosted runners
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Apr 19, 2024
1 parent c88f520 commit b32c643
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/.cspell/project-dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
almalinux
archlinux
distro
doas
endgroup
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,35 @@ jobs:
- uses: taiki-e/install-action@shfmt
- run: git ls-files
- run: ./tools/tidy.sh

test-container:
strategy:
fail-fast: false
matrix:
container:
- ubuntu:18.04 # glibc 2.27
- ubuntu:20.04 # glibc 2.31
- ubuntu:22.04 # glibc 2.35
- debian:10-slim # glibc 2.28
- debian:11-slim # glibc 2.31
- debian:12-slim # glibc 2.36
- fedora:latest # glibc 2.38 (as of fedora 39)
- almalinux:8 # glibc 2.28
- almalinux:8-minimal # glibc 2.28
- almalinux:9 # glibc 2.34
- almalinux:9-minimal # glibc 2.34
- centos:7 # glibc 2.17
- opensuse/leap:latest # glibc 2.31 (as of leap 15.5)
- opensuse/tumbleweed:latest # glibc 2.39 (as of 2024-04-18)
- archlinux:latest # glibc 2.38 (as of 2024-04-18)
- alpine:latest # musl 1.2.4 (as of alpine 3.19)
runs-on: ubuntu-latest
timeout-minutes: 60
container: ${{ matrix.container }}
steps:
- name: Install requirements (alpine)
run: apk --no-cache add bash
shell: sh
if: startsWith(matrix.container, 'alpine')
- uses: taiki-e/checkout-action@main
- run: git ls-files
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com

## [Unreleased]

- Improve support for Arch Linux based containers/self-hosted runners.
- Improve support for SUSE/Arch based containers/self-hosted runners.

## [1.0.0] - 2024-03-08

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ GitHub Action for checking out a repository. (Simplified `actions/checkout` alte

- [Usage](#usage)
- [Why not actions/checkout?](#why-not-actionscheckout)
- [Compatibility](#compatibility)
- [Related Projects](#related-projects)
- [License](#license)

Expand Down Expand Up @@ -34,6 +35,13 @@ As of 2024-03-08, the latest version of `actions/checkout` that uses node20 [doe

Also, in `actions/*` actions, each update of the Node.js used increments the major version (it is the correct behavior for compatibility although), so workflows that use it require maintenance on a regular basis. (Unless you have fully automated dependency updates.)

## Compatibility

This action has been tested for GitHub-hosted runners (Ubuntu, macOS, Windows) and containers (Ubuntu, Debian, Alpine, Fedora, CentOS, Alma, openSUSE, Arch).
To use this action in self-hosted runners or in containers, at least the following tools are required:

- bash

## Related Projects

- [install-action]: GitHub Action for installing development tools (mainly from GitHub Releases).
Expand Down
19 changes: 12 additions & 7 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ apk_install() {
apk --no-cache add "$@"
fi
}
zypper_install() {
retry _sudo zypper install -y "$@"
}
pacman_install() {
retry _sudo pacman -Sy --noconfirm "$@"
}
Expand All @@ -61,6 +64,7 @@ sys_install() {
debian) apt_install "$@" ;;
fedora) dnf_install "$@" ;;
alpine) apk_install "$@" ;;
suse) zypper_install "$@" ;;
arch) pacman_install "$@" ;;
esac
}
Expand All @@ -73,11 +77,12 @@ case "$(uname -s)" in
host_os=linux
if grep -q '^ID_LIKE=' /etc/os-release; then
base_distro=$(grep '^ID_LIKE=' /etc/os-release | sed 's/^ID_LIKE=//')
case " ${base_distro} " in
*' debian '*) base_distro=debian ;;
*' fedora '*) base_distro=fedora ;;
*' alpine '*) base_distro=alpine ;;
*' arch '*) base_distro=arch ;;
case "${base_distro}" in
*debian*) base_distro=debian ;;
*fedora*) base_distro=fedora ;;
*alpine*) base_distro=alpine ;;
*suse*) base_distro=suse ;;
*arch*) base_distro=arch ;;
esac
else
base_distro=$(grep '^ID=' /etc/os-release | sed 's/^ID=//')
Expand Down Expand Up @@ -109,15 +114,15 @@ if ! type -P git &>/dev/null; then
case "${host_os}" in
linux*)
case "${base_distro}" in
debian | fedora | alpine | arch)
debian | fedora | alpine | suse | arch)
echo "::group::Install packages required for installation (git)"
case "${base_distro}" in
debian) sys_install ca-certificates git ;;
*) sys_install git ;;
esac
echo "::endgroup::"
;;
*) warn "checkout-action requires git on non-Debian/Fedora/Alpine/Arch-based Linux" ;;
*) warn "checkout-action requires git on non-Debian/Fedora/Alpine/SUSE/Arch-based Linux" ;;
esac
;;
macos) warn "checkout-action requires git on macOS" ;;
Expand Down

0 comments on commit b32c643

Please sign in to comment.