Setup #483
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: Setup | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'script/**' | |
- '*-Brewfile' | |
- '.github/workflows/*.yml' | |
- '*.el' | |
# Run every Saturday at midnight | |
schedule: | |
- cron: '0 0 * * 6' | |
workflow_dispatch: | |
jobs: | |
bootstrap: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- 'macos-14' | |
- 'ubuntu-latest' | |
amend-scratch: | |
- 'amend' | |
- 'scratch' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Validate syntax | |
run: | | |
FAILURE=0 | |
for file in script/*; | |
do | |
head -1 $file | grep -q bash && echo $file && bash -O extglob -n $file | |
# Grep fails out with 1 if it doesn't find the pattern. | |
# Bash fails out with 2 for syntax issues. | |
if [[ $? -gt 1 ]]; then | |
echo "$file failed test" | |
FAILURE=1 | |
fi | |
done | |
exit "$FAILURE" | |
- name: Remove pre-installed tools from GitHub Actions runner | |
run: | | |
script/actions-runner-preclean.sh | |
# Cache Homebrew directories for amend matrix option | |
- uses: actions/cache@v3 | |
if: ${{ matrix.amend-scratch == 'amend' }} | |
with: | |
path: | | |
/opt/homebrew/bin | |
/opt/homebrew/Cellar | |
/usr/local/Cellar | |
/usr/local/bin | |
/usr/local/opt | |
/Applications | |
key: ${{ runner.os }}-${{ hashFiles('Brewfile') }} | |
restore-keys: | | |
${{ runner.os }}- | |
- name: Run setup script | |
run: script/setup "TEST_HOSTNAME" |