Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a CI check for code formatting #151

Merged
merged 27 commits into from
Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/refmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Check formatting
on: [push]

# consider using docker: ocaml/opam2:4.06
# - sudo apt-get update && apt-get install -y m4
# - opam update && opam install reason
# - refmt # is new

jobs:
# build:
# name: build project
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@master
# with:
# fetch-depth: 1
# - uses: actions/setup-node@v1
# with:
# node-version: '10.x'
# - run: npm install -g esy@latest
# - run: esy i
# - run: esy b
# - run: esy export-dependencies
# - run: tar -czf build.tar.gz _export
# - uses: actions/upload-artifact@master
# with:
# name: cache-linux-build-dependencies
# path: build.tar.gz

test_refmt:
name: run refmt
runs-on: ubuntu-latest
# needs: [build]
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1
- uses: actions/setup-node@v1
with:
node-version: '10.x'
# - run: npm install -g esy@latest
# - uses: actions/download-artifact@master
# with:
# name: cache-linux-build-dependencies
# - run: tar -xzf cache-linux-build-dependencies/build.tar.gz
# - run: esy import-build _export/*
# - run: esy i
# - run: esy fmt
- run: npm i -g esy@latest
- run: esy @fmt i
- run: esy @fmt refmt --in-place */*.re
# - run: ./scripts/fmt_all.sh
# name: refmt all the files
- run: |
if [ -n "$(git status --porcelain)" ]; then
echo "There are differences:"
git status --porcelain
echo "----"
echo ""
echo 'Please run `esy fmt` locally to fix the issues.'
exit 1
fi
name: "Throw if something changed"
3 changes: 3 additions & 0 deletions fmt.esy.lock/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Set eol to LF so files aren't converted to CRLF-eol on Windows.
* text eol=lf
3 changes: 3 additions & 0 deletions fmt.esy.lock/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Reset any possible .gitignore, we want all esy.lock to be un-ignored.
!*
Loading