Skip to content

Commit

Permalink
feat(ci): add linter (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
gorillamoe authored Sep 10, 2024
1 parent 1bc28a9 commit 45ac960
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/tests.yml → .github/workflows/conform.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Test
name: Conform

on:
pull_request:
Expand Down Expand Up @@ -29,3 +29,13 @@ jobs:

- name: Run tests
run: ./scripts/tests.sh run
lint:
name: Lint
runs-on: ubuntu-latest
container:
image: ghcr.io/mistweaverco/kulala-nvim-testrunner:latest
steps:
- uses: actions/checkout@v4

- name: Run linter
run: ./scripts/lint.sh check
32 changes: 32 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

if ! command -v stylua &> /dev/null; then
echo "stylua is not installed"
exit 1
fi

check() {
stylua --version
if [[ -n $1 ]]; then
stylua --check "$1"
else
stylua --check .
fi
}

main() {
local action="$1"
shift
local args=$*
case $action in
"check")
check "$args"
;;
*)
echo "Invalid action"
exit 1
;;
esac

}
main "$@"
5 changes: 5 additions & 0 deletions scripts/tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash

if ! command -v nvim &> /dev/null; then
echo "nvim is not installed"
exit 1
fi

run() {
nvim --version
if [[ -n $1 ]]; then
Expand Down
4 changes: 3 additions & 1 deletion tests/_dockerfiles/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM ubuntu:latest

RUN apt-get update && apt-get upgrade -y && apt-get install -y curl git gcc lua5.1 luarocks
RUN apt-get update && apt-get upgrade -y && apt-get install -y curl git gcc lua5.1 luarocks unzip
RUN mkdir -p _neovim && curl -sL https://github.com/neovim/neovim/releases/download/v0.10.1/nvim-linux64.tar.gz | tar -xz -C _neovim && mv _neovim/nvim-linux64 /usr/local/nvim && rm -rf _neovim
RUN mkdir -p _stylua && curl -sL https://github.com/JohnnyMorganz/StyLua/releases/download/v0.20.0/stylua-linux-x86_64.zip | funzip > _stylua/stylua && chmod +x _stylua/stylua && mv _stylua/stylua /usr/local/bin/stylua && rm -rf _stylua
RUN luarocks install busted
RUN ln -s /usr/local/nvim/bin/nvim /usr/bin/nvim
RUN ln -s /usr/local/bin/stylua /usr/bin/stylua

0 comments on commit 45ac960

Please sign in to comment.