Skip to content

Commit

Permalink
feat: add lint & release-please workflows (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
s1n7ax authored Dec 10, 2023
1 parent 5cc14c1 commit 97a5a3d
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 70 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Vim Doc

on:
push:
branches:
- main

name: docs

permissions:
pull-requests: write
contents: write
Expand All @@ -18,12 +18,12 @@ jobs:
- name: panvimdoc
uses: kdheepak/panvimdoc@main
with:
vimdoc: "nvim-java-core"
vimdoc: "nvim-java-test"
dedupsubheadings: false
version: "Neovim >= 0.9.4"
demojify: true

- name: Create Pull Request
- name: create pull request
uses: peter-evans/create-pull-request@v5
with:
base: "main"
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/lint-test.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Lint

on:
push:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lunarmodules/luacheck@v1
15 changes: 15 additions & 0 deletions .github/workflows/luarocks-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: LuaRocks Release
on:
push:
tags:
- "v*"
jobs:
luarocks-upload:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: luarocks upload
uses: nvim-neorocks/luarocks-tag-release@v4
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
27 changes: 17 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
name: "release"
name: Release

on:
push:
tags:
- 'v*'
branches: [main]
pull_request:
workflow_dispatch:

permissions:
pull-requests: write
contents: write

jobs:
luarocks-upload:
runs-on: ubuntu-22.04
release:
name: release
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: LuaRocks Upload
uses: nvim-neorocks/luarocks-tag-release@v4
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
- uses: google-github-actions/release-please-action@v3
with:
release-type: simple
16 changes: 16 additions & 0 deletions .github/workflows/stylua.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Stylua

on:
push:
pull_request:

jobs:
stylua:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: JohnnyMorganz/stylua-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --color always --check lua
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
nvim-versions: ["stable", "nightly"]

name: test
steps:
- name: checkout
uses: actions/checkout@v3

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

- name: run tests
run: make test
13 changes: 13 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
globals = {
'vim.o',
'vim.g',
'vim.wo',
'vim.bo',
'vim.opt',
}
read_globals = {
'vim',
'describe',
'it',
'assert',
}
16 changes: 0 additions & 16 deletions lua/java-test/results/message-id.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,4 @@ local MessageId = {
ASSUMPTION_FAILED_TEST_PREFIX = '@AssumptionFailure: ',
}

--[[
*************
%TESTC 2 v2
%TSTTREE2,com.example.demo.DemoApplicationTests,true,2,false,1,DemoApplicationTests,,[engine:junit-jupiter]/[class:com.example.demo.DemoApplicationTests]
%TSTTREE3,anotherTest(com.example.demo.DemoApplicationTests),false,1,false,2,anotherTest(),,[engine:junit-jupiter]/[class:com.example.demo.DemoApplicationTests]/[method:anotherTest()]
%TSTTREE4,contextLoads(com.example.demo.DemoApplicationTests),false,1,false,2,contextLoads(),,[engine:junit-jupiter]/[class:com.example.demo.DemoApplicationTests]/[method:contextLoads()]
%TESTS 3,anotherTest(com.example.demo.DemoApplicationTests)
*************
%TESTE 3,anotherTest(com.example.demo.DemoApplicationTests)
*************
%TESTS 4,contextLoads(com.example.demo.DemoApplicationTests)
*************
%TESTE 4,contextLoads(com.example.demo.DemoApplicationTests)
%RUNTIME2281
--]]

return MessageId
2 changes: 1 addition & 1 deletion lua/java-test/results/result-parser-factory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local TestParserFactory = class()
---Returns a test parser of given type
---@param args any
---@return java_test.TestParser
function TestParserFactory.get_parser(args)
function TestParserFactory.get_parser(_args)
return TestParser()
end

Expand Down
8 changes: 4 additions & 4 deletions lua/java-test/results/result-parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,23 @@ function TestParser:parse_test_failed(data, line_iter)
-- EXPECTED
if vim.startswith(line, MessageId.ExpectStart) then
node.result.expected =
self:get_content_until_end_tag(MessageId.ExpectEnd, line_iter)
TestParser.get_content_until_end_tag(MessageId.ExpectEnd, line_iter)

-- ACTUAL
elseif vim.startswith(line, MessageId.ActualStart) then
node.result.actual =
self:get_content_until_end_tag(MessageId.ActualEnd, line_iter)
TestParser.get_content_until_end_tag(MessageId.ActualEnd, line_iter)

-- TRACE
elseif vim.startswith(line, MessageId.TraceStart) then
node.result.trace =
self:get_content_until_end_tag(MessageId.TraceEnd, line_iter)
TestParser.get_content_until_end_tag(MessageId.TraceEnd, line_iter)
end
end
end

---@private
function TestParser:get_content_until_end_tag(end_tag, line_iter)
function TestParser.get_content_until_end_tag(end_tag, line_iter)
local content = {}

while true do
Expand Down
4 changes: 2 additions & 2 deletions lua/java-test/ui/floating-report-viewer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ function FloatingReportViewer:show(test_results)

local res = build_result(test_results, '', '')

self:show_in_window(vim.split(res, '\n'))
FloatingReportViewer.show_in_window(vim.split(res, '\n'))
end

function FloatingReportViewer:show_in_window(content)
function FloatingReportViewer.show_in_window(content)
local Popup = require('nui.popup')
local event = require('nui.utils.autocmd').event

Expand Down

0 comments on commit 97a5a3d

Please sign in to comment.