From 1c37b1cd0611563a767f0a340d61f265c4c54ecd Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Mon, 11 Mar 2024 11:34:18 +0800 Subject: [PATCH] ci(selene): migrate 'luacheck' to 'selene' (#128) --- .github/workflows/ci.yml | 29 ++++++++++++++--------------- .luacheckrc | 4 ---- selene.toml | 8 ++++++++ vim.toml | 18 ++++++++++++++++++ 4 files changed, 40 insertions(+), 19 deletions(-) delete mode 100644 .luacheckrc create mode 100644 selene.toml create mode 100644 vim.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fe2746..65136b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,19 +6,18 @@ on: push: branches: - main - - master jobs: - conventional_commit: - name: Conventional Commit + commit: + name: Commit if: ${{ github.ref != 'refs/heads/main' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ytanikin/PRConventionalCommits@1.1.0 - with: - task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert","break"]' - luacheck: - name: Lua check + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + lint: + name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -28,15 +27,17 @@ jobs: level: Information configpath: ".luarc.json" neodev-version: stable - - uses: lunarmodules/luacheck@v1 - with: - args: lua --config .luacheckrc + - uses: cargo-bins/cargo-binstall@main + - name: Selene + run: | + cargo binstall --no-confirm selene + selene --config selene.toml ./lua - uses: JohnnyMorganz/stylua-action@v3 with: token: ${{ secrets.GITHUB_TOKEN }} version: latest args: --config-path .stylua.toml ./lua ./test - - uses: stefanzweifel/git-auto-commit-action@v4 + - uses: stefanzweifel/git-auto-commit-action@v5 if: ${{ github.ref != 'refs/heads/main' }} with: commit_message: "chore(pr): auto-commit" @@ -60,7 +61,6 @@ jobs: - name: Run Tests shell: bash run: | - luarocks install luacheck luarocks install vusted vusted --shuffle ./test code_coverage: @@ -80,7 +80,6 @@ jobs: - name: Run Tests shell: bash run: | - luarocks install luacheck luarocks install luacov luarocks install vusted vusted --coverage ./test @@ -104,7 +103,7 @@ jobs: name: Release if: ${{ github.ref == 'refs/heads/main' }} needs: - - luacheck + - lint - unit_test - code_coverage runs-on: ubuntu-latest diff --git a/.luacheckrc b/.luacheckrc deleted file mode 100644 index ceb82b9..0000000 --- a/.luacheckrc +++ /dev/null @@ -1,4 +0,0 @@ -globals = { "vim", "describe", "before_each", "it", "assert" } -max_line_length = 200 -unused = false -unused_args = false diff --git a/selene.toml b/selene.toml new file mode 100644 index 0000000..8a193cc --- /dev/null +++ b/selene.toml @@ -0,0 +1,8 @@ +std = "vim" + +exclude = [] + +[lints] +mixed_table = "allow" +unused_variable = "allow" +incorrect_standard_library_use = "allow" diff --git a/vim.toml b/vim.toml new file mode 100644 index 0000000..4b05ef5 --- /dev/null +++ b/vim.toml @@ -0,0 +1,18 @@ +[selene] +base = "lua51" + +[vim] +any = true + +[it] +any = true + +[describe] +any = true + +[before_each] +any = true + +[assert] +any = true +