chore: overhaul CI (#565)
* run tests on multiple versions of neovim * run docgen & formating in pr * chore: small fixes in docs.
This commit is contained in:
parent
dc31077bc5
commit
247aafd7fc
|
@ -0,0 +1,43 @@
|
|||
name: autogen
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "lua/**.lua"
|
||||
- "examples/**.lua"
|
||||
- ".stylua.toml"
|
||||
- "README.md"
|
||||
|
||||
# Cancel any in-progress CI runs for a PR if it is updated
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
autogen:
|
||||
name: "(vimdoc|formating)"
|
||||
runs-on: ubuntu-20.04
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Generate docs with panvimdoc
|
||||
uses: kdheepak/panvimdoc@v2.7.1
|
||||
with:
|
||||
vimdoc: lualine
|
||||
description: fast and easy to configure statusline plugin for neovim
|
||||
- name: Apply stylua
|
||||
uses: JohnnyMorganz/stylua-action@1.0.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --config-path=.stylua.toml lua/ examples/
|
||||
version: 0.12.0
|
||||
- name: Push changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_user_name: github-actions[bot]
|
||||
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
|
||||
commit_message: "chore: autogen (vimdocs+formating)"
|
||||
branch: ${{ github.head_ref }}
|
||||
file_pattern: lua/ examples/ doc/lualine.txt
|
|
@ -4,52 +4,62 @@ on:
|
|||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
# Cancel any in-progress CI runs for a PR if it is updated
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
|
||||
jobs:
|
||||
appimage-ubuntu:
|
||||
name: ubuntu
|
||||
runs-on: ubuntu-latest
|
||||
tests:
|
||||
name: ${{ matrix.os }} ${{ matrix.flavor }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- flavor: nvim-0.5
|
||||
runner: ubuntu-20.04
|
||||
os: linux
|
||||
nvim_version: v0.5.0
|
||||
- flavor: nvim-0.6
|
||||
runner: ubuntu-20.04
|
||||
os: linux
|
||||
nvim_version: v0.6.0
|
||||
- flavor: nvim-nightly
|
||||
runner: ubuntu-20.04
|
||||
os: linux
|
||||
nvim_version: nightly
|
||||
runs-on: ${{ matrix.runner }}
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Test Environment
|
||||
run: |
|
||||
date +%F > todays-date
|
||||
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
|
||||
git clone --depth 1 https://github.com/kyazdani42/nvim-web-devicons ~/.local/share/nvim/site/pack/vendor/start/nvim-web-devicons
|
||||
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
|
||||
- name: Get neovim v0.5.0
|
||||
uses: actions/cache@v2
|
||||
mkdir -p ./tmp_home/nvim/pack/vendor/start
|
||||
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ./tmp_home/nvim/pack/vendor/start/plenary.nvim
|
||||
git clone --depth 1 https://github.com/kyazdani42/nvim-web-devicons ./tmp_home/nvim/pack/vendor/start/nvim-web-devicons
|
||||
ln -s $(pwd) ./tmp_home/nvim/pack/vendor/start
|
||||
- name: Setup neovim ${{matrix.nvim_version}}
|
||||
uses: rhysd/action-setup-vim@v1
|
||||
with:
|
||||
path: |
|
||||
build/neovim/v0.5.0
|
||||
key: ${{ runner.os }}-appimage-0.5
|
||||
- name: Run Test on neovim v0.5.0
|
||||
neovim: true
|
||||
version: ${{matrix.nvim_version}}
|
||||
- name: Run tests
|
||||
run: |
|
||||
test -d build/neovim/v0.5.0 || {
|
||||
mkdir -p build/neovim/v0.5.0
|
||||
curl -Lo build/neovim/v0.5.0/nvim https://github.com/neovim/neovim/releases/download/v0.5.0/nvim.appimage
|
||||
chmod +x build/neovim/v0.5.0/nvim
|
||||
}
|
||||
build/neovim/v0.5.0/nvim --headless -u lua/tests/minimal_init.lua -c "PlenaryBustedDirectory lua/tests/ { minimal_init = './lua/tests/minimal_init.lua' }"
|
||||
# - name: Get neovim nightly
|
||||
# uses: actions/cache@v2
|
||||
# with:
|
||||
# path: |
|
||||
# build/neovim/nightly
|
||||
# key: ${{ runner.os }}-appimage-${{ hashFiles('todays-date') }}
|
||||
# - name: Run Test on neovim nightly
|
||||
# run: |
|
||||
# test -d build/neovim/nightly || {
|
||||
# mkdir -p build/neovim/nightly
|
||||
# curl -Lo build/neovim/nightly/nvim https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage
|
||||
# chmod +x build/neovim/nightly/nvim
|
||||
# }
|
||||
# build/neovim/nightly/nvim --headless -u lua/tests/minimal_init.lua -c "PlenaryBustedDirectory lua/tests/ { minimal_init = './lua/tests/minimal_init.lua' }"
|
||||
- name: Lint
|
||||
make test
|
||||
lint:
|
||||
runs-on: ubuntu-20.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup linters
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install luarocks
|
||||
sudo luarocks install luacheck
|
||||
- name: Run luacheck
|
||||
run: |
|
||||
luacheck lua/
|
||||
luacheck examples/
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
name: panvimdoc
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- README.md
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: markdown to vimdoc
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup git
|
||||
run: |
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
printf 'VIMDOC_BRANCH=bot/vimdoc/%s\n' ${GITHUB_REF#refs/heads/} >> $GITHUB_ENV
|
||||
- name: Checkout to vimdoc branch
|
||||
run: git checkout -b ${VIMDOC_BRANCH}
|
||||
- name: panvimdoc
|
||||
uses: kdheepak/panvimdoc@v2.7.1
|
||||
with:
|
||||
vimdoc: lualine
|
||||
description: fast and easy to configure statusline plugin for neovim
|
||||
- name: Create PR
|
||||
run: |
|
||||
if ! [[ -z $(git status -s) ]]; then
|
||||
git add doc/lualine.txt
|
||||
git commit -m "chore: generated vimdoc"
|
||||
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VIMDOC_BRANCH}
|
||||
gh pr create --fill --base ${GITHUB_REF#refs/heads/} --head ${VIMDOC_BRANCH} || true
|
||||
fi
|
|
@ -1,39 +0,0 @@
|
|||
name: formatting
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "lua/**.lua"
|
||||
- "examples/**.lua"
|
||||
branches: ["master"]
|
||||
|
||||
jobs:
|
||||
stylua:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
STYLUA_VERSION: 0.10.1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup git
|
||||
run: |
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
printf 'STYLE_BRANCH=bot/style/%s\n' ${GITHUB_REF#refs/heads/} >> $GITHUB_ENV
|
||||
- name: Apply stylua
|
||||
run: |
|
||||
git checkout -b ${STYLE_BRANCH}
|
||||
curl -Lo /tmp/stylua.zip https://github.com/JohnnyMorganz/StyLua/releases/download/v${STYLUA_VERSION}/stylua-${STYLUA_VERSION}-linux.zip
|
||||
unzip -d /tmp/ /tmp/stylua.zip
|
||||
chmod +x /tmp/stylua
|
||||
/tmp/stylua --config-path=.stylua.toml lua/ examples/
|
||||
- name: Create PR
|
||||
run: |
|
||||
if ! [[ -z $(git status -s) ]]; then
|
||||
git add -u
|
||||
git commit -m "chore: formated with stylua"
|
||||
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${STYLE_BRANCH}
|
||||
gh pr create --fill --base ${GITHUB_REF#refs/heads/} --head ${STYLE_BRANCH} || true
|
||||
fi
|
11
Makefile
11
Makefile
|
@ -12,16 +12,17 @@ test:
|
|||
@mkdir -p tmp_home
|
||||
@export XDG_DATA_HOME='./tmp_home' && \
|
||||
export XDG_CONFIG_HOME='./tmp_home' && \
|
||||
nvim --headless --noplugin --clean -u lua/tests/minimal_init.lua -c "lua require'plenary.test_harness'.test_directory( 'lua/tests/', { minimal_init = './lua/tests/minimal_init.lua' })"
|
||||
nvim --headless -u lua/tests/minimal_init.lua -c "lua require'plenary.test_harness'.test_directory( 'lua/tests/', { minimal_init = './lua/tests/minimal_init.lua' })" -c "qa!"
|
||||
@rm -rf tmp_home
|
||||
|
||||
# Install luacov & luacov-console from luarocks
|
||||
testcov:
|
||||
@mkdir -p tmp_home
|
||||
@export XDG_DATA_HOME='./tmp_home' && \
|
||||
export XDG_CONFIG_HOME='./tmp_home' && \
|
||||
@mkdir -p ./tmp_home/data/nvim
|
||||
@mkdir -p ./tmp_home/config/nvim
|
||||
@export XDG_DATA_HOME=$(realpath './tmp_home/data') && \
|
||||
export XDG_CONFIG_HOME=$(realpath './tmp_home/config') && \
|
||||
export TEST_COV=true && \
|
||||
nvim --headless --noplugin --clean -u lua/tests/minimal_init.lua -c "lua require'plenary.test_harness'.test_directory( 'lua/tests/', { minimal_init = './lua/tests/minimal_init.lua' })"
|
||||
nvim --headless -u lua/tests/minimal_init.lua -c "lua require'plenary.test_harness'.test_directory( 'lua/tests/', { minimal_init = './lua/tests/minimal_init.lua' })" -c "qa!"
|
||||
@luacov-console lua/
|
||||
@luacov-console -s
|
||||
ifeq ($(NOCLEAN), )
|
||||
|
|
|
@ -660,8 +660,8 @@ extensions = {'quickfix'}
|
|||
- nerdtree
|
||||
- nvim-tree
|
||||
- quickfix
|
||||
- toggleterm
|
||||
- symbols-outline
|
||||
- toggleterm
|
||||
|
||||
#### Custom extensions
|
||||
|
||||
|
|
|
@ -694,8 +694,8 @@ extensions with:
|
|||
- nerdtree
|
||||
- nvim-tree
|
||||
- quickfix
|
||||
- toggleterm
|
||||
- symbols-outline
|
||||
- toggleterm
|
||||
|
||||
|
||||
*lualine-Custom-extensions*
|
||||
|
|
Loading…
Reference in New Issue