Skip to content

Rewrite from /bin/bash to pure /bin/sh #1101

Rewrite from /bin/bash to pure /bin/sh

Rewrite from /bin/bash to pure /bin/sh #1101

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
tests:
strategy:
matrix:
os:
- macOS-latest
- ubuntu-latest
- windows-2025
include:
- os: macOS-latest
shell: bash
- os: ubuntu-latest
shell: bash
- os: windows-2025
shell: wsl -- dos2unix <"$(wslpath '{0}')" | bash --noprofile --norc -euo pipefail
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Set up Git repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Cleanup macOS
if: runner.os == 'macOS'
run: |
sudo rm -rf /Applications/Xcode.app \
/Library/Developer/CommandLineTools
sudo xcode-select --reset
- name: Set up WSL
if: runner.os == 'Windows'
shell: powershell
run: |
mkdir "$env:USERPROFILE\.cloud-init"
cp "$env:GITHUB_WORKSPACE\.github\wsl-init.yml" "$env:USERPROFILE\.cloud-init\Ubuntu-22.04.user-data"
winget install --id 9PN20MSR04DW --exact --source msstore --accept-source-agreements --accept-package-agreements
ubuntu2204 install
ubuntu2204 config --default-user runner
echo "WSLENV=CI:GITHUB_ACTIONS:RUNNER_OS:GITHUB_PATH/p" >> $env:GITHUB_ENV # allow some basic envs to be passed in
- name: Check Bash 3.x syntax
if: runner.os == 'macOS'
run: |
/bin/bash -u -n install.sh
/bin/bash -u -O extglob -n uninstall.sh
- name: Set up Homebrew PATH
run: |
if [[ "${RUNNER_OS}" = "macOS" ]]
then
echo "/usr/local/bin:/usr/bin:/bin" >> "${GITHUB_PATH}"
elif [[ "${RUNNER_OS}" = "Windows" ]]
then
echo "$(wslpath -w /home/linuxbrew/.linuxbrew/bin)" >> "${GITHUB_PATH}"
else
echo "/home/linuxbrew/.linuxbrew/bin:/usr/bin:/bin" >> "${GITHUB_PATH}"
fi
- name: Uninstall GitHub Actions Homebrew
run: |
if which brew &>/dev/null
then
/bin/bash uninstall.sh -n >/dev/null
/bin/bash uninstall.sh -f >/dev/null
fi
- run: /bin/bash -c "$(cat install.sh)"
- run: brew config
- run: brew install ack
- run: /bin/bash uninstall.sh -f >/dev/null
- run: /bin/bash -c "$(cat install.sh)"
- name: Uninstall and reinstall with sudo NOPASSWD
if: runner.os == 'Linux'
run: |
echo "${USER} ALL=(ALL) NOPASSWD:ALL" | sudo tee "/etc/sudoers.d/${USER}"
/bin/bash uninstall.sh -f >/dev/null
/bin/bash -c "$(cat install.sh)"
- name: Check code styles
run: |
brew install shellcheck shfmt diffutils
brew style *.sh
- run: /bin/bash uninstall.sh -n >/dev/null
- run: /bin/bash uninstall.sh -f >/dev/null