Skip to content

Commit

Permalink
ci: adding an arkscript formatting step
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperFola committed Sep 19, 2024
1 parent 3ade06a commit be6f2dd
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,29 @@ jobs:
check-path: ${{ matrix.path }}
fallback-style: 'Mozilla' # optional

check_ark:
name: ArkScript formatting check
runs-on: ubuntu-24.04

strategy:
fail-fast: false
matrix:
path:
- /src/examples
- /src/tests/arkscript

container:
image: arkscript/nightly
volumes:
- ${{ github.workspace }}:/src

steps:
- uses: actions/checkout@v4
- name: Format check
uses: ./.github/workflows/format-check-arkscript
with:
folder: ${{ matrix.path }}

repo_visualizer:
runs-on: ubuntu-24.04
needs: [ check ]
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/format-check-arkscript/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: 'Format check ArkScript code'
description: 'Given a folder, find all .ark files and check that they are correctly formatted'
inputs:
folder:
description: 'Folder with .ark files to check'
required: true

runs:
using: 'composite'
steps:
- name: Check
shell: sh
run: |
failures=0
find "${{ inputs.folder }}" -type f -name "*.ark" -print0 | while read -d $'\0' file
do
arkscript --format "$file" --check || echo "❌ $file is not formatted correctly"
failures=1
done
echo $failures
if [ $failures -gt 0 ]; then
exit 1
fi

0 comments on commit be6f2dd

Please sign in to comment.