diff --git a/.github/workflows/tests.yml b/.github/workflows/conform.yml similarity index 71% rename from .github/workflows/tests.yml rename to .github/workflows/conform.yml index 70a4dc3..3bc5c40 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/conform.yml @@ -1,5 +1,5 @@ --- -name: Test +name: Conform on: pull_request: @@ -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 diff --git a/scripts/lint.sh b/scripts/lint.sh new file mode 100755 index 0000000..c94a823 --- /dev/null +++ b/scripts/lint.sh @@ -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 "$@" diff --git a/scripts/tests.sh b/scripts/tests.sh index b265a91..dc77216 100755 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -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 diff --git a/tests/_dockerfiles/ubuntu/Dockerfile b/tests/_dockerfiles/ubuntu/Dockerfile index 5ec7f7d..9335744 100644 --- a/tests/_dockerfiles/ubuntu/Dockerfile +++ b/tests/_dockerfiles/ubuntu/Dockerfile @@ -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