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

Feature: Add a plugin template that follows these best practices #21

Closed
ColinKennedy opened this issue Sep 1, 2024 · 6 comments
Closed

Comments

@ColinKennedy
Copy link
Contributor

ColinKennedy commented Sep 1, 2024

I've written a few plugins now based on this page's recommendations and can say it's pretty time consuming to get all the different pieces working correctly. To solve this, I made a "featureful" plugin template that implements everything. It's not 100% ready just yet but here's a preview

https://github.com/ColinKennedy/nvim-best-practices-plugin-template

The WIP elements that are left:

  • 3 unittests are failing (> 100 are passing)
  • The GitHub CI actions are blocked in but aren't passing yet
  • The flow of documentation could be improved
    • To fix this, I think all meta documentation of "this is how the repository works" will go into Wiki pages and the README.md other files will just be a standard Neovim plugin template The Wiki is available here
  • I'm considering moving the argparse + auto-completion API into a standalone luarocks package and adding it back in as a dependency
  • Considering more CI. e.g. https://github.com/linkchecker/linkchecker or other things

As said, it's a bit WIP still but I would really appreciate any feedback on it.

@mrcjkb
Copy link
Member

mrcjkb commented Sep 1, 2024

hey 👋

thanks, this sounds like a great idea! 🙏

I would really appreciate any feedback on it.

I'm on vacation now, but I'll see if I can find some time to take a closer look at it soon.

We could probably add a link to your repo to the document.

@mrcjkb mrcjkb changed the title Feature: Add a plugin template thast follows these best practices Feature: Add a plugin template that follows these best practices Sep 10, 2024
@mrcjkb
Copy link
Member

mrcjkb commented Oct 7, 2024

Sorry it took me so long. I've added a link to your template to the readme: 1af067a

Thanks for creating and maintaining it 🙏 😄

@mrcjkb mrcjkb closed this as completed Oct 7, 2024
@ColinKennedy
Copy link
Contributor Author

All good, and thank you for the guide! The CI stuff is still WIP but I hope to complete it for real in a month or so

@ColinKennedy
Copy link
Contributor Author

https://github.com/ColinKennedy/nvim-best-practices-plugin-template is now done. Or at least at a MVP state that's shareable :)

@ColinKennedy
Copy link
Contributor Author

Hi @mrcjkb would you mind if I ask you for some help / advice on solving an issue with "Add Windows + luarocks + busted + Neovim + GitHub workflow"? I saw your replies over at leafo/gh-actions-luarocks#14 while reading the whole thread but unfortunately I don't seem to be any closer to getting it working the best-practices plugin. Any help would be really appreciated.

I have several attempts / iterations. The latest is

https://github.com/ColinKennedy/nvim-best-practices-plugin-template/actions/runs/11543956333/job/32128931201

Workflow:

Details
name: test

on: [push]

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        luaVersion: ["5.1", "5.2", "5.3", "5.4", "luajit"]
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
    runs-on: ${{ matrix.os }}

    name: split test (using lua ${{ matrix.luaVersion }} on ${{ matrix.os }}
    steps:

    - uses: actions/checkout@master

    - uses: ilammy/msvc-dev-cmd@v1
    - uses: leafo/gh-actions-lua@master
      with:
        luaVersion: ${{ matrix.luaVersion }}
        buildCache: false

    - uses: hishamhm/gh-actions-luarocks@master
      with:
          luarocksVersion: "3.10.0"

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

    - name: build
      run: |
        luarocks test plugin-template-scm-1.rockspec --prepare

    - name: test
      run: |
        luarocks test --test-type busted

The 5.1 install works for ubuntu and macos. But windows fails with

2024-10-27T21:28:51.5948410Z busted 2.2.0-1 depends on say >= 1.4-1 (not installed)
2024-10-27T21:28:55.7914223Z Installing https://luarocks.orcore.c
2024-10-27T21:28:55.8394090Z Microsoft (R) Incremental Linker Version 14.41.34123.0
2024-10-27T21:28:55.8395136Z Copyright (C) Microsoft Corporation.  All rights reserved.
2024-10-27T21:28:55.8395715Z 
2024-10-27T21:28:55.8454387Z    Creating library C:\Users\RUNNER~1\AppData\Local\Temp\luarocks_build-lua-term-0.8-1-5384012\term\core.lib and object C:\Users\RUNNER~1\AppData\Local\Temp\luarocks_build-lua-term-0.8-1-5384012\term\core.exp
2024-10-27T21:29:03.6761214Z lfs.c
2024-10-27T21:29:03.9198128Z Microsoft (R) Incremental Linker Version 14.41.34123.0
2024-10-27T21:29:03.9199010Z Copyright (C) Microsoft Corporation.  All rights reserved.
2024-10-27T21:29:03.9199569Z 
2024-10-27T21:29:03.9273495Z    Creating library C:\Users\RUNNER~1\AppData\Local\Temp\luarocks_build-LuaFileSystem-1.8.0-1-7566644\lfs.lib and object C:\Users\RUNNER~1\AppData\Local\Temp\luarocks_build-LuaFileSystem-1.8.0-1-7566644\lfs.exp
2024-10-27T21:29:16.6523913Z No existing manifest. Attempting to rebuild...
2024-10-27T21:29:16.6524427Z 
2024-10-27T21:29:16.6524944Z Error: 'busted' executable failed to be installed
2024-10-27T21:29:16.6525587Z g/say-1.4.1-3.src.rock

It seems to me that any time I throw luarocks into the mix or try to install something using luarocks, things break. Anyway I don't actually intend to support multiple lua versions, just the one that Neovim comes with (luajit). But this is the closest I've gotten to a cross-OS luarocks Neovim unittests working

@mrcjkb
Copy link
Member

mrcjkb commented Oct 28, 2024

I no longer use the gh-actions-luarocks action on Windows.
Instead, I've switched to scoop, with our rocks-scoop bucket.
However, I've also never tried using busted on Windows.

You could try adding shell: bash to your build and test steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants