Merge pull request #36 from LyraPhase/bump-pre-commit-shellcheck #49
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: | |
branches: | |
- master | |
- main | |
- develop | |
push: | |
branches: | |
- master | |
- main | |
- develop | |
env: | |
debug_ci: false | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-13, macos-14, macos-15] | |
steps: | |
# Now handled by Homebrew/actions/setup-homebrew | |
# See: https://github.com/Homebrew/actions/blob/master/setup-homebrew/main.sh#L207-L242 | |
# Note: brew update-reset resets to master branch, so we must checkout PR merge | |
# ref again later to test against latest changes. | |
# We also use pull_request rather than pull_request_target to avoid | |
# exposing secrets other than the ReadOnly GITHUB_TOKEN | |
# - name: Check out code | |
# uses: actions/checkout@v4 | |
- name: Set BREWFILE_PATH env var | |
run: | | |
echo "BREWFILE_PATH=${GITHUB_WORKSPACE}/Brewfile.ci" >> $GITHUB_ENV | |
- name: Set up Homebrew | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: DEBUG Tap Repo | |
run: | | |
echo HOMEBREW_TAP_REPOSITORY=${{ steps.set-up-homebrew.outputs.repository-path }} | |
ls -l ${{ steps.set-up-homebrew.outputs.repository-path }} | |
cd ${{ steps.set-up-homebrew.outputs.repository-path }} && git status && git log --graph --decorate --oneline --all --abbrev-commit | |
if: ${{ env.debug_ci == 'true' || runner.debug == '1' }} | |
- name: Cache Homebrew Bundler RubyGems | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.set-up-homebrew.outputs.gems-path }} | |
key: ${{ runner.os }}-${{ runner.arch }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} | |
restore-keys: ${{ runner.os }}-${{ runner.arch }}-rubygems- | |
- name: Cache style cache | |
if: runner.os == 'macOS' | |
uses: actions/cache@v4 | |
with: | |
path: ~/Library/Caches/Homebrew/style | |
key: macos-style-cache-${{ github.sha }} | |
restore-keys: macos-style-cache- | |
- name: Cache local Tap Casks | |
if: runner.os == 'macOS' | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/Library/Caches/Homebrew/pcloud-drive--* | |
~/Library/Caches/Homebrew/downloads/pcloud-drive--* | |
~/Library/Caches/Homebrew/Cask/*--pCloud*.pkg* | |
key: brew-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }}-${{ hashFiles( env.BREWFILE_PATH, '**/Brewfile.lock.json') }}-${{ hashFiles('Casks/**.rb') }} | |
restore-keys: | | |
brew-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }}-${{ hashFiles( env.BREWFILE_PATH, '**/Brewfile.lock.json') }}-${{ hashFiles('Casks/**.rb') }} | |
brew-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }}-${{ hashFiles( env.BREWFILE_PATH, '**/Brewfile.lock.json') }} | |
brew-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }} | |
# Note: Disabling this b/c size is over 3 GiB now! | |
# So, cache was actually slowing down the CI run | |
# - name: Configure Homebrew cache | |
# uses: actions/cache@v4 | |
# with: | |
# path: | | |
# ~/Library/Caches/Homebrew/*--* | |
# ~/Library/Caches/Homebrew/downloads/*--* | |
# ~/Library/Caches/Homebrew/Cask/*--* | |
# key: brew-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }}-${{ hashFiles( env.BREWFILE_PATH, '**/Brewfile.lock.json') }} | |
# restore-keys: | | |
# brew-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }}-${{ hashFiles( env.BREWFILE_PATH, '**/Brewfile.lock.json') }} | |
# brew-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }} | |
- name: Run brew update-reset | |
env: | |
HOMEBREW_COLOR: 1 | |
HOMEBREW_DEVELOPER: 1 | |
run: | | |
brew update-reset | |
- name: Clean homebrew cache | |
env: | |
HOMEBREW_COLOR: 1 | |
HOMEBREW_DEVELOPER: 1 | |
run: | | |
brew cleanup | |
- name: Run brew bundle install (CI dependencies) | |
env: | |
HOMEBREW_COLOR: 1 | |
HOMEBREW_DEVELOPER: 1 | |
run: | | |
brew bundle install --file=${BREWFILE_PATH} | |
- name: DEBUG - GitHub Workspace | |
run: | | |
echo GITHUB_WORKSPACE="$GITHUB_WORKSPACE" | |
if: ${{ env.debug_ci == 'true' || runner.debug == '1' }} | |
- name: DEBUG - Print all shell env exports | |
run: export -p | |
if: ${{ env.debug_ci == 'true' || runner.debug == '1' }} | |
- name: Git checkout GHA event ref (PR merge commit) | |
run: | | |
echo "github.ref = ${{ github.ref }}" | |
git fetch origin ${{ github.ref }} | |
git checkout -qf FETCH_HEAD | |
git show | |
git status && git log --graph --decorate --oneline --all --abbrev-commit -n 25 | |
- name: DEBUG - List workspace and Homebrew contents | |
run: | | |
ls -lR "${GITHUB_WORKSPACE}" | |
cat "${GITHUB_WORKSPACE}/Casks/pcloud-drive.rb" | |
ls -lR "$(brew --repo)" | |
if: ${{ env.debug_ci == 'true' || runner.debug == '1' }} | |
- name: Run tap install | |
env: | |
HOMEBREW_COLOR: 1 | |
HOMEBREW_DEVELOPER: 1 | |
HOMEBREW_NO_SORBET_RUNTIME: 1 | |
run: make install | |
- name: Run test & install | |
env: | |
HOMEBREW_COLOR: 1 | |
HOMEBREW_DEVELOPER: 1 | |
run: | | |
make test | |
- name: Upload install.log on failure | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Build failure logs | |
path: /var/log/install.log | |
overwrite: true |