Skip to content

Commit 7952bfd

Browse files
committed
DRAFT: Reinstall testing and CI
1 parent 4728a26 commit 7952bfd

27 files changed

+417
-612
lines changed

.github/workflows/main.yml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
types: [opened, synchronize]
8+
9+
env:
10+
LUA_LS_VERSION: 3.7.4
11+
12+
concurrency:
13+
group: github.head_ref
14+
cancel-in-progress: true
15+
16+
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
name: lint
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: JohnnyMorganz/stylua-action@v4
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
version: latest
27+
args: --check . -g '*.lua' -g '!deps/'
28+
29+
documentation:
30+
runs-on: ubuntu-latest
31+
name: documentation
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 2
36+
37+
- name: setup neovim
38+
uses: rhysd/action-setup-vim@v1
39+
with:
40+
neovim: true
41+
version: v0.10.1
42+
43+
- name: generate documentation
44+
run: make documentation-ci
45+
46+
- name: check docs diff
47+
run: exit $(git status --porcelain doc | wc -l | tr -d " ")
48+
49+
tests:
50+
needs:
51+
- lint
52+
- documentation
53+
runs-on: ubuntu-latest
54+
strategy:
55+
matrix:
56+
neovim_version: ['v0.9.5', 'v0.10.1']
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- run: date +%F > todays-date
62+
63+
- name: restore cache for today's nightly.
64+
uses: actions/cache@v4
65+
with:
66+
path: _neovim
67+
key: ${{ runner.os }}-x64-${{ hashFiles('todays-date') }}
68+
69+
- name: restore luals cache
70+
uses: actions/cache@v4
71+
id: cache
72+
with:
73+
path: .ci/lua-ls
74+
key: ${{ env.LUA_LS_VERSION }}
75+
76+
- name: setup luals
77+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
78+
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"
79+
80+
- name: setup neovim
81+
uses: rhysd/action-setup-vim@v1
82+
with:
83+
neovim: true
84+
version: ${{ matrix.neovim_version }}
85+
86+
- uses: cachix/install-nix-action@v25
87+
- uses: cachix/cachix-action@v14
88+
with:
89+
name: forester
90+
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
91+
92+
- run: nix profile install sourcehut:~jonsterling/ocaml-forester
93+
94+
- name: run tests
95+
run: make test-ci
96+
97+
tests-nightly:
98+
needs:
99+
- lint
100+
- documentation
101+
runs-on: ubuntu-latest
102+
continue-on-error: true
103+
104+
steps:
105+
- uses: actions/checkout@v4
106+
107+
- run: date +%F > todays-date
108+
109+
- name: restore cache for today's nightly.
110+
uses: actions/cache@v4
111+
with:
112+
path: _neovim
113+
key: ${{ runner.os }}-x64-${{ hashFiles('todays-date') }}
114+
115+
- name: restore luals cache
116+
uses: actions/cache@v4
117+
id: cache
118+
with:
119+
path: .ci/lua-ls
120+
key: ${{ env.LUA_LS_VERSION }}
121+
122+
- name: setup luals
123+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
124+
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"
125+
126+
- name: setup neovim
127+
uses: rhysd/action-setup-vim@v1
128+
with:
129+
neovim: true
130+
version: nightly
131+
132+
- uses: cachix/install-nix-action@v25
133+
- uses: cachix/cachix-action@v14
134+
with:
135+
name: forester
136+
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
137+
138+
- run: nix profile install sourcehut:~jonsterling/ocaml-forester
139+
140+
- name: run tests
141+
run: make test-ci
142+
143+
release:
144+
name: release
145+
if: ${{ github.ref == 'refs/heads/main' }}
146+
needs:
147+
- tests
148+
runs-on: ubuntu-latest
149+
steps:
150+
- uses: actions/checkout@v4
151+
152+
- uses: googleapis/release-please-action@v4
153+
id: release
154+
with:
155+
release-type: simple
156+
package-name: no-neck-pain.nvim
157+
158+
- name: tag stable versions
159+
if: ${{ steps.release.outputs.release_created }}
160+
run: |
161+
git config user.name github-actions[bot]
162+
git config user.email github-actions[bot]@users.noreply.github.com
163+
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
164+
git tag -d stable || true
165+
git push origin :stable || true
166+
git tag -a stable -m "Last Stable Release"
167+
git push origin stable

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
deps
12
forest.json
23
forest.toml
34
build/

Makefile

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
1-
.PHONY: test lint docs init
1+
# Run all test files
2+
test: deps/mini.nvim
3+
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua MiniTest.run()"
24

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

6-
DOC_GEN_SCRIPT := ./scripts/docs.lua
7-
MINIMAL_INIT := ./scripts/minimal_init.lua
9+
# Download 'mini.nvim' to use its 'mini.test' testing module
10+
deps:
11+
@mkdir -p deps
12+
git clone --filter=blob:none https://github.com/echasnovski/mini.nvim $@/mini.nvim
13+
git clone --filter=blob:none https://github.com/nvim-lua/plenary.nvim $@/plenary.nvim
814

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

13-
lint:
14-
luacheck ${PLUGIN_DIR}
18+
documentation-ci: deps documentation
1519

16-
docs:
17-
nvim --headless --noplugin -u ${MINIMAL_INIT} \
18-
-c "luafile ${DOC_GEN_SCRIPT}" -c 'qa'
19-
20-
init:
21-
@nvim --headless --noplugin \
22-
-c "vimgrep /my_awesome_plugin/gj **/*.lua **/*.vim Makefile" \
23-
-c "cfdo %s/my_awesome_plugin/$(name)/ge | update" \
24-
-c "qa"
25-
@find . -depth -type d -name '*my_awesome_plugin*' | \
26-
while read dir; do mv "$$dir" "$${dir//my_awesome_plugin/$(name)}"; done
27-
@find . -type f -name '*my_awesome_plugin*' | \
28-
while read file; do mv "$$file" "$${file//my_awesome_plugin/$(name)}"; done
20+
test-ci: deps test

doc/demo.tree

Lines changed: 0 additions & 52 deletions
This file was deleted.

doc/forester.nvim.txt

Lines changed: 0 additions & 109 deletions
This file was deleted.

0 commit comments

Comments
 (0)