ci: improve sandboxing of tests

This commit is contained in:
Steven Arcangeli 2022-11-09 01:35:29 +00:00
parent 12b808a686
commit 2319ee2397
5 changed files with 26 additions and 12 deletions

View File

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
set -e
PLUGINS="$HOME/.local/share/nvim/site/pack/plugins/start" PLUGINS="$HOME/.local/share/nvim/site/pack/plugins/start"
mkdir -p "$PLUGINS" mkdir -p "$PLUGINS"
wget https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/nvim.appimage wget https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/nvim.appimage
chmod +x nvim.appimage chmod +x nvim.appimage
sudo mv ./nvim.appimage /usr/bin/nvim sudo mv ./nvim.appimage /usr/bin/nvim
git clone --depth=1 https://github.com/nvim-lua/plenary.nvim.git "$PLUGINS/plenary.nvim"

View File

@ -1,15 +1,11 @@
name: Run tests name: Run tests
on: on: [push, pull_request]
push:
branches:
- master
pull_request: ~
jobs: jobs:
luacheck: luacheck:
name: Luacheck name: Luacheck
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
@ -25,7 +21,7 @@ jobs:
stylua: stylua:
name: StyLua name: StyLua
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Stylua - name: Stylua
@ -38,10 +34,10 @@ jobs:
run_tests: run_tests:
strategy: strategy:
matrix: matrix:
nvim_tag: [v0.7.0, v0.7.2] nvim_tag: [v0.7.0, v0.7.2, v0.8.0]
name: Run tests name: Run tests
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
env: env:
NVIM_TAG: ${{ matrix.nvim_tag }} NVIM_TAG: ${{ matrix.nvim_tag }}
steps: steps:

1
.gitignore vendored
View File

@ -39,3 +39,4 @@ luac.out
*.x86_64 *.x86_64
*.hex *.hex
.testenv/

View File

@ -1,5 +1,22 @@
#!/bin/bash #!/bin/bash
set -e set -e
nvim --headless --noplugin -u tests/init.lua \ mkdir -p ".testenv/config/nvim"
-c "PlenaryBustedDirectory ${1-tests} { minimal_init = './tests/init.lua' }" mkdir -p ".testenv/data/nvim"
mkdir -p ".testenv/state/nvim"
mkdir -p ".testenv/run/nvim"
mkdir -p ".testenv/cache/nvim"
PLUGINS=".testenv/data/nvim/site/pack/plugins/start"
if [ ! -e "$PLUGINS/plenary.nvim" ]; then
git clone --depth=1 https://github.com/nvim-lua/plenary.nvim.git "$PLUGINS/plenary.nvim"
fi
XDG_CONFIG_HOME=".testenv/config" \
XDG_DATA_HOME=".testenv/data" \
XDG_STATE_HOME=".testenv/state" \
XDG_RUNTIME_DIR=".testenv/run" \
XDG_CACHE_HOME=".testenv/cache" \
nvim --headless -u tests/minimal_init.lua \
-c "PlenaryBustedDirectory ${1-tests} { minimal_init = './tests/minimal_init.lua' }"
echo "Success"