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 9c6f775 commit 57d0e0c
Show file tree
Hide file tree
Showing 2 changed files with 45 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
22 changes: 22 additions & 0 deletions .github/workflows/format-check-arkscript/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
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
while read -rd $'\0' file; do
if ! arkscript --format "$file" --check; then
echo "❌ $(basename $file) is not formatted correctly"
failures=$((failures+1))
fi
done < <(find "${{ inputs.folder }}" -type f -name "*.ark" -print0)
[ $failures -gt 0 ] && exit 1

0 comments on commit 57d0e0c

Please sign in to comment.