Switch to tamasfe.even-better-toml
#246
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: | |
pull_request: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
lint: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
steps: | |
- name: Add Homebrew to $PATH | |
if: runner.os == 'Linux' | |
run: | | |
# mitigate https://github.com/actions/runner-images/issues/6283 | |
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >>"$GITHUB_PATH" | |
- uses: actions/checkout@v3 | |
- name: Install Prettier | |
run: npm i -g prettier@'^2' | |
- name: Check web code formatting with Prettier | |
run: prettier --check . | |
- name: Install shfmt (https://github.com/mvdan/sh) | |
run: brew install shfmt | |
- name: Check shell script formatting with shfmt | |
run: shfmt -d -i 2 . | |
- name: Install ShellCheck (https://github.com/koalaman/shellcheck) on macOS | |
if: runner.os == 'macOS' | |
run: brew install bash shellcheck | |
- name: Check shell script formatting with ShellCheck | |
run: | | |
shopt -s globstar nullglob | |
set -- **/*.{sh,bash} | |
if [ -n "$1" ]; then | |
echo "Checking $@" | |
shellcheck "$@" | |
else | |
echo "No shell scripts for ShellCheck to check." | |
fi | |
shell: bash | |
env: | |
SHELLCHECK_OPTS: -e SC1071 -e SC1090 -e SC1091 | |
test: | |
if: github.event_name != 'push' | |
needs: [lint] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
timeout-minutes: 100 | |
env: | |
STRAP_CI: 1 | |
STRAP_DEBUG: 1 | |
STRAP_DOTFILES_BRANCH: ${{ github.ref }} | |
STRAP_GIT_EMAIL: 26674818+br3ndonland@users.noreply.github.com | |
STRAP_GIT_NAME: GitHub Actions | |
STRAP_GITHUB_USER: br3ndonland | |
steps: | |
- name: Add Homebrew to $PATH | |
if: runner.os == 'Linux' | |
run: | | |
# mitigate https://github.com/actions/runner-images/issues/6283 | |
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >>"$GITHUB_PATH" | |
- name: Clean up Homebrew | |
run: | | |
command -v brew &>/dev/null && brew test-bot --only-cleanup-before || | |
echo "Homebrew not found." | |
- name: Clean up macOS | |
if: runner.os == 'macOS' | |
run: | | |
sudo rm -rf /usr/local/Caskroom /usr/local/Homebrew /usr/local/bin/brew \ | |
/usr/local/.??* /Applications/Xcode.app /Library/Developer/CommandLineTools | |
- name: Run bootstrap.sh | |
run: | | |
bootstrap_script_url="https://raw.githubusercontent.com/$STRAP_GITHUB_USER/dotfiles/$STRAP_DOTFILES_BRANCH/bootstrap.sh" | |
/usr/bin/env bash -c "$(curl -fsSL $bootstrap_script_url)" | |
- name: Rerun bootstrap.sh to test idempotence | |
run: bash "$HOME/.dotfiles/bootstrap.sh" | |
- name: Check Homebrew configuration | |
run: brew config | |
- name: Check for potential problems with brew doctor | |
run: brew doctor || echo "Potential problems detected. See output for details." |