From 487538ef998de7cd8f3ef0b0aca1c96338108cd2 Mon Sep 17 00:00:00 2001 From: Aaron Sullivan Date: Sun, 15 Dec 2024 14:57:08 -0800 Subject: [PATCH] Test github action for running tests --- .github/workflows/test.yml | 39 ++++++++++++++++++++++++++++++++++ Makefile | 6 ++---- tests/minimal_init.lua | 7 ------ tests/treewalker/util_spec.lua | 1 + 4 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ad95f48 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +name: Run Tests + +on: + push: + branches: [ "*" ] + pull_request: + branches: [ main ] + +jobs: + test: + + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Install Make Dependencies + run: | + sudo apt-get update + sudo apt-get install libtool-bin autoconf automake cmake g++ pkg-config unzip gettext curl -y + + - name: Install Neovim + run: | + sudo snap install nvim --classic + + - name: Install Plenary + run: | + git clone https://github.com/nvim-lua/plenary.nvim.git + mkdir -p .local/share/nvim/lazy/ + mv plenary.nvim .local/share/nvim/lazy/ + + - name: Run Tests + env: + XDG_CONFIG_HOME: ${{ github.workspace }}/.config + XDG_DATA_HOME: ${{ github.workspace }}/.local/share + XDG_STATE_HOME: ${{ github.workspace }}/.local/state + XDG_CACHE_HOME: ${{ github.workspace }}/.cache + run: make test diff --git a/Makefile b/Makefile index fe134cd..3d8fa51 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,6 @@ TESTS_DIR=tests .PHONY: test -# TODO I want test to contain a lua-language-server pass - test_nvim: @nvim \ --headless \ @@ -13,7 +11,7 @@ test_nvim: -c "PlenaryBustedDirectory ${TESTS_DIR} { minimal_init = '${TESTS_INIT}' }" test: - -$(MAKE) test_nvim || exit 1 + $(MAKE) test_nvim test-watch: - nodemon -e lua -x "$(MAKE) test" + nodemon -e lua -x "$(MAKE) test || exit 1" diff --git a/tests/minimal_init.lua b/tests/minimal_init.lua index 1117c70..c8be46f 100644 --- a/tests/minimal_init.lua +++ b/tests/minimal_init.lua @@ -2,13 +2,6 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy" vim.notify = print vim.opt.rtp:append(".") vim.opt.rtp:append(lazypath .. "/plenary.nvim") -vim.opt.rtp:append(lazypath .. "/nui.nvim") -vim.opt.rtp:append(lazypath .. "/telescope.nvim") --- vim.opt.rtp:append(lazypath .. "/nvim-nio") - --- -- Get all our normal plugins into the test env --- local suite = os.getenv("SUITE") --- vim.opt.rtp:append(suite .. "nvim") vim.opt.swapfile = false diff --git a/tests/treewalker/util_spec.lua b/tests/treewalker/util_spec.lua index 0e569ad..1a7172d 100644 --- a/tests/treewalker/util_spec.lua +++ b/tests/treewalker/util_spec.lua @@ -96,6 +96,7 @@ describe("util", function() -- always set local res = util.has_env_var("SHELL") assert.is_true(res) + assert.is_true(false) end) it("returns false", function()