|
14 | 14 | - "**/*.lua"
|
15 | 15 |
|
16 | 16 | jobs:
|
17 |
| - run_tests: |
18 |
| - name: unit tests |
19 |
| - runs-on: ${{ matrix.os }} |
20 |
| - strategy: |
21 |
| - fail-fast: false |
22 |
| - matrix: |
23 |
| - include: |
24 |
| - - os: ubuntu-22.04 |
25 |
| - rev: v0.10.0/nvim-linux64.tar.gz |
26 |
| - steps: |
27 |
| - - uses: actions/checkout@v3 |
28 |
| - |
29 |
| - - run: date +%F > todays-date |
30 |
| - |
31 |
| - - name: Restore cache for today's nightly |
32 |
| - uses: actions/cache@v3 |
33 |
| - with: |
34 |
| - path: _neovim |
35 |
| - key: ${{ runner.os }}-${{ matrix.rev }}-${{ hashFiles('todays-date') }} |
36 |
| - |
37 |
| - - name: Prepare |
38 |
| - run: | |
39 |
| - test -d _neovim || { |
40 |
| - mkdir -p _neovim |
41 |
| - curl -sL "https://github.com/neovim/neovim/releases/download/${{ matrix.rev }}" | tar xzf - --strip-components=1 -C "${PWD}/_neovim" |
42 |
| - } |
43 |
| -
|
44 |
| - - name: Create minimal init.lua |
45 |
| - run: | |
46 |
| - mkdir -p tests |
47 |
| - cat > tests/minimal_init.lua << 'EOF' |
48 |
| - local plenary_dir = os.getenv('PLENARY_DIR') or '/home/runner/.local/share/nvim/site/pack/vendor/start/plenary.nvim' |
49 |
| - local is_windows = vim.loop.os_uname().sysname == "Windows_NT" |
50 |
| - local base_dir = vim.loop.cwd() |
51 |
| -
|
52 |
| - if not vim.inspect then |
53 |
| - vim.inspect = require("vim.inspect") |
54 |
| - end |
55 |
| -
|
56 |
| - vim.cmd('set rtp+=' .. plenary_dir) |
57 |
| - vim.cmd('set rtp+=' .. base_dir) |
58 |
| - vim.cmd('runtime plugin/plenary.vim') |
59 |
| - vim.cmd('runtime plugin/cargo.lua') |
60 |
| -
|
61 |
| - local function join_paths(...) |
62 |
| - local result = table.concat({ ... }, '/') |
63 |
| - return is_windows and result:gsub('/', '\\') or result |
64 |
| - end |
65 |
| -
|
66 |
| - local function normalize_path(path) |
67 |
| - return is_windows and path:gsub('\\', '/') or path |
68 |
| - end |
69 |
| -
|
70 |
| - local lua_path = join_paths(base_dir, 'lua') |
71 |
| - package.path = normalize_path(lua_path) .. '/?.lua;' .. normalize_path(lua_path) .. '/?/init.lua;' .. package.path |
72 |
| -
|
73 |
| - require('plenary.busted') |
74 |
| - EOF |
75 |
| -
|
76 |
| - - name: Run tests |
77 |
| - run: | |
78 |
| - export PATH="${PWD}/_neovim/bin:${PATH}" |
79 |
| - export VIM="${PWD}/_neovim/share/nvim/runtime" |
80 |
| - git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim |
81 |
| - nvim --version |
82 |
| - nvim --headless --noplugin -u tests/minimal_init.lua -c "PlenaryBustedDirectory tests/ { minimal_init = './tests/minimal_init.lua' }" |
83 |
| -
|
84 | 17 | stylua:
|
85 | 18 | name: Check Lua style
|
86 | 19 | runs-on: ubuntu-latest
|
|
0 commit comments