Skip to content
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
62 changes: 20 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,37 @@ on:
- main
pull_request: ~

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz
- os: ubuntu-latest
url: https://github.com/neovim/neovim/releases/download/v0.11.0/nvim-linux-x86_64.tar.gz
- os: ubuntu-latest
url: https://github.com/neovim/neovim/releases/download/v0.10.0/nvim-linux64.tar.gz
- os: ubuntu-latest
url: https://github.com/neovim/neovim/releases/download/v0.9.2/nvim-linux64.tar.gz
os: [ubuntu-latest]
nvim_tag: [nightly, v0.11.0, v0.10.0, v0.9.2]
name: ${{ matrix.os }} / ${{ matrix.nvim_tag }}
runs-on: ${{ matrix.os }}
env:
NVIM: ${{ matrix.os == 'windows-latest' && 'nvim-win64\\bin\\nvim.exe' || 'nvim' }}

steps:
- uses: actions/checkout@v5
- uses: tree-sitter/setup-action/cli@v2
- name: Checkout 📋
uses: actions/checkout@v6

- run: date +%F > todays-date
- name: Restore from todays cache
uses: actions/cache@v4
with:
path: _neovim
key: ${{ runner.os }}-${{ matrix.url }}-${{ hashFiles('todays-date') }}
- name: Install Tree-sitter 🌳
uses: tree-sitter/setup-action/cli@v2

- name: Prepare
- name: Prepare Neovim 🚧
env:
NVIM_TAG: ${{ matrix.nvim_tag }}
run: |
test -d _neovim || {
mkdir -p _neovim
curl -sL ${{ matrix.url }} | tar xzf - --strip-components=1 -C "${PWD}/_neovim"
}
mkdir -p ~/.local/share/nvim/site/pack/vendor/start
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
bash ./scripts/ci-install.sh

- name: Run tests
- name: Run tests 🧪
run: |
export PATH="${PWD}/_neovim/bin:${PATH}"
export VIM="${PWD}/_neovim/share/nvim/runtime"
nvim --version
$NVIM --version
make test

release:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
needs:
- tests
permissions:
contents: write
pull-requests: write
steps:
- uses: googleapis/release-please-action@v4
with:
release-type: simple
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- name: Release 📦
uses: googleapis/release-please-action@v4
with:
release-type: simple

55 changes: 55 additions & 0 deletions scripts/ci-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

# Ref: https://github.com/nvim-treesitter/nvim-treesitter/blob/main/scripts/ci-install.sh

set -e

NVIM_TAG=${NVIM_TAG-nightly}
NVIM_TAG_WITH_V=$NVIM_TAG
if [[ $NVIM_TAG_WITH_V != v* ]]; then
NVIM_TAG_WITH_V="v${NVIM_TAG_WITH_V}"
fi

download_release() {
local asset=$1
local url_base="https://github.com/neovim/neovim/releases/download"
local url_primary="${url_base}/${NVIM_TAG}/${asset}"
local url_fallback="${url_base}/${NVIM_TAG_WITH_V}/${asset}"

if command -v curl >/dev/null 2>&1; then
curl -fL "$url_primary" -o "$asset" || curl -fL "$url_fallback" -o "$asset"
else
wget "$url_primary" -O "$asset" || wget "$url_fallback" -O "$asset"
fi
}

download_release_first() {
local asset
for asset in "$@"; do
if download_release "$asset"; then
echo "$asset"
return 0
fi
done
return 1
}

os=$(uname -s)
if [[ $os == Linux ]]; then
archive=$(download_release_first "nvim-linux-x86_64.tar.gz" "nvim-linux64.tar.gz")
tar -zxf "$archive"
dir="${archive%.tar.gz}"
sudo ln -s "$PWD/$dir/bin/nvim" /usr/local/bin
rm -rf "$PWD/$dir/lib/nvim/parser"
elif [[ $os == Darwin ]]; then
RELEASE_NAME="nvim-macos-$(uname -m)"
archive=$(download_release_first "$RELEASE_NAME.tar.gz" "nvim-macos.tar.gz")
tar -zxf "$archive"
dir="${archive%.tar.gz}"
sudo ln -s "$PWD/$dir/bin/nvim" /usr/local/bin
rm -rf "$PWD/$dir/lib/nvim/parser"
else
archive=$(download_release_first "nvim-win64.zip")
unzip "$archive"
fi