From 717f06c0ae8a65aa4bb25e14ce4e55a2a099988c Mon Sep 17 00:00:00 2001 From: Marco Kellershoff Date: Sat, 7 Sep 2024 13:54:40 +0200 Subject: [PATCH] try custom image for tests --- .github/workflows/tests.yml | 13 ++++++------- scripts/tests.sh | 14 +++++--------- tests/_dockerfiles/ubuntu/Dockerfile | 5 +++++ 3 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 tests/_dockerfiles/ubuntu/Dockerfile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7c1baf4..c03bbf4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/scripts/tests.sh b/scripts/tests.sh index d1589e7..f8b4f02 100755 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -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 \ @@ -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) diff --git a/tests/_dockerfiles/ubuntu/Dockerfile b/tests/_dockerfiles/ubuntu/Dockerfile new file mode 100644 index 0000000..57bfbb4 --- /dev/null +++ b/tests/_dockerfiles/ubuntu/Dockerfile @@ -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