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

feat(ci): add linter #231

Merged
merged 1 commit into from
Sep 10, 2024
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
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