Skip to content

Commit

Permalink
try custom image for tests (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
gorillamoe authored Sep 7, 2024
1 parent 6458b8c commit f5abf3c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
rev: v0.10.0/nvim.appimage
- os: ubuntu-latest
container-image: ghcr.io/mistweaverco/kulala-nvim-testrunner:latest
container:
image: ${{ matrix.container-image }}
steps:
- uses: actions/checkout@v4
- name: Restore cache
uses: actions/cache@v4
with:
path: |
_neovim
~/.local/share/nvim/site/pack/vendor/start
key: ${{ runner.os }}-${{ matrix.rev }}
key: ${{ runner.os }}-${{ matrix.container-image }}

- name: Prepare dependencies
run: | # TODO: Cache apt dependencies
sudo apt-get update && sudo apt-get install -y libfuse2
./scripts/tests.sh prepare ${{ matrix.rev }}
run: ./scripts/tests.sh prepare

- name: Run tests
run: ./scripts/tests.sh run
14 changes: 5 additions & 9 deletions scripts/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
# Copy from MIT licensed neotest plugin:
# https://github.com/nvim-neotest/neotest/blob/958a6bff41c7086fe8b46f7f320d0fd073cfc6a0/scripts/test

NVIM_DL_BASE="https://github.com/neovim/neovim/releases/download/"

prepare() {
local version=$1

if [[ ! -f _neovim/nvim ]] && [[ -n $version ]]; then
mkdir -p _neovim && curl -sL -o _neovim/nvim "${NVIM_DL_BASE}${version}" && chmod +x _neovim/nvim
_neovim/nvim --headless -c 'TSInstallSync lua | quit'
if [[ ! -d ~/.local/share/nvim/site/pack/vendor/start/nvim-treesitter ]]; then
git clone --depth 1 \
https://github.com/nvim-treesitter/nvim-treesitter \
~/.local/share/nvim/site/pack/vendor/start/nvim-treesitter
fi
if [[ ! -d ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim ]]; then
git clone --depth 1 \
Expand All @@ -20,11 +17,10 @@ prepare() {
if [[ ! -d ~/.local/share/nvim/site/pack/vendor/start/kulala.nvim ]]; then
ln -s "$(pwd)" ~/.local/share/nvim/site/pack/vendor/start
fi
nvim --headless -c 'TSUpdate | TSInstallSync lua | quit'
}

run() {
type _neovim/nvim && nvim() { _neovim/nvim "$@"; }

local tempfile
tempfile=$(mktemp)

Expand Down
5 changes: 5 additions & 0 deletions tests/_dockerfiles/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ubuntu:latest

RUN apt-get update && apt-get upgrade -y && apt-get install -y curl git gcc
RUN mkdir -p _neovim && curl -sL https://github.com/neovim/neovim/releases/download/v0.10.1/nvim-linux64.tar.gz | tar -xz -C _neovim && mv _neovim/nvim-linux64 /usr/local/nvim && rm -rf _neovim
RUN ln -s /usr/local/nvim/bin/nvim /usr/bin/nvim

0 comments on commit f5abf3c

Please sign in to comment.