[quote/lighttpdquot] New function to quote strings for pasting in a l… #160
This file contains 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
--- | |
name: unit-tests | |
on: [push, pull_request] | |
jobs: | |
unit-tests: | |
env: | |
SHELL: ${{ matrix.sh }} | |
TERM: linux # work around tput tty issue | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-13 | |
- macos-12 | |
- macos-11 | |
- ubuntu-22.04 | |
- ubuntu-20.04 | |
sh: | |
- sh # default shell | |
- bash | |
- bb # BusyBox | |
- dash | |
- gwsh | |
- ksh | |
- mksh | |
- yash | |
- zsh | |
exclude: | |
# BusyBox not easily installable on macOS | |
- { os: macos-13, sh: bb } | |
- { os: macos-12, sh: bb } | |
- { os: macos-11, sh: bb } | |
# HomeBrew's yash does not work with ShellSpec for some reason | |
- { os: macos-13, sh: yash } | |
- { os: macos-12, sh: yash } | |
- { os: macos-11, sh: yash } | |
include: | |
# gwsh: since we're building from source, testing different | |
# OS versions doesn't make sense. | |
- { os: ubuntu-22.04, sh: gwsh } | |
- { os: macos-13, sh: gwsh } | |
# NOTE: mrsh and posh are temporarily disabled because they don't work | |
# with ShellSpec. | |
# | |
# mrsh: since we're building from source, testing different | |
# Ubuntu versions doesn't make sense. | |
# Also, Ubuntu only, because mrsh does not build on macOS. | |
#- { os: ubuntu-22.04, sh: mrsh } # https://mrsh.sh | |
# Policy-compliant Ordinary SHell | |
#- { os: ubuntu-20.04, sh: posh } | |
#- { os: ubuntu-22.04, sh: posh } | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Prepare shell | |
env: | |
MATRIX_OS: ${{ matrix.os }} | |
MATRIX_SH: ${{ matrix.sh }} | |
run: | | |
set -x | |
case ${MATRIX_OS%%-*}-${MATRIX_SH} | |
in | |
(*-gwsh) | |
gwsh_src=${TMPDIR:-/tmp}/gwsh-build | |
git clone 'https://github.com/hvdijk/gwsh.git' "${gwsh_src:?}" | |
( | |
cd "${gwsh_src:?}" || exit 1 | |
./configure --prefix="${HOME:?}/.local" && | |
make install | |
case ${MATRIX_OS%%-*} | |
in | |
(macos) | |
mkdir -p "${HOME:?}/bin" | |
ln -s ../.local/bin/gwsh "${HOME:?}/bin/gwsh" ;; | |
esac | |
) | |
rm -rf "${gwsh_src:?}" ;; | |
(macos-mksh|macos-yash) | |
brew install "${MATRIX_SH}" ;; | |
(*-mrsh) | |
mrsh_src=${TMPDIR:-/tmp}/mrsh-build | |
git clone 'https://git.sr.ht/~emersion/mrsh' "${mrsh_src:?}" | |
( | |
cd "${mrsh_src:?}" || exit 1 | |
./configure --prefix="${HOME:?}/.local" --without-readline && | |
make install | |
) | |
rm -rf "${mrsh_src:?}" ;; | |
(ubuntu-bash|ubuntu-dash|ubuntu-ksh|ubuntu-mksh|ubuntu-posh|ubuntu-yash|ubuntu-zsh) | |
sudo apt-get -y install "${MATRIX_SH}" ;; | |
(ubuntu-bb) | |
sudo apt-get -y install busybox | |
mkdir -p ~/.local/bin | |
printf >~/.local/bin/bb "#!/bin/sh\\nBUSYBOX=%s\\ncase \$* in (--version) \"\${BUSYBOX}\" | sed -n -e '/^\$/q' -e 'p'; exit 0 ;; esac\\nexec \"\${BUSYBOX}\" sh \"\$@\"\\n" "$(command -v busybox)" | |
chmod +x ~/.local/bin/bb | |
;; | |
esac | |
- name: Information | |
env: | |
MATRIX_OS: ${{ matrix.os }} | |
run: | | |
printf 'Kernel:\n' | |
uname -a | |
printf '\nPATH:\n%s\n' "${PATH}" | |
printf '\nShell (%s):\n' "$(command -v "${SHELL}")" | |
case ${SHELL} | |
in | |
(bash|zsh) | |
"${SHELL}" --version ;; | |
(bb) | |
# (by the launcher script installed before) | |
"${SHELL}" --version ;; | |
(sh|dash) | |
case $(uname -s) | |
in | |
(Darwin) | |
what $(command -v "${SHELL}") ;; | |
esac ;; | |
(gwsh) | |
false ;; | |
(ksh|mksh) | |
"${SHELL}" -c 'echo $0: ${KSH_VERSION}' ;; | |
(yash) | |
"${SHELL}" --version ;; | |
(*) | |
case ${MATRIX_OS%%-*} | |
in | |
(ubuntu) | |
dpkg -s "${SHELL}" | sed -n 's/^Version: *//p' | grep ^ ;; | |
(*) | |
false ;; | |
esac ;; | |
esac \ | |
|| printf '%s\n' '?' | |
printf '\nShellSpec:\n' | |
spec/.shellspec/bin/shellspec --version | |
- name: Run unit tests (ShellSpec) | |
if: always() | |
run: | | |
make SPEC_SHELL="${SHELL}" spec |