Skip to content

Commit

Permalink
Test github action for running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronik committed Dec 15, 2024
1 parent f54d28b commit 9cae1f0
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 30 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ TESTS_DIR=tests

.PHONY: test

# TODO I want test to contain a lua-language-server pass

test_nvim:
@nvim \
--headless \
Expand All @@ -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"
6 changes: 0 additions & 6 deletions lua/treewalker/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ M.guid = function()
end)
end

---@param env_key string
---@return boolean
M.has_env_var = function(env_key)
return type(os.getenv(env_key)) ~= type(nil)
end

---reverse an array table
---@param t table
M.reverse = function (t)
Expand Down
7 changes: 0 additions & 7 deletions tests/minimal_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 0 additions & 13 deletions tests/treewalker/util_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,6 @@ describe("util", function()
end)
end)

describe("ensure_env_var", function()
it("returns true", function()
-- always set
local res = util.has_env_var("SHELL")
assert.is_true(res)
end)

it("returns false", function()
local res = util.has_env_var("IM_SUPER_SURE_THIS_ENV_VAR_WONT_BE_SET_FR_FR")
assert.is_false(res)
end)
end)

describe("reverse", function()
it("reverses an array table", function()
local t = { 1, 2, 3, 4, 5 }
Expand Down

0 comments on commit 9cae1f0

Please sign in to comment.