Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌿 Add tests for Vim script #314

Closed
wants to merge 2 commits into from
Closed

🌿 Add tests for Vim script #314

wants to merge 2 commits into from

Conversation

lambdalisue
Copy link
Member

@lambdalisue lambdalisue commented Jan 9, 2024

#313

Summary by CodeRabbit

  • New Features

    • Implemented automated testing for Vim and Neovim configurations.
    • Added new tests for the denops#plugin module functionality.
  • Tests

    • Introduced Vim script functions for enhanced test scripting capabilities.
    • Established a test environment setup script for the Themis plugin.
  • Chores

    • Configured GitHub Actions to automate linting, formatting, and testing workflows.

Copy link

coderabbitai bot commented Jan 9, 2024

Walkthrough

The changes introduce a comprehensive testing suite for Vim and Neovim configurations using GitHub Actions and the Themis testing framework. The testing not only includes linting and formatting checks but also ensures the proper functioning of Vim script plugins across various environments. This setup is crucial for maintaining the quality and stability of the Vim scripting components in the project.

Changes

File Path Change Summary
.github/workflows/... Added GitHub Actions workflow for Vim/Neovim testing.
test/.themisrc Created Themis configuration for Vim script testing.
test/denops/... Introduced tests for denops#plugin module.
test/run_themis.sh Script to execute Themis tests for Vim and Neovim.

Related issues

  • Issue Add tests for Vim script #313: Add tests for Vim script
    • The changes in this PR seem to address the need for Vim script testing as outlined in the issue, by setting up a Themis testing framework and related scripts.

🐇✨
In the world of code, where bugs creep,
A rabbit hopped in, no time to sleep.
With tests in place, the scripts we trust,
Ensuring our Vim, ne'er bites the dust. 🌟
🐇✨

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

codecov bot commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (83f167b) 96.47% compared to head (805de55) 96.47%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #314   +/-   ##
=======================================
  Coverage   96.47%   96.47%           
=======================================
  Files           3        3           
  Lines          85       85           
  Branches        6        6           
=======================================
  Hits           82       82           
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 83f167b and 805de55.
Files selected for processing (5)
  • .github/workflows/test_vim.yml (1 hunks)
  • test/.themisrc (1 hunks)
  • test/denops/plugin.vimspec (1 hunks)
  • test/denops/testdata/dummy.ts (1 hunks)
  • test/run_themis.sh (1 hunks)
Additional comments: 1
test/denops/testdata/dummy.ts (1)
  • 1-1: The main function is currently empty. If this is intended to be a placeholder or mock for testing, then the changes look good.

Comment on lines +1 to +9
#!/bin/bash
themis --version

export THEMIS_VIM="vim"
themis --reporter dot

export THEMIS_VIM="nvim"
export THEMIS_ARGS="-e -s --headless"
themis --reporter dot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script is well-structured and sets up the environment for running Themis tests on both Vim and Neovim. Consider adding comments to explain the purpose of each command for future maintainability.

#!/bin/bash
+ # Display the Themis version for debugging purposes
themis --version
+ # Set Vim as the target editor for Themis and run tests
export THEMIS_VIM="vim"
themis --reporter dot
+ # Set Neovim as the target editor for Themis and run tests in headless mode
export THEMIS_VIM="nvim"
export THEMIS_ARGS="-e -s --headless"
themis --reporter dot

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
#!/bin/bash
themis --version
export THEMIS_VIM="vim"
themis --reporter dot
export THEMIS_VIM="nvim"
export THEMIS_ARGS="-e -s --headless"
themis --reporter dot
#!/bin/bash
# Display the Themis version for debugging purposes
themis --version
# Set Vim as the target editor for Themis and run tests
export THEMIS_VIM="vim"
themis --reporter dot
# Set Neovim as the target editor for Themis and run tests in headless mode
export THEMIS_VIM="nvim"
export THEMIS_ARGS="-e -s --headless"
themis --reporter dot

Comment on lines +1 to +27
let s:sep = has('win32') ? '\' : '/'
let s:dummy_index = 0

function! Wait(condition) abort
return denops#_internal#wait#for(1000, a:condition, 200)
endfunction

function! Join(...) abort
return join(a:000, s:sep)
endfunction

function! GetResourcePath(...) abort
let l:path = join([getcwd()] + a:000, s:sep)
if filereadable(l:path) || isdirectory(l:path)
return l:path
endif
throw 'Resource not found: ' . l:path
endfunction

function! GetDummyName() abort
let s:dummy_index += 1
return printf('dummy%d', s:dummy_index)
endfunction

let s:assert = themis#helper('assert')
call themis#option('recursive', 1)
call themis#helper('command').with(s:assert)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The utility functions in .themisrc are well-defined and serve clear purposes in the testing setup. Consider adding comments to each function to explain their usage and improve maintainability.

let s:sep = has('win32') ? '\' : '/'
+ # Function to wait for a condition to be met with a timeout
function! Wait(condition) abort
  return denops#_internal#wait#for(1000, a:condition, 200)
endfunction
+ # Function to join paths using the appropriate OS separator
function! Join(...) abort
  return join(a:000, s:sep)
endfunction
+ # Function to get the full path of a resource, throwing an error if not found
function! GetResourcePath(...) abort
  let l:path = join([getcwd()] + a:000, s:sep)
  if filereadable(l:path) || isdirectory(l:path)
    return l:path
  endif
  throw 'Resource not found: ' . l:path
endfunction
+ # Function to generate a unique dummy name for testing
function! GetDummyName() abort
  let s:dummy_index += 1
  return printf('dummy%d', s:dummy_index)
endfunction
+ # Setup Themis options and helpers
let s:assert = themis#helper('assert')
call themis#option('recursive', 1)
call themis#helper('command').with(s:assert)

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
let s:sep = has('win32') ? '\' : '/'
let s:dummy_index = 0
function! Wait(condition) abort
return denops#_internal#wait#for(1000, a:condition, 200)
endfunction
function! Join(...) abort
return join(a:000, s:sep)
endfunction
function! GetResourcePath(...) abort
let l:path = join([getcwd()] + a:000, s:sep)
if filereadable(l:path) || isdirectory(l:path)
return l:path
endif
throw 'Resource not found: ' . l:path
endfunction
function! GetDummyName() abort
let s:dummy_index += 1
return printf('dummy%d', s:dummy_index)
endfunction
let s:assert = themis#helper('assert')
call themis#option('recursive', 1)
call themis#helper('command').with(s:assert)
let s:sep = has('win32') ? '\' : '/'
let s:dummy_index = 0
# Function to wait for a condition to be met with a timeout
function! Wait(condition) abort
return denops#_internal#wait#for(1000, a:condition, 200)
endfunction
# Function to join paths using the appropriate OS separator
function! Join(...) abort
return join(a:000, s:sep)
endfunction
# Function to get the full path of a resource, throwing an error if not found
function! GetResourcePath(...) abort
let l:path = join([getcwd()] + a:000, s:sep)
if filereadable(l:path) || isdirectory(l:path)
return l:path
endif
throw 'Resource not found: ' . l:path
endfunction
# Function to generate a unique dummy name for testing
function! GetDummyName() abort
let s:dummy_index += 1
return printf('dummy%d', s:dummy_index)
endfunction
# Setup Themis options and helpers
let s:assert = themis#helper('assert')
call themis#option('recursive', 1)
call themis#helper('command').with(s:assert)

Comment on lines +1 to +54
let s:dummy_script = GetResourcePath('test', 'denops', 'testdata', 'dummy.ts')

Describe denops#plugin
Before all
call denops#server#restart()
call denops#server#wait()
End

Describe #is_loaded()
It returns 0 when the plugins is not registered
let name = GetDummyName()
Assert Equals(denops#plugin#is_loaded(name), 0)
End

It returns 0 when the plugins is registered but not loaded
let name = GetDummyName()
call denops#plugin#register(name, s:dummy_script)
Assert Equals(denops#plugin#is_loaded(name), 0)
End

It returns 1 when the plugins is registered and loaded
let name = GetDummyName()
call denops#plugin#register(name, s:dummy_script)
call denops#plugin#wait(name)
Assert Equals(denops#plugin#is_loaded(name), 1)
End

It returns 0 on DenopsPluginPre:{plugin} autocmd
let name = GetDummyName()
silent! unlet! g:ret
execute printf(
\ 'au User DenopsPluginPre:%s ++once let g:ret = denops#plugin#is_loaded("%s")',
\ name,
\ name,
\)
call denops#plugin#register(name, s:dummy_script)
Assert Equals(Wait({ -> has_key(g:, 'ret') }), 0)
Assert Equals(g:ret, 0)
End

It returns 1 on DenopsPluginPost:{plugin} autocmd
let name = GetDummyName()
silent! unlet! g:ret
execute printf(
\ 'au User DenopsPluginPost:%s ++once let g:ret = denops#plugin#is_loaded("%s")',
\ name,
\ name,
\)
call denops#plugin#register(name, s:dummy_script)
Assert Equals(Wait({ -> has_key(g:, 'ret') }), 0)
Assert Equals(g:ret, 1)
End
End
End
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test cases in plugin.vimspec are comprehensive and cover various states of the plugin loading process. Consider adding comments to each test case to explain the expected behavior and improve maintainability.

Describe denops#plugin
+ # Setup and teardown for all test cases in this describe block
  Before all
    call denops#server#restart()
    call denops#server#wait()
  End
+ # Test cases for checking if a plugin is loaded
  Describe #is_loaded()
+ # Test case when the plugin is not registered
    It returns 0 when the plugins is not registered
      let name = GetDummyName()
      Assert Equals(denops#plugin#is_loaded(name), 0)
    End
+ # Test case when the plugin is registered but not loaded
    It returns 0 when the plugins is registered but not loaded
      let name = GetDummyName()
      call denops#plugin#register(name, s:dummy_script)
      Assert Equals(denops#plugin#is_loaded(name), 0)
    End
+ # Test case when the plugin is registered and loaded
    It returns 1 when the plugins is registered and loaded
      let name = GetDummyName()
      call denops#plugin#register(name, s:dummy_script)
      call denops#plugin#wait(name)
      Assert Equals(denops#plugin#is_loaded(name), 1)
    End
+ # Test case for DenopsPluginPre autocmd event
    It returns 0 on DenopsPluginPre:{plugin} autocmd
      let name = GetDummyName()
      silent! unlet! g:ret
      execute printf(
            \ 'au User DenopsPluginPre:%s ++once let g:ret = denops#plugin#is_loaded("%s")',
            \ name,
            \ name,
            \)
      call denops#plugin#register(name, s:dummy_script)
      Assert Equals(Wait({ -> has_key(g:, 'ret') }), 0)
      Assert Equals(g:ret, 0)
    End
+ # Test case for DenopsPluginPost autocmd event
    It returns 1 on DenopsPluginPost:{plugin} autocmd
      let name = GetDummyName()
      silent! unlet! g:ret
      execute printf(
            \ 'au User DenopsPluginPost:%s ++once let g:ret = denops#plugin#is_loaded("%s")',
            \ name,
            \ name,
            \)
      call denops#plugin#register(name, s:dummy_script)
      Assert Equals(Wait({ -> has_key(g:, 'ret') }), 0)
      Assert Equals(g:ret, 1)
    End
  End
End

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
let s:dummy_script = GetResourcePath('test', 'denops', 'testdata', 'dummy.ts')
Describe denops#plugin
Before all
call denops#server#restart()
call denops#server#wait()
End
Describe #is_loaded()
It returns 0 when the plugins is not registered
let name = GetDummyName()
Assert Equals(denops#plugin#is_loaded(name), 0)
End
It returns 0 when the plugins is registered but not loaded
let name = GetDummyName()
call denops#plugin#register(name, s:dummy_script)
Assert Equals(denops#plugin#is_loaded(name), 0)
End
It returns 1 when the plugins is registered and loaded
let name = GetDummyName()
call denops#plugin#register(name, s:dummy_script)
call denops#plugin#wait(name)
Assert Equals(denops#plugin#is_loaded(name), 1)
End
It returns 0 on DenopsPluginPre:{plugin} autocmd
let name = GetDummyName()
silent! unlet! g:ret
execute printf(
\ 'au User DenopsPluginPre:%s ++once let g:ret = denops#plugin#is_loaded("%s")',
\ name,
\ name,
\)
call denops#plugin#register(name, s:dummy_script)
Assert Equals(Wait({ -> has_key(g:, 'ret') }), 0)
Assert Equals(g:ret, 0)
End
It returns 1 on DenopsPluginPost:{plugin} autocmd
let name = GetDummyName()
silent! unlet! g:ret
execute printf(
\ 'au User DenopsPluginPost:%s ++once let g:ret = denops#plugin#is_loaded("%s")',
\ name,
\ name,
\)
call denops#plugin#register(name, s:dummy_script)
Assert Equals(Wait({ -> has_key(g:, 'ret') }), 0)
Assert Equals(g:ret, 1)
End
End
End
let s:dummy_script = GetResourcePath('test', 'denops', 'testdata', 'dummy.ts')
Describe denops#plugin
# Setup and teardown for all test cases in this describe block
Before all
call denops#server#restart()
call denops#server#wait()
End
# Test cases for checking if a plugin is loaded
Describe #is_loaded()
# Test case when the plugin is not registered
It returns 0 when the plugins is not registered
let name = GetDummyName()
Assert Equals(denops#plugin#is_loaded(name), 0)
End
# Test case when the plugin is registered but not loaded
It returns 0 when the plugins is registered but not loaded
let name = GetDummyName()
call denops#plugin#register(name, s:dummy_script)
Assert Equals(denops#plugin#is_loaded(name), 0)
End
# Test case when the plugin is registered and loaded
It returns 1 when the plugins is registered and loaded
let name = GetDummyName()
call denops#plugin#register(name, s:dummy_script)
call denops#plugin#wait(name)
Assert Equals(denops#plugin#is_loaded(name), 1)
End
# Test case for DenopsPluginPre autocmd event
It returns 0 on DenopsPluginPre:{plugin} autocmd
let name = GetDummyName()
silent! unlet! g:ret
execute printf(
\ 'au User DenopsPluginPre:%s ++once let g:ret = denops#plugin#is_loaded("%s")',
\ name,
\ name,
\)
call denops#plugin#register(name, s:dummy_script)
Assert Equals(Wait({ -> has_key(g:, 'ret') }), 0)
Assert Equals(g:ret, 0)
End
# Test case for DenopsPluginPost autocmd event
It returns 1 on DenopsPluginPost:{plugin} autocmd
let name = GetDummyName()
silent! unlet! g:ret
execute printf(
\ 'au User DenopsPluginPost:%s ++once let g:ret = denops#plugin#is_loaded("%s")',
\ name,
\ name,
\)
call denops#plugin#register(name, s:dummy_script)
Assert Equals(Wait({ -> has_key(g:, 'ret') }), 0)
Assert Equals(g:ret, 1)
End
End
End

Comment on lines +1 to +117
- ".github/workflows/test.yml"
- "deno.jsonc"

defaults:
run:
shell: bash --noprofile --norc -eo pipefail {0}

jobs:
check:
strategy:
matrix:
runner:
- ubuntu-latest
version:
- "1.x"
runs-on: ${{ matrix.runner }}
steps:
- run: git config --global core.autocrlf false
if: runner.os == 'Windows'
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: "${{ matrix.version }}"
- name: Lint check
run: deno lint
- name: Format check
run: deno fmt --check
- name: Type check
run: deno task check

test:
strategy:
matrix:
runner:
- windows-latest
- macos-latest
- ubuntu-latest
version:
- "1.32.x"
- "1.x"
host_version:
- vim: "v9.0.1499"
nvim: "v0.8.0"
runs-on: ${{ matrix.runner }}
steps:
- run: git config --global core.autocrlf false
if: runner.os == 'Windows'
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: thinca/vim-themis
path: vim-themis
- uses: denoland/setup-deno@v1
with:
deno-version: "${{ matrix.version }}"
- uses: rhysd/action-setup-vim@v1
id: vim
with:
version: "${{ matrix.host_version.vim }}"
- name: Check Vim
run: |
echo ${DENOPS_TEST_VIM}
${DENOPS_TEST_VIM} --version
env:
DENOPS_TEST_VIM: ${{ steps.vim.outputs.executable }}
- uses: rhysd/action-setup-vim@v1
id: nvim
with:
neovim: true
version: "${{ matrix.host_version.nvim }}"
- name: Check Neovim
run: |
echo ${DENOPS_TEST_NVIM}
${DENOPS_TEST_NVIM} --version
env:
DENOPS_TEST_NVIM: ${{ steps.nvim.outputs.executable }}
- name: Test (Vim)
env:
CI: 1
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
# XXX:
# Overwrite %TMP% to point a correct temp directory.
# Note that %TMP% only affects value of 'tempname()' in Windows.
# https://github.community/t5/GitHub-Actions/TEMP-is-broken-on-Windows/m-p/30432#M427
TMP: 'C:\Users\runneradmin\AppData\Local\Temp'
run: |
./vim-themis/bin/themis
timeout-minutes: 5
- name: Test (Neovim)
env:
CI: 1
THEMIS_VIM: ${{ steps.nvim.outputs.executable }}
# XXX:
# Overwrite %TMP% to point a correct temp directory.
# Note that %TMP% only affects value of 'tempname()' in Windows.
# https://github.community/t5/GitHub-Actions/TEMP-is-broken-on-Windows/m-p/30432#M427
TMP: 'C:\Users\runneradmin\AppData\Local\Temp'
run: |
./vim-themis/bin/themis
timeout-minutes: 5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub Actions workflow is well-structured and covers a comprehensive set of triggers and testing jobs. Consider adding comments to explain the purpose of each job and step for future maintainability.

name: test_vim
+ # Define triggers for the workflow
on:
  schedule:
    - cron: "0 7 * * 0"
  push:
    paths:
      - "**.md"
      - "**.ts"
      - "**.vim"
      - ".github/workflows/test.yml"
      - "deno.jsonc"
  pull_request:
    paths:
      - "**.md"
      - "**.ts"
      - "**.vim"
      - ".github/workflows/test.yml"
      - "deno.jsonc"
+ # Define default settings for all jobs
defaults:
  run:
    shell: bash --noprofile --norc -eo pipefail {0}
+ # Define jobs for linting, formatting, and type checking
jobs:
  check:
    strategy:
      matrix:
        runner:
          - ubuntu-latest
        version:
          - "1.x"
    runs-on: ${{ matrix.runner }}
    steps:
      - run: git config --global core.autocrlf false
        if: runner.os == 'Windows'
      - uses: actions/checkout@v4
      - uses: denoland/setup-deno@v1
        with:
          deno-version: "${{ matrix.version }}"
      - name: Lint check
        run: deno lint
      - name: Format check
        run: deno fmt --check
      - name: Type check
        run: deno task check
+ # Define jobs for testing across different operating systems and Vim/Neovim versions
  test:
    strategy:
      matrix:
        runner:
          - windows-latest
          - macos-latest
          - ubuntu-latest
        version:
          - "1.32.x"
          - "1.x"
        host_version:
          - vim: "v9.0.1499"
            nvim: "v0.8.0"
    runs-on: ${{ matrix.runner }}
    steps:
      - run: git config --global core.autocrlf false
        if: runner.os == 'Windows'
      - uses: actions/checkout@v4
      - uses: actions/checkout@v4
        with:
          repository: thinca/vim-themis
          path: vim-themis
      - uses: denoland/setup-deno@v1
        with:
          deno-version: "${{ matrix.version }}"
      - uses: rhysd/action-setup-vim@v1
        id: vim
        with:
          version: "${{ matrix.host_version.vim }}"
      - name: Check Vim
        run: |
          echo ${DENOPS_TEST_VIM}
          ${DENOPS_TEST_VIM} --version
        env:
          DENOPS_TEST_VIM: ${{ steps.vim.outputs.executable }}
      - uses: rhysd/action-setup-vim@v1
        id: nvim
        with:
          neovim: true
          version: "${{ matrix.host_version.nvim }}"
      - name: Check Neovim
        run: |
          echo ${DENOPS_TEST_NVIM}
          ${DENOPS_TEST_NVIM} --version
        env:
          DENOPS_TEST_NVIM: ${{ steps.nvim.outputs.executable }}
      - name: Test (Vim)
        env:
          CI: 1
          THEMIS_VIM: ${{ steps.vim.outputs.executable }}
          # XXX:
          # Overwrite %TMP% to point a correct temp directory.
          # Note that %TMP% only affects value of 'tempname()' in Windows.
          # https://github.community/t5/GitHub-Actions/TEMP-is-broken-on-Windows/m-p/30432#M427
          TMP: 'C:\Users\runneradmin\AppData\Local\Temp'
        run: |
          ./vim-themis/bin/themis
        timeout-minutes: 5
      - name: Test (Neovim)
        env:
          CI: 1
          THEMIS_VIM: ${{ steps.nvim.outputs.executable }}
          # XXX:
          # Overwrite %TMP% to point a correct temp directory.
          # Note that %TMP% only affects value of 'tempname()' in Windows.
          # https://github.community/t5/GitHub-Actions/TEMP-is-broken-on-Windows/m-p/30432#M427
          TMP: 'C:\Users\runneradmin\AppData\Local\Temp'
        run: |
          ./vim-themis/bin/themis
        timeout-minutes: 5

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
name: test_vim
on:
schedule:
- cron: "0 7 * * 0"
push:
paths:
- "**.md"
- "**.ts"
- "**.vim"
- ".github/workflows/test.yml"
- "deno.jsonc"
pull_request:
paths:
- "**.md"
- "**.ts"
- "**.vim"
- ".github/workflows/test.yml"
- "deno.jsonc"
defaults:
run:
shell: bash --noprofile --norc -eo pipefail {0}
jobs:
check:
strategy:
matrix:
runner:
- ubuntu-latest
version:
- "1.x"
runs-on: ${{ matrix.runner }}
steps:
- run: git config --global core.autocrlf false
if: runner.os == 'Windows'
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: "${{ matrix.version }}"
- name: Lint check
run: deno lint
- name: Format check
run: deno fmt --check
- name: Type check
run: deno task check
test:
strategy:
matrix:
runner:
- windows-latest
- macos-latest
- ubuntu-latest
version:
- "1.32.x"
- "1.x"
host_version:
- vim: "v9.0.1499"
nvim: "v0.8.0"
runs-on: ${{ matrix.runner }}
steps:
- run: git config --global core.autocrlf false
if: runner.os == 'Windows'
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: thinca/vim-themis
path: vim-themis
- uses: denoland/setup-deno@v1
with:
deno-version: "${{ matrix.version }}"
- uses: rhysd/action-setup-vim@v1
id: vim
with:
version: "${{ matrix.host_version.vim }}"
- name: Check Vim
run: |
echo ${DENOPS_TEST_VIM}
${DENOPS_TEST_VIM} --version
env:
DENOPS_TEST_VIM: ${{ steps.vim.outputs.executable }}
- uses: rhysd/action-setup-vim@v1
id: nvim
with:
neovim: true
version: "${{ matrix.host_version.nvim }}"
- name: Check Neovim
run: |
echo ${DENOPS_TEST_NVIM}
${DENOPS_TEST_NVIM} --version
env:
DENOPS_TEST_NVIM: ${{ steps.nvim.outputs.executable }}
- name: Test (Vim)
env:
CI: 1
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
# XXX:
# Overwrite %TMP% to point a correct temp directory.
# Note that %TMP% only affects value of 'tempname()' in Windows.
# https://github.community/t5/GitHub-Actions/TEMP-is-broken-on-Windows/m-p/30432#M427
TMP: 'C:\Users\runneradmin\AppData\Local\Temp'
run: |
./vim-themis/bin/themis
timeout-minutes: 5
- name: Test (Neovim)
env:
CI: 1
THEMIS_VIM: ${{ steps.nvim.outputs.executable }}
# XXX:
# Overwrite %TMP% to point a correct temp directory.
# Note that %TMP% only affects value of 'tempname()' in Windows.
# https://github.community/t5/GitHub-Actions/TEMP-is-broken-on-Windows/m-p/30432#M427
TMP: 'C:\Users\runneradmin\AppData\Local\Temp'
run: |
./vim-themis/bin/themis
timeout-minutes: 5
name: test_vim
# Define triggers for the workflow
on:
schedule:
- cron: "0 7 * * 0"
push:
paths:
- "**.md"
- "**.ts"
- "**.vim"
- ".github/workflows/test.yml"
- "deno.jsonc"
pull_request:
paths:
- "**.md"
- "**.ts"
- "**.vim"
- ".github/workflows/test.yml"
- "deno.jsonc"
# Define default settings for all jobs
defaults:
run:
shell: bash --noprofile --norc -eo pipefail {0}
# Define jobs for linting, formatting, and type checking
jobs:
check:
strategy:
matrix:
runner:
- ubuntu-latest
version:
- "1.x"
runs-on: ${{ matrix.runner }}
steps:
- run: git config --global core.autocrlf false
if: runner.os == 'Windows'
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: "${{ matrix.version }}"
- name: Lint check
run: deno lint
- name: Format check
run: deno fmt --check
- name: Type check
run: deno task check
# Define jobs for testing across different operating systems and Vim/Neovim versions
test:
strategy:
matrix:
runner:
- windows-latest
- macos-latest
- ubuntu-latest
version:
- "1.32.x"
- "1.x"
host_version:
- vim: "v9.0.1499"
nvim: "v0.8.0"
runs-on: ${{ matrix.runner }}
steps:
- run: git config --global core.autocrlf false
if: runner.os == 'Windows'
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: thinca/vim-themis
path: vim-themis
- uses: denoland/setup-deno@v1
with:
deno-version: "${{ matrix.version }}"
- uses: rhysd/action-setup-vim@v1
id: vim
with:
version: "${{ matrix.host_version.vim }}"
- name: Check Vim
run: |
echo ${DENOPS_TEST_VIM}
${DENOPS_TEST_VIM} --version
env:
DENOPS_TEST_VIM: ${{ steps.vim.outputs.executable }}
- uses: rhysd/action-setup-vim@v1
id: nvim
with:
neovim: true
version: "${{ matrix.host_version.nvim }}"
- name: Check Neovim
run: |
echo ${DENOPS_TEST_NVIM}
${DENOPS_TEST_NVIM} --version
env:
DENOPS_TEST_NVIM: ${{ steps.nvim.outputs.executable }}
- name: Test (Vim)
env:
CI: 1
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
# XXX:
# Overwrite %TMP% to point a correct temp directory.
# Note that %TMP% only affects value of 'tempname()' in Windows.
# https://github.community/t5/GitHub-Actions/TEMP-is-broken-on-Windows/m-p/30432#M427
TMP: 'C:\Users\runneradmin\AppData\Local\Temp'
run: |
./vim-themis/bin/themis
timeout-minutes: 5
- name: Test (Neovim)
env:
CI: 1
THEMIS_VIM: ${{ steps.nvim.outputs.executable }}
# XXX:
# Overwrite %TMP% to point a correct temp directory.
# Note that %TMP% only affects value of 'tempname()' in Windows.
# https://github.community/t5/GitHub-Actions/TEMP-is-broken-on-Windows/m-p/30432#M427
TMP: 'C:\Users\runneradmin\AppData\Local\Temp'
run: |
./vim-themis/bin/themis
timeout-minutes: 5

@lambdalisue
Copy link
Member Author

Too fragile..

@lambdalisue lambdalisue closed this Jan 9, 2024
@lambdalisue lambdalisue deleted the add-is_loaded-test branch January 9, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant