Skip to content

Commit

Permalink
Fix CI (#106)
Browse files Browse the repository at this point in the history
* Fix CI

- Fix macos download link
- Fix g:ruby_host_prog not supporting spaces anymore
- Fix flaky order-dependent client info spec
- remove hardcoded ruby versions so i don't have to keep updating them
  • Loading branch information
alexgenco authored May 26, 2024
1 parent 4182796 commit a6d93c4
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 41 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
ruby: [2.7, 3.0, 3.1, 3.2, head]
ruby: [ruby, head]
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
Expand All @@ -37,8 +37,6 @@ jobs:
windows:
strategy:
fail-fast: false
matrix:
ruby: [2.7, 3.0, 3.1, 3.2]
runs-on: windows-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
Expand All @@ -51,7 +49,7 @@ jobs:
repository: neovim/neovim-ruby
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
ruby-version: ruby
bundler-cache: true
- name: Install Neovim
uses: crazy-max/ghaction-chocolatey@v1
Expand Down
2 changes: 1 addition & 1 deletion Flavorfile.lock
Original file line number Diff line number Diff line change
@@ -1 +1 @@
thinca/vim-themis (737e5444713ba53a9dcfbe3b962239bd0bd9162e at master)
thinca/vim-themis (c1f4d465ce7dd23735513551b5c4c918d9c1bab1 at master)
6 changes: 3 additions & 3 deletions script/ci/download_nvim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ set -eu
case "$(echo "$RUNNER_OS" | tr "[:upper:]" "[:lower:]")" in
macos)
wget -nv -P /tmp \
"https://github.com/neovim/neovim/releases/download/stable/nvim-macos.tar.gz"
tar -C /tmp -xzf /tmp/nvim-macos.tar.gz
mv /tmp/nvim-macos ./_nvim
"https://github.com/neovim/neovim/releases/download/stable/nvim-macos-x86_64.tar.gz"
tar -C /tmp -xzf /tmp/nvim-macos-x86_64.tar.gz
mv /tmp/nvim-macos-x86_64 ./_nvim
;;
linux)
mkdir -p _nvim/bin
Expand Down
3 changes: 3 additions & 0 deletions script/host_wrapper.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
pushd "%~dp0\.." 2>NUL
ruby -I %CD%\lib %CD%\exe\neovim-ruby-host %*
5 changes: 5 additions & 0 deletions script/host_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

cd "$(dirname "$0")/.."

exec ruby -I ./lib ./exe/neovim-ruby-host "$@"
4 changes: 2 additions & 2 deletions script/run_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"NVIM_RPLUGIN_MANIFEST" => manifest,
"THEMIS_VIM" => nvim,
"THEMIS_HOME" => themis_home,
"THEMIS_ARGS" => "-e -s --headless -u #{vimrc}"
"THEMIS_ARGS" => "-e --headless -u #{vimrc}"
}

FileUtils.rm_f(manifest)
Expand All @@ -30,7 +30,7 @@
system(
env,
nvim,
"-e", "-s", "--headless",
"-e", "--headless",
"-u", vimrc,
"+UpdateRemotePlugins", "+qa!"
)
Expand Down
44 changes: 14 additions & 30 deletions spec/acceptance/client_info_spec.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,18 @@ function! s:suite.before_each() abort
\ "v:val.client")
endfunction

function! s:suite.get_script_host_client_info() abort
let client_info = s:client_chans[1]

call s:expect(sort(keys(client_info))).to_equal(
\ ["attributes", "methods", "name", "type", "version"])

call s:expect(client_info.attributes).to_be_dict()
call s:expect(client_info.methods).to_equal({"specs": {"nargs": 1}, "poll": {}})
call s:expect(client_info.name).to_equal("ruby-script-host")
call s:expect(client_info.type).to_equal("host")

call s:expect(client_info.version.major).to_be_number()
call s:expect(client_info.version.minor).to_be_number()
call s:expect(client_info.version.patch).to_be_number()
endfunction

function! s:suite.get_rplugin_client_info() abort
let client_info = s:client_chans[0]

call s:expect(sort(keys(client_info))).to_equal(
\ ["attributes", "methods", "name", "type", "version"])

call s:expect(client_info.attributes).to_be_dict()
call s:expect(client_info.methods).to_equal({"specs": {"nargs": 1}, "poll": {}})
call s:expect(client_info.name).to_equal("ruby-rplugin-host")
call s:expect(client_info.type).to_equal("host")

call s:expect(client_info.version.major).to_be_number()
call s:expect(client_info.version.minor).to_be_number()
call s:expect(client_info.version.patch).to_be_number()
function! s:suite.get_client_info() abort
for client_info in s:client_chans
call s:expect(sort(keys(client_info))).to_equal(
\ ["attributes", "methods", "name", "type", "version"])

call s:expect(client_info.attributes).to_be_dict()
call s:expect(client_info.methods).to_equal({"specs": {"nargs": 1}, "poll": {}})
call s:expect(client_info.name).to_match("ruby-\\(script\\|rplugin\\)-host")
call s:expect(client_info.type).to_equal("host")

call s:expect(client_info.version.major).to_be_number()
call s:expect(client_info.version.minor).to_be_number()
call s:expect(client_info.version.patch).to_be_number()
endfor
endfunction
7 changes: 6 additions & 1 deletion spec/acceptance/runtime/init.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
let s:lib_path = getcwd() . "/lib"
let s:exe_path = getcwd() . "/exe/neovim-ruby-host"
let g:acceptance_rtp = getcwd() . "/spec/acceptance/runtime"
let g:ruby_host_prog = printf("ruby -I %s %s", s:lib_path, s:exe_path)

if has("win32") || has("win64")
let g:ruby_host_prog = getcwd() . "/script/host_wrapper.bat"
else
let g:ruby_host_prog = getcwd() . "/script/host_wrapper.sh"
endif

ruby require "rspec/expectations"
ruby include ::RSpec::Matchers.dup
Expand Down

0 comments on commit a6d93c4

Please sign in to comment.