Skip to content

Commit

Permalink
fix: vendor testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Jun 13, 2023
1 parent 82ab346 commit 800c19d
Show file tree
Hide file tree
Showing 27 changed files with 3,664 additions and 181 deletions.
50 changes: 19 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,35 @@ jobs:
# Check commit messages
- uses: webiny/action-conventional-commits@v1.1.0

build:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
neovim_branch: ['v0.8.3', 'v0.9.1', 'nightly']
runs-on: ubuntu-latest
neovim_branch:
- 'v0.8.3'
- 'v0.9.1'
- 'nightly'

env:
NEOVIM_BRANCH: ${{ matrix.neovim_branch }}
NVIM_TEST_VERSION: ${{ matrix.neovim_branch }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get Neovim SHA
id: get-nvim-sha
run: |
echo "sha=$(git ls-remote https://github.com/neovim/neovim ${{env.NEOVIM_BRANCH}} | cut -f1)" >> $GITHUB_OUTPUT
- name: Cache Deps
id: cache-deps
uses: actions/cache@v3
- uses: leafo/gh-actions-lua@v9
with:
path: deps
key: ${{ steps.get-nvim-sha.outputs.sha }}-${{ hashFiles('.github/workflows/ci.yml', 'Makefile') }}

- name: Install Neovim build dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
sudo apt-get update &&
sudo apt-get install -y \
cmake \
g++ \
gettext \
libtool-bin \
lua-bitop \
ninja-build \
unzip
- name: Build Neovim
if: steps.cache-deps.outputs.cache-hit != 'true'
run: make test_deps
luaVersion: "5.1.5"

- uses: leafo/gh-actions-luarocks@v4

- name: install busted
run: luarocks install busted

- name: Download Nvim
run: make nvim

- name: Run Test
run: make test
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
doc/tags

neovim

scratch/dummy_ignored.txt

nvim-test-*
nvim-runner-*
80 changes: 36 additions & 44 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,65 @@ export PJ_ROOT=$(PWD)

FILTER ?= .*

LUA_VERSION := 5.1
NEOVIM_BRANCH ?= master
NVIM_RUNNER_VERSION := v0.9.1
NVIM_TEST_VERSION ?= v0.9.1

DEPS_DIR := $(PWD)/deps/nvim-$(NEOVIM_BRANCH)
NVIM_DIR := $(DEPS_DIR)/neovim
ifeq ($(shell uname -s),Darwin)
NVIM_PLATFORM ?= macos
else
NVIM_PLATFORM ?= linux64
endif

LUAROCKS := luarocks
LUAROCKS_TREE := $(DEPS_DIR)/luarocks/usr
LUAROCKS_LPATH := $(LUAROCKS_TREE)/share/lua/$(LUA_VERSION)
LUAROCKS_INIT := eval $$($(LUAROCKS) --tree $(LUAROCKS_TREE) path) &&
NVIM_URL := https://github.com/neovim/neovim/releases/download

.DEFAULT_GOAL := build
NVIM_RUNNER := nvim-runner-$(NVIM_RUNNER_VERSION)
NVIM_RUNNER_URL := $(NVIM_URL)/$(NVIM_RUNNER_VERSION)/nvim-$(NVIM_PLATFORM).tar.gz

$(NVIM_DIR):
@mkdir -p $(DEPS_DIR)
git clone --depth 1 https://github.com/neovim/neovim --branch $(NEOVIM_BRANCH) $@
@# disable LTO to reduce compile time
make -C $@ \
DEPS_BUILD_DIR=$(dir $(LUAROCKS_TREE)) \
CMAKE_BUILD_TYPE=RelWithDebInfo \
CMAKE_EXTRA_FLAGS='-DCI_BUILD=OFF -DENABLE_LTO=OFF'
NVIM_TEST := nvim-test-$(NVIM_TEST_VERSION)
NVIM_TEST_URL := $(NVIM_URL)/$(NVIM_TEST_VERSION)/nvim-$(NVIM_PLATFORM).tar.gz

INSPECT := $(LUAROCKS_LPATH)/inspect.lua
export NVIM_PRG = $(NVIM_TEST)/bin/nvim

$(INSPECT): $(NVIM_DIR)
@mkdir -p $$(dirname $@)
$(LUAROCKS) --tree $(LUAROCKS_TREE) install inspect
touch $@
.DEFAULT_GOAL := build

LUV := $(LUAROCKS_TREE)/lib/lua/$(LUA_VERSION)/luv.so
define fetch_nvim
rm -rf $@
rm -rf nvim-$(NVIM_PLATFORM).tar.gz
wget $(1)
tar -xf nvim-$(NVIM_PLATFORM).tar.gz
rm -rf nvim-$(NVIM_PLATFORM).tar.gz
mv nvim-$(NVIM_PLATFORM) $@
endef

$(LUV): $(NVIM_DIR)
@mkdir -p $$(dirname $@)
$(LUAROCKS) --tree $(LUAROCKS_TREE) install luv
$(NVIM_RUNNER):
$(call fetch_nvim,$(NVIM_RUNNER_URL))

.PHONY: lua_deps
lua_deps: $(INSPECT)
$(NVIM_TEST):
$(call fetch_nvim,$(NVIM_TEST_URL))

.PHONY: test_deps
test_deps: $(NVIM_DIR)
.PHONY: nvim
nvim: $(NVIM_RUNNER) $(NVIM_TEST)

export VIMRUNTIME=$(NVIM_DIR)/runtime
export TEST_COLORS=1
LUAROCKS := luarocks --lua-version=5.1 --tree .luarocks

BUSTED = $$( [ -f $(NVIM_DIR)/test/busted_runner.lua ] \
&& echo "$(NVIM_DIR)/build/bin/nvim -ll $(NVIM_DIR)/test/busted_runner.lua" \
|| echo "$(LUAROCKS_INIT) busted" )
.luarocks/bin/busted:
$(LUAROCKS) install busted

.PHONY: test
test: $(NVIM_DIR)
$(BUSTED) -v \
test: $(NVIM_RUNNER) $(NVIM_TEST) .luarocks/bin/busted
eval $$($(LUAROCKS) path) && $(NVIM_RUNNER)/bin/nvim -ll test/busted/runner.lua -v \
--lazy \
--helper=$(PWD)/test/preload.lua \
--output test.busted.outputHandlers.nvim \
--lpath=$(NVIM_DIR)/?.lua \
--lpath=$(NVIM_DIR)/build/?.lua \
--lpath=$(NVIM_DIR)/runtime/lua/?.lua \
--lpath=$(DEPS_DIR)/?.lua \
--output test.busted.output_handler \
--lpath=$(PWD)/lua/?.lua \
--filter="$(FILTER)" \
$(PWD)/test

-@stty sane

.PHONY: gen_help
gen_help: $(INSPECT)
@$(LUAROCKS_INIT) ./gen_help.lua
gen_help:
@./gen_help.lua
@echo Updated help

.PHONY: build
Expand Down
19 changes: 16 additions & 3 deletions lua/gitsigns/cache.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lua/gitsigns/config.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 800c19d

Please sign in to comment.