Skip to content

Commit

Permalink
Add Runic using GHA (#2268)
Browse files Browse the repository at this point in the history
[Runic](https://github.com/fredrikekre/Runic.jl) is a newish Julia formatter, that JuliaGPU has been adopting.
A particularly nice feature is it's ability to format only ranges,
and thus we can use a GHA to format Enzyme over-time.

Using [pre-commit](https://pre-commit.com/) one can also easily install
a git pre commit hook.
  • Loading branch information
vchuravy authored Jan 17, 2025
1 parent 871577f commit b95c737
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/Format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: 'Format'

on:
pull_request_target:
paths: ['**/*.jl']
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: read

# needed for julia-actions/cache to delete old caches
actions: write

# needed for googleapis/code-suggester
pull-requests: write

jobs:
runic:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- 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: 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
run: |
set +e
git runic origin/master
[ $? -eq 2 ] && exit 1 || exit 0
- name: Suggest changes
uses: googleapis/code-suggester@v2
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
command: review
pull_number: ${{ github.event.pull_request.number }}
git_dir: '.'
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/fredrikekre/runic-pre-commit
rev: v1.0.0
hooks:
- id: runic

0 comments on commit b95c737

Please sign in to comment.