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

Reinstate CI and testing #33

Merged
merged 6 commits into from
Oct 11, 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
149 changes: 149 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: main

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize]

env:
LUA_LS_VERSION: 3.7.4

concurrency:
group: github.head_ref
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
name: lint
steps:
- uses: actions/checkout@v4

- uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check . -g '*.lua' -g '!deps/'

documentation:
runs-on: ubuntu-latest
name: documentation
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: setup neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: v0.10.1

- name: generate documentation
run: make documentation-ci

- name: check docs diff
run: exit $(git status --porcelain doc | wc -l | tr -d " ")

tests:
needs:
- lint
- documentation
runs-on: ubuntu-latest
strategy:
matrix:
neovim_version: ['v0.9.5', 'v0.10.1']

steps:
- uses: actions/checkout@v4

- run: date +%F > todays-date

- name: restore cache for today's nightly.
uses: actions/cache@v4
with:
path: _neovim
key: ${{ runner.os }}-x64-${{ hashFiles('todays-date') }}

- name: restore luals cache
uses: actions/cache@v4
id: cache
with:
path: .ci/lua-ls
key: ${{ env.LUA_LS_VERSION }}

- name: setup luals
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: mkdir -p .ci/lua-ls && curl -sL "https://github.com/LuaLS/lua-language-server/releases/download/${{ env.LUA_LS_VERSION }}/lua-language-server-${{ env.LUA_LS_VERSION }}-linux-x64.tar.gz" | tar xzf - -C "${PWD}/.ci/lua-ls"

- name: setup neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: ${{ matrix.neovim_version }}

- uses: cachix/install-nix-action@v25
- uses: cachix/cachix-action@v14
with:
name: forester
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'

- run: nix profile install sourcehut:~jonsterling/ocaml-forester

- name: run tests
run: make test-ci

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')

tests-nightly:
needs:
- lint
- documentation
runs-on: ubuntu-latest
continue-on-error: true

steps:
- uses: actions/checkout@v4

- run: date +%F > todays-date

- name: restore cache for today's nightly.
uses: actions/cache@v4
with:
path: _neovim
key: ${{ runner.os }}-x64-${{ hashFiles('todays-date') }}

- name: restore luals cache
uses: actions/cache@v4
id: cache
with:
path: .ci/lua-ls
key: ${{ env.LUA_LS_VERSION }}

- name: setup luals
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: mkdir -p .ci/lua-ls && curl -sL "https://github.com/LuaLS/lua-language-server/releases/download/${{ env.LUA_LS_VERSION }}/lua-language-server-${{ env.LUA_LS_VERSION }}-linux-x64.tar.gz" | tar xzf - -C "${PWD}/.ci/lua-ls"

- name: setup neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: nightly

- uses: cachix/install-nix-action@v25
- uses: cachix/cachix-action@v14
with:
name: forester
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'

- run: nix profile install sourcehut:~jonsterling/ocaml-forester

- name: run tests
run: make test-ci

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
deps
forest.json
forest.toml
build/
Expand Down
40 changes: 17 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
.PHONY: test lint docs init
# Run all test files
test: deps/mini.nvim
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua MiniTest.run()"

TESTS_DIR := test/
PLUGIN_DIR := lua/
# Run test from file at `$FILE` environment variable
test_file: deps/mini.nvim
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua MiniTest.run_file('$(FILE)')"

DOC_GEN_SCRIPT := ./scripts/docs.lua
MINIMAL_INIT := ./scripts/minimal_init.lua
# Download 'mini.nvim' to use its 'mini.test' testing module
deps:
@mkdir -p deps
git clone --filter=blob:none https://github.com/echasnovski/mini.nvim $@/mini.nvim
git clone --filter=blob:none https://github.com/nvim-lua/plenary.nvim $@/plenary.nvim
git clone --filter=blob:none https://github.com/nvim-telescope/telescope.nvim $@/telescope.nvim
git clone --filter=blob:none https://github.com/nvim-treesitter/nvim-treesitter $@/nvim-treesitter

test:
nvim --headless --noplugin -u ${MINIMAL_INIT} \
-c "PlenaryBustedDirectory ${TESTS_DIR} { minimal_init = '${MINIMAL_INIT}' }"
documentation:
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "luafile scripts/minidoc.lua" -c "qa!"

lint:
luacheck ${PLUGIN_DIR}
documentation-ci: deps documentation

docs:
nvim --headless --noplugin -u ${MINIMAL_INIT} \
-c "luafile ${DOC_GEN_SCRIPT}" -c 'qa'

init:
@nvim --headless --noplugin \
-c "vimgrep /my_awesome_plugin/gj **/*.lua **/*.vim Makefile" \
-c "cfdo %s/my_awesome_plugin/$(name)/ge | update" \
-c "qa"
@find . -depth -type d -name '*my_awesome_plugin*' | \
while read dir; do mv "$$dir" "$${dir//my_awesome_plugin/$(name)}"; done
@find . -type f -name '*my_awesome_plugin*' | \
while read file; do mv "$$file" "$${file//my_awesome_plugin/$(name)}"; done
test-ci: deps test
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# 🌲 forester.nvim 🌲

[![main](https://github.com/kentookura/forester.nvim/actions/workflows/main.yml/badge.svg)](https://github.com/kentookura/forester.nvim/actions/workflows/main.yml)

Filetype plugin for [forester](https://sr.ht/~jonsterling/forester/), a tool
for writing mathematical hypertext

# Features

- Tree-sitter syntax highlighting
- Tree-sitter syntax highlighting.
Please report any issues with the grammar in the [relevant repository](https://github.com/kentookura/tree-sitter-forester)
- following links and transclusions with `gf`
- Searching for trees by title with [telescope](https://github.com/nvim-telescope/telescope.nvim)
Expand Down
52 changes: 0 additions & 52 deletions doc/demo.tree

This file was deleted.

109 changes: 0 additions & 109 deletions doc/forester.nvim.txt

This file was deleted.

Loading