Merge pull request #807 from fxcoudert/ventura #895
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: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
os: | |
- macOS-latest | |
- ubuntu-latest | |
- windows-latest | |
include: | |
- os: macOS-latest | |
shell: bash | |
- os: ubuntu-latest | |
shell: bash | |
- os: windows-latest | |
shell: "wsl-bash {0}" | |
runs-on: ${{matrix.os}} | |
defaults: | |
run: | |
shell: ${{ matrix.shell }} | |
steps: | |
- name: Set up WSL | |
if: runner.os == 'windows' | |
shell: powershell | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Set up Git repository | |
uses: actions/checkout@main | |
- name: Cleanup macOS | |
if: runner.os == 'macOS' | |
run: | | |
sudo rm -rf /Applications/Xcode.app \ | |
/Library/Developer/CommandLineTools | |
sudo xcode-select --reset | |
- name: Install WSL | |
if: runner.os == 'windows' | |
uses: Vampire/setup-wsl@188b420ddc69713cdd990715aba161526aed7f6d | |
with: | |
distribution: Ubuntu-22.04 | |
wsl-shell-user: runner | |
additional-packages: build-essential | |
- 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 | |
if: runner.os != 'windows' | |
run: | | |
if [[ "${{ runner.os }}" = "macOS" ]] | |
then | |
echo "/usr/local/bin:/usr/bin:/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 | |
- name: Set up WSL environment | |
if: runner.os == 'windows' | |
shell: "wsl-bash -u root {0}" | |
run: | | |
echo "runner ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/runner | |
chmod 644 /etc/sudoers.d/runner | |
echo -e "#!/bin/bash\nexec /home/linuxbrew/.linuxbrew/bin/brew \"\$@\"" | tee /usr/local/bin/brew | |
chmod 755 /usr/local/bin/brew | |
- 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 | |
if: runner.os != 'windows' | |
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 |