Skip to content

Commit

Permalink
build(CI): switch to GitHub Actions, fix Neovim build (pynvim/greenle…
Browse files Browse the repository at this point in the history
…t) (#78)

* add g++ to fix building of greenlet for -py2/-py3 with Neovim's pynvim

* move CI to GitHub Actions

This also adds separate jobs for single example/test builds, e.g. Neovim 0.5 with `-py3` only.

* example/Makefile: do not use -i with docker-run on CI

Using `-i` does not work on GHA:

> the input device is not a TTY

* example/Makefile: consistent whitespace with assignments
  • Loading branch information
blueyed authored Jul 24, 2021
1 parent 3852e69 commit 7163ebc
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 18 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test_single:
# Single/simple build instructions to ensure e.g. that build deps for -py2
# do not implicitly fix -py3 builds (which might fail otherwise).
name: 'test: ${{ matrix.m_name }}'
strategy:
fail-fast: false
matrix:
include:
- m_name: vim71
m_args: -tag v7.1 -name vim71 -prebuild_script 'echo "#define FEAT_PROFILE" >> src/feature.h'
- m_name: vim73
m_args: -tag v7.3.429 -name vim73 -py
- m_name: vim74-trusty
m_args: -tag v7.4.052 -name vim74-trusty -py3
- m_name: vim-master
m_args: -tag master -py2 -py3 -ruby -lua
- m_name: neovim-v0.2.0
m_args: -tag neovim:v0.2.0 -py2 -py3 -ruby
- m_name: neovim-v0.5.0
m_args: -tag neovim:v0.5.0 -py3
- m_name: neovim-master
m_args: -tag neovim:master -py2 -py3 -ruby
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Build example for test
run: |
cat > example/Dockerfile.tests <<EOF
FROM vim-testbed-base
RUN install_vim ${{ matrix.m_args }} -build
EOF
make build_example_for_test
- run: make -C example test_vims_basic_test

test_full_example:
name: Test full example
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: make build_example_for_test
- run: make --keep-going test_example
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TAG:=19
TAG:=20

build:
docker build -t testbed/vim:$(TAG) .
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Vim Testbed

[![Build Status](https://travis-ci.org/Vimjas/vim-testbed.svg?branch=master)](https://travis-ci.org/Vimjas/vim-testbed)
[![Build Status](https://github.com/Vimjas/vim-testbed/actions/workflows/ci.yml/badge.svg?branch=master&event=push)](https://github.com/Vimjas/vim-testbed/actions?query=branch%3Amaster+event%3Apush)
[![](https://badge.imagelayers.io/testbed/vim:latest.svg)](https://imagelayers.io/?images=testbed/vim:latest)

Because unit testing a Vim plugin is a pain in the ass.

[vader.vim](https://github.com/junegunn/vader.vim) provides a pretty
straightforward way to test Vim plugins. But, you'll only be testing on the
version of Vim you have installed. Then there's the issue of running automated
tests with Travis-CI where you have to either:
tests with CI where you have to either:

- Build Vim from source which takes an eternity, then run your tests.
- Use the version that came with Ubuntu 12.04 which means you're only testing
your plugin's ability to run on 7.3.429.
- Use the version that comes pre-installed which means you're only testing
your plugin's ability to run on some specific, possibly older version.

With this base image, you can build the versions you need and reuse them in
future tests.
Expand Down
7 changes: 5 additions & 2 deletions example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ SHELL := $(shell which bash)
IMAGE := vim-testbed-example
PLUGINS := test/plugins
# A writable home directory, required for Neovim.
WRITABLE_HOME:=$(shell tmpdir=$$(mktemp -d --dry-run); \
WRITABLE_HOME := $(shell tmpdir=$$(mktemp -d --dry-run); \
mkdir -m 777 $${tmpdir}; \
cd $(CURDIR)/test; \
cp -a vimrc *.vader $${tmpdir}/; \
echo $${tmpdir})
DOCKER = docker run -it --rm \
ifneq ($(CI), true)
DOCKER_INTERACTIVE := i
endif
DOCKER := docker run -t$(DOCKER_INTERACTIVE) --rm \
-v $(CURDIR):/testplugin \
-v $(WRITABLE_HOME):/home/vimtest \
-v $(CURDIR)/$(PLUGINS):/home/vimtest/plugins "$(IMAGE)"
Expand Down
2 changes: 2 additions & 0 deletions scripts/install_vim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ EOF
VIM_CONFIG_ARGS="$VIM_CONFIG_ARGS --enable-pythoninterp=dynamic"
else
apk add python2
apk_add_build_dep g++ # for building greenlet
python2 -m ensurepip
pip2 install pynvim
fi
Expand All @@ -101,6 +102,7 @@ EOF
VIM_CONFIG_ARGS="$VIM_CONFIG_ARGS --enable-python3interp=dynamic"
else
apk add python3
apk_add_build_dep g++ # for building greenlet
apk add py3-pip
pip3 install pynvim
fi
Expand Down

0 comments on commit 7163ebc

Please sign in to comment.