From 247aafd7fc165be93c8e0929ad8274667a9eaa96 Mon Sep 17 00:00:00 2001 From: Shadman <13149513+shadmansaleh@users.noreply.github.com> Date: Tue, 1 Feb 2022 08:00:36 +0000 Subject: [PATCH] chore: overhaul CI (#565) * run tests on multiple versions of neovim * run docgen & formating in pr * chore: small fixes in docs. --- .github/workflows/autogen.yml | 43 ++++++++++++++++++ .github/workflows/ci.yml | 80 ++++++++++++++++++--------------- .github/workflows/docs.yml | 40 ----------------- .github/workflows/formating.yml | 39 ---------------- Makefile | 11 ++--- README.md | 4 +- doc/lualine.txt | 4 +- 7 files changed, 98 insertions(+), 123 deletions(-) create mode 100644 .github/workflows/autogen.yml delete mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/formating.yml diff --git a/.github/workflows/autogen.yml b/.github/workflows/autogen.yml new file mode 100644 index 0000000..c0913f3 --- /dev/null +++ b/.github/workflows/autogen.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e90af0..25d4c16 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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/ diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index bfd0884..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/formating.yml b/.github/workflows/formating.yml deleted file mode 100644 index b9f878b..0000000 --- a/.github/workflows/formating.yml +++ /dev/null @@ -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 diff --git a/Makefile b/Makefile index 860cc2b..06dcc84 100644 --- a/Makefile +++ b/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), ) diff --git a/README.md b/README.md index 696f3b7..e32d857 100644 --- a/README.md +++ b/README.md @@ -361,7 +361,7 @@ sections = { -- Passing an empty string disables the separator. -- -- These options can be used to set colored separators - -- around a component. + -- around a component. -- -- The options need to be set as such: -- separator = { left = '', right = ''} @@ -660,8 +660,8 @@ extensions = {'quickfix'} - nerdtree - nvim-tree - quickfix -- toggleterm - symbols-outline +- toggleterm #### Custom extensions diff --git a/doc/lualine.txt b/doc/lualine.txt index 7380c09..a8331f0 100644 --- a/doc/lualine.txt +++ b/doc/lualine.txt @@ -374,7 +374,7 @@ General component options These are options that control behavior -- Passing an empty string disables the separator. -- -- These options can be used to set colored separators - -- around a component. + -- around a component. -- -- The options need to be set as such: -- separator = { left = '', right = ''} @@ -694,8 +694,8 @@ extensions with: - nerdtree - nvim-tree - quickfix -- toggleterm - symbols-outline +- toggleterm *lualine-Custom-extensions*