AOT compilation #1117
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
| name: 'Format' | |
| on: | |
| pull_request_target: | |
| paths: ['**/*.jl'] | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| permissions: | |
| contents: read | |
| actions: write | |
| pull-requests: write | |
| jobs: | |
| runic: | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.draft == false | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{github.event.pull_request.head.ref}} | |
| repository: ${{github.event.pull_request.head.repo.full_name}} | |
| fetch-depth: 0 | |
| - name: Add upstream remote | |
| run: | | |
| git remote add upstream https://github.com/${{ github.repository }} | |
| git fetch upstream | |
| - name: Setup Julia | |
| uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: '1' | |
| arch: 'x64' | |
| - uses: julia-actions/cache@v2 | |
| - name: Install Runic | |
| run: | | |
| julia --project=@runic -e 'using Pkg; Pkg.add("Runic")' | |
| curl -o git-runic https://raw.githubusercontent.com/fredrikekre/Runic.jl/master/bin/git-runic | |
| chmod +x git-runic | |
| sudo mv git-runic /usr/local/bin | |
| - name: Run Runic | |
| id: runic | |
| run: | | |
| set +e | |
| MERGE_BASE=$(git merge-base upstream/${{ github.base_ref }} HEAD) || exit 1 | |
| # Get changed .jl files, excluding AOT apps that use @main (unsupported by Runic) | |
| FILES=$(git diff --name-only $MERGE_BASE -- '*.jl' \ | |
| | grep -v 'test/COPSApp.jl/' \ | |
| | grep -v 'test/LuksanVlcekApp.jl/' \ | |
| | tr '\n' ' ') | |
| if [ -z "$FILES" ]; then | |
| echo "exit_code=0" >> $GITHUB_OUTPUT | |
| echo "diff<<EOF" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| DIFF=$(julia --project=@runic -e "using Runic; exit(Runic.main(ARGS))" -- --diff $FILES) | |
| EXIT_CODE=$? | |
| echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT | |
| echo "diff<<EOF" >> $GITHUB_OUTPUT | |
| echo "$DIFF" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| # if Runic failed, bail out | |
| [ $EXIT_CODE -eq 2 ] && exit 1 || exit 0 | |
| - name: Find comment | |
| uses: peter-evans/find-comment@v3 | |
| id: find-comment | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| comment-author: 'github-actions[bot]' | |
| body-includes: '<!-- runic-format-summary -->' | |
| - name: Comment formatting suggestions | |
| if: steps.runic.outputs.exit_code == 1 | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body: | | |
| <!-- runic-format-summary --> | |
| Your PR requires formatting changes to meet the project's style guidelines. | |
| Please run: | |
| ```sh | |
| julia --project=@runic -e 'using Pkg; Pkg.add("Runic")' | |
| julia --project=@runic -e "using Runic; exit(Runic.main(ARGS))" -- --fix <files> | |
| ``` | |
| (or `git runic ${{ github.base_ref }}` if you have the git wrapper installed) | |
| Note: the full diff is omitted because it can exceed GitHub Actions input limits. | |
| edit-mode: replace | |
| - name: Update stale comment | |
| if: steps.runic.outputs.exit_code == 0 && steps.find-comment.outputs.comment-id | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body: | | |
| <!-- runic-format-summary --> | |
| Your PR no longer requires formatting changes. Thank you for your contribution! | |
| edit-mode: replace |