From a6d93c4428bc55dcfc4479db95006f1ad2be1a91 Mon Sep 17 00:00:00 2001 From: Alex Genco Date: Sat, 25 May 2024 21:33:34 -0700 Subject: [PATCH] Fix CI (#106) * 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 --- .github/workflows/tests.yml | 6 ++-- Flavorfile.lock | 2 +- script/ci/download_nvim.sh | 6 ++-- script/host_wrapper.bat | 3 ++ script/host_wrapper.sh | 5 ++++ script/run_acceptance.rb | 4 +-- spec/acceptance/client_info_spec.vim | 44 +++++++++------------------- spec/acceptance/runtime/init.vim | 7 ++++- 8 files changed, 36 insertions(+), 41 deletions(-) create mode 100755 script/host_wrapper.bat create mode 100755 script/host_wrapper.sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index adb0b698..f14d1d41 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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: @@ -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: @@ -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 diff --git a/Flavorfile.lock b/Flavorfile.lock index 8033c657..cc225b67 100644 --- a/Flavorfile.lock +++ b/Flavorfile.lock @@ -1 +1 @@ -thinca/vim-themis (737e5444713ba53a9dcfbe3b962239bd0bd9162e at master) +thinca/vim-themis (c1f4d465ce7dd23735513551b5c4c918d9c1bab1 at master) diff --git a/script/ci/download_nvim.sh b/script/ci/download_nvim.sh index 7c75312e..15762e7c 100755 --- a/script/ci/download_nvim.sh +++ b/script/ci/download_nvim.sh @@ -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 diff --git a/script/host_wrapper.bat b/script/host_wrapper.bat new file mode 100755 index 00000000..cf11881b --- /dev/null +++ b/script/host_wrapper.bat @@ -0,0 +1,3 @@ +@echo off +pushd "%~dp0\.." 2>NUL +ruby -I %CD%\lib %CD%\exe\neovim-ruby-host %* diff --git a/script/host_wrapper.sh b/script/host_wrapper.sh new file mode 100755 index 00000000..dec16560 --- /dev/null +++ b/script/host_wrapper.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cd "$(dirname "$0")/.." + +exec ruby -I ./lib ./exe/neovim-ruby-host "$@" diff --git a/script/run_acceptance.rb b/script/run_acceptance.rb index 48f7feb8..4f6ba89c 100755 --- a/script/run_acceptance.rb +++ b/script/run_acceptance.rb @@ -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) @@ -30,7 +30,7 @@ system( env, nvim, - "-e", "-s", "--headless", + "-e", "--headless", "-u", vimrc, "+UpdateRemotePlugins", "+qa!" ) diff --git a/spec/acceptance/client_info_spec.vim b/spec/acceptance/client_info_spec.vim index a64a563b..c390a160 100644 --- a/spec/acceptance/client_info_spec.vim +++ b/spec/acceptance/client_info_spec.vim @@ -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 diff --git a/spec/acceptance/runtime/init.vim b/spec/acceptance/runtime/init.vim index 819d827b..b3ed745c 100644 --- a/spec/acceptance/runtime/init.vim +++ b/spec/acceptance/runtime/init.vim @@ -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