-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate from travis to Github Actions - Update ruby version to 3 - Update gemfile - Rename VimFlavor to Flavorfile - Don't rely on vim-flavor but directly install vim-UT -- to avoid installing lh-vim-lib twice is different version: we want to test the current sources, not the last tagged version - Execute tests only on ubuntu-latest (headless) and macos - Execute tests with Vim (8, currently) and neovim - Fix CI tests: options.vim, ref.vim, has.vim - Tests are directly executed without relying on vim-runner and +clientserver interface TODO: - test on Windows - Test different version of Vim
- Loading branch information
1 parent
612538b
commit 767887c
Showing
11 changed files
with
157 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake | ||
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
name: "test on ${{ matrix.os }} ; ${{ matrix.neovim && 'neovim' || 'vim' }}" | ||
|
||
strategy: | ||
matrix: | ||
# Testing doesn't seem to work on Windows: output log file | ||
# cannot be read... | ||
# os: [ubuntu-latest, macos-latest, windows-latest] | ||
os: [ubuntu-latest, macos-latest] | ||
neovim: [false, true] | ||
# TODO: Test different flavours of Vim... | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.0 | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Setup Vim | ||
uses: rhysd/action-setup-vim@v1 | ||
# uses: thinca/action-setup-vim@v2 | ||
id: vim | ||
with: | ||
neovim: ${{matrix.neovim }} | ||
configure-args: | | ||
--with-features=huge | ||
- name: Install vim plugin dependencies | ||
# Manually install UT -- without vim-flavor which will install | ||
# lh-vim-lib a second time and create conflicts... | ||
run: | | ||
mkdir -p ~/.vim/pack/flavors/start | ||
git clone https://github.com/LucHermitte/vim-UT ~/.vim/pack/flavors/start/UT | ||
- name: Run tests on Linux | ||
if: runner.os == 'Linux' # headless execution is required on Linux | ||
run: | | ||
xvfb-run bundle exec rake test | ||
- name: Run tests on ${{ matrix.os }} | ||
if: runner.os != 'Linux' | ||
run: | | ||
bundle exec rake test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
--color | ||
--require spec_helper | ||
--format documentation | ||
-I ~/.vim-flavor/repos/LucHermitte_vim-UT/spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'rspec', '~> 3.9.0' | ||
gem 'vimrunner', '~> 0.3.4' | ||
gem 'rspec', '~> 3.13.0' | ||
gem 'vimrunner', '~> 0.3.5' | ||
gem 'rake', '~> 13.0.1' | ||
gem 'vim-flavor', '~> 2.2.2' | ||
# gem 'vim-flavor', '~> 4.0.3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# encoding: UTF-8 | ||
# | ||
# unit tests spec runner dedicated to lh-vim-lib | ||
# -> These tests needs to rely 100% on clones lh-vim-lib | ||
|
||
require 'pp' | ||
|
||
RSpec.describe "unit tests" do | ||
# First search for a vimrc that bootstraps vim-flavor v2 | ||
# (v3 uses global packadd from vim8) | ||
# It could be: | ||
# - either {plugin}/spec/flavor.vimrc | ||
# - or ~/.vimrc/flavors/bootstrap.vim | ||
vimrc_candidates = ['spec/flavor.vimrc', | ||
ENV['HOME']+'/.vim/flavors/bootstrap.vim', | ||
ENV['HOME']+'/vimfiles/flavors/bootstrap.vim'] | ||
vimrc = vimrc_candidates.find{ |candidate| File.file?(candidate)} | ||
if vimrc.nil? | ||
print "no bootstrapping vimrc found...\n" | ||
vim_plugin_path = File.expand_path('.') | ||
u_vimrc = "--cmd 'set rtp+=#{vim_plugin_path},#{vim_plugin_path}/after' --cmd 'filetype plugin on'" | ||
else | ||
print "bootstrapping vimrc found: #{vimrc}\n" | ||
vim_plugin_path = File.expand_path('.') | ||
# '-u {file}' forces '&compatible' => '-N' | ||
u_vimrc = "-u #{vimrc} -N --cmd 'set rtp+=#{vim_plugin_path},#{vim_plugin_path}/after' --cmd 'filetype plugin on'" | ||
end | ||
|
||
cmd = %(vim #{u_vimrc} -X -V1 -e -s -c "echo 'RTP: '..&rtp" -c "scriptnames" -c "q") | ||
pp system(cmd) | ||
|
||
# The tests | ||
describe "Check all tests", :unit_tests => true do | ||
pwd = Dir.pwd | ||
files = Dir.glob('./tests/**/*.vim') | ||
pp "In directory #{pwd}, run #{files}" | ||
files.each{ |file| | ||
it "[#{file}] runs fine" do | ||
abs_file = pwd + '/' + file | ||
log_file = abs_file + '.log' | ||
# pp "file: #{file}" | ||
# pp "abs: #{abs_file}" | ||
# pp "log: #{log_file}" | ||
# TODO: collect verbose mode messages | ||
cmd = %(vim #{u_vimrc} -N -X -e -s -c "UTBatch #{log_file} #{abs_file}") | ||
# pp cmd | ||
ok = system(cmd) | ||
# print "Check log file '#{log_file}' exists\n" | ||
# expect(log_file).to be_an_existing_file | ||
if ! ok | ||
# print "Log file: #{file}.log\n" | ||
if File.file?(log_file) | ||
log = File.read(log_file) | ||
else | ||
log = "Warning: Cannot read #{log_file}" | ||
end | ||
end | ||
expect(ok).to be_truthy, "expected test to succeed, got\n#{log}\n" | ||
end | ||
} | ||
end | ||
end | ||
|
||
# vim:set sw=2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
flavor 'LucHermitte/vim-UT', '>= 2.0.6' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters