diff --git a/.github/.cspell/project-dictionary.txt b/.github/.cspell/project-dictionary.txt index e1aa6e6..1a0cb79 100644 --- a/.github/.cspell/project-dictionary.txt +++ b/.github/.cspell/project-dictionary.txt @@ -1,3 +1,5 @@ +almalinux +archlinux distro doas endgroup diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c40143..60381b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 36b4bb5..379e3fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 445e862..43b975c 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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). diff --git a/main.sh b/main.sh index 01f102e..befaeb5 100755 --- a/main.sh +++ b/main.sh @@ -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 "$@" } @@ -61,6 +64,7 @@ sys_install() { debian) apt_install "$@" ;; fedora) dnf_install "$@" ;; alpine) apk_install "$@" ;; + suse) zypper_install "$@" ;; arch) pacman_install "$@" ;; esac } @@ -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=//') @@ -109,7 +114,7 @@ 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 ;; @@ -117,7 +122,7 @@ if ! type -P git &>/dev/null; then 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" ;;