Skip to content

Commit

Permalink
ci: stylua check
Browse files Browse the repository at this point in the history
  • Loading branch information
hernancerm committed Nov 23, 2024
1 parent 71323c6 commit b203380
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Install stylua
shell: bash
run: |
# To update the version of stylua refer to the releases page for the URL:
# https://github.com/JohnnyMorganz/StyLua/releases
curl -LO https://github.com/JohnnyMorganz/StyLua/releases/download/v2.0.1/stylua-linux-x86_64.zip
unzip stylua-linux-x86_64.zip
rm -rf /opt/stylua
mkdir -p /opt/stylua
mv stylua /opt/stylua
# Add the stylua binary to the system's path.
echo /opt/stylua >> ${GITHUB_PATH}
- name: Run stylua check
run: make testfmt

- name: Install Neovim
shell: bash
run: |
Expand All @@ -27,10 +46,8 @@ jobs:
# Add the nvim binary to the system's path.
echo /opt/nvim-linux64/bin >> ${GITHUB_PATH}
- name: Check out repository code
uses: actions/checkout@v4

- name: Run tests
shell: bash
run: |
nvim --version
make test
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
test: deps/lua/test.lua
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua MiniTest.run()"

# Verify all files match the configured formatting
testfmt:
ifeq (, $(shell which stylua))
$(error "No stylua found. Install from: https://github.com/JohnnyMorganz/StyLua")
endif
stylua --check lua/ scripts/ tests/

# Formatting with https://github.com/JohnnyMorganz/StyLua
fmt:
ifeq (, $(shell which stylua))
Expand Down

0 comments on commit b203380

Please # to comment.