Merge pull request #187 from preservim/test

Add CI workflow to actually test-drive Vimux

This is fairly primitive, but it's a start. At least we will know if a PR makes some egregious error that makes basic functionality die. In the future we should probably write some small test scripts and verify the contents of panes with some sort of content capture for true unit regression testing, but a pass/fail grade that we don't explode is better than no testing.
This commit is contained in:
Caleb Maclennan 2021-02-19 12:49:12 +03:00 committed by GitHub
commit 9dd1b68b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 0 deletions

38
.github/workflows/check.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Check
on: [push, pull_request]
jobs:
check:
strategy:
fail-fast: false
matrix:
vimFlavor: ["vim", "nvim"]
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Enable Universe package repository
run: |
sudo add-apt-repository universe
sudo apt-get update
- name: Install tmux and ${{ matrix.tagsProvider }}
run: |
sudo apt-get install tmux ${{ matrix.vimFlavor == 'nvim' && 'neovim' || 'vim' }}
- name: Review versions
run: |
tmux -V
${{ matrix.vimFlavor }} --version
# This tests looks for two thigs:
# * That VIM doesn't hang. If it succedes it will quit quickly. If 5
# seconds later the tmux session is still running either the runner pane
# didn't get closed or (more likely) we threw some error and VIM is
# sitting there expecting us to acknowledge the message(s).
# * That VIM exited normally. This check isn't very useful since :qa
# never bubbles up an error, but if someday we use :cq for a test being
# ready to check the exit code seems like a good thing.
- name: "Try Vimux"
run: |
ec="$(mktemp)"
tmux new -s ci -d "${{ matrix.vimFlavor == 'nvim' && 'nvim -u /dev/null --headless' || 'vim' }} -i NONE \"+so plugin/vimux.vim\" \"+VimuxRunCommand('date')\" \"+VimuxCloseRunner | qa\"; echo \$? > '$ec'"
sleep 5
tmux kill-session -t ci && exit 1
exit "$(cat $ec)"

View File

@ -1,6 +1,7 @@
# Vimux: easily interact with tmux from vim
[![Vint](https://github.com/preservim/vimux/workflows/Vint/badge.svg)](https://github.com/preservim/vimux/actions?workflow=Vint)
[![Check](https://github.com/preservim/vimux/workflows/Check/badge.svg)](https://github.com/preservim/vimux/actions?workflow=Check)
![vimux](https://www.braintreepayments.com/blog/content/images/blog/vimux3.png)