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

feat(ci): use custom image for tests #218

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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