.github/workflows/macos.yml #1165
This file contains hidden or 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
on: | |
# MacOS is super slow in GitHub Actions for some reason, so run this every | |
# night instead of every pull request. | |
schedule: | |
- cron: '0 4 * * *' | |
workflow_dispatch: # Can also be triggered manually from github UI | |
pull_request: | |
paths: | |
- .github/workflows/macos.yml # Run whenever this file is modified | |
jobs: | |
# Please keep in sync with valgrind.yml | |
check-if-needed: | |
timeout-minutes: 1 | |
runs-on: ubuntu-latest | |
outputs: | |
needed: ${{ steps.check.outputs.run }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: check | |
run: | | |
if [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then | |
echo "Triggered manually" | |
echo "run=true" >> $GITHUB_OUTPUT | |
elif [ "$GITHUB_REPOSITORY" != "Akuli/jou" ]; then | |
echo "This is a fork of Jou, skipping" | |
echo "run=false" >> $GITHUB_OUTPUT | |
elif git --no-pager log --oneline --since="24 hours ago" --exit-code; then | |
echo "No recent commits, skipping" | |
echo "run=false" >> $GITHUB_OUTPUT | |
else | |
echo "run=true" >> $GITHUB_OUTPUT | |
fi | |
test: | |
needs: [check-if-needed] | |
if: ${{ needs.check-if-needed.outputs.needed == 'true' }} | |
runs-on: macos-latest | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
# Testing all levels because there was a bug that only happened with -O1. (#224) | |
params: | |
- { llvm-version: 15, opt-level: '-O0' } | |
- { llvm-version: 15, opt-level: '-O1' } | |
- { llvm-version: 15, opt-level: '-O2' } | |
- { llvm-version: 15, opt-level: '-O3' } | |
- { llvm-version: 16, opt-level: '-O1' } | |
- { llvm-version: 17, opt-level: '-O1' } | |
- { llvm-version: 18, opt-level: '-O1' } | |
- { llvm-version: 19, opt-level: '-O0' } | |
- { llvm-version: 19, opt-level: '-O1' } | |
- { llvm-version: 19, opt-level: '-O2' } | |
- { llvm-version: 19, opt-level: '-O3' } | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch the whole Git history for bootstrapping | |
- run: brew install bash diffutils llvm@${{ matrix.params.llvm-version }} | |
- name: "Select LLVM version" | |
run: echo "LLVM_CONFIG=/opt/homebrew/opt/llvm@${{ matrix.params.llvm-version }}/bin/llvm-config" >> $GITHUB_ENV | |
- name: "Compile and test" | |
run: ./runtests.sh --verbose --jou-flags "${{ matrix.params.opt-level }}" | |
- name: "Compile the compiler with itself" | |
run: ./jou -o jou2 compiler/main.jou && mv jou2 jou | |
- name: "Compile and test again" | |
run: ./runtests.sh --verbose --jou-flags "${{ matrix.params.opt-level }}" | |
- run: ./doctest.sh | |
# Please keep in sync with valgrind.yml | |
create-issue-on-failure: | |
name: Create an issue if failed | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: [check-if-needed, test] | |
if: ${{ github.repository == 'Akuli/jou' && always() && needs.check-if-needed.outputs.needed == 'true' && needs.test.result == 'failure' }} | |
permissions: | |
issues: write | |
steps: | |
- uses: actions/checkout@v4 | |
- run: ./create_issue.sh "${{ secrets.GITHUB_TOKEN }}" "Running tests on MacOS failed" |