Skip to content

fix(concat): check that arr2 is not nil before attempting to concaten… #80

fix(concat): check that arr2 is not nil before attempting to concaten…

fix(concat): check that arr2 is not nil before attempting to concaten… #80

Workflow file for this run

name: Test 🧪
on:
push:
branches: [ master ]
paths:
- 'locales/**'
- 'smiti18n/**'
- 'spec/**'
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
test:
name: Test and check ️🔎
runs-on: ubuntu-22.04
strategy:
matrix:
lua-version: ${{ github.actor == 'nektos/act' && fromJSON('["5.1"]') || fromJSON('["5.1", "5.2", "5.3", "5.4", "luajit"]') }}
steps:
- uses: actions/checkout@v4
- uses: jkl1337/gh-actions-lua@v11
with:
luaVersion: "${{ matrix.lua-version }}"
- uses: jkl1337/gh-actions-luarocks@v5
with:
luaRocksVersion: "3.11.1"
- name: Install dependencies
run: |
luarocks install busted
luarocks install cluacov
luarocks install inspect
luarocks install luacheck
luarocks install luacov
- name: Run checks and tests
run: |
luacheck --no-unused-args --std max+busted smiti18n spec
busted
- name: Generate and show coverage report
run: |
luacov
cat luacov.report.out
cp luacov.report.out luacov-${{ matrix.lua-version }}.txt
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: luacov-${{ matrix.lua-version }}.txt
path: luacov-${{ matrix.lua-version }}.txt
- name: Create coverage table script
run: |
cat > coverage-table.lua << 'EOF'
local output = {
string.format("# Test Coverage Summary - %s\n", os.getenv("LUA_VERSION")),
"| File | Hits | Missed | Coverage |\n",
"|------|------|---------|----------|\n"
}
local rows = {}
local total_line = ""
for line in io.lines("luacov.report.out") do
local file, hits, missed, coverage = line:match("^([%w%p]+)%s+(%d+)%s+(%d+)%s+([%d%.]+)%%")
if file then
local row = string.format("| %s | %s | %s | %s%% |\n", file, hits, missed, coverage)
if file == "Total" then
total_line = row
else
table.insert(rows, row)
end
end
end
table.sort(rows)
for _, row in ipairs(rows) do
table.insert(output, row)
end
table.insert(output, total_line)
io.open(os.getenv("GITHUB_STEP_SUMMARY"), "w"):write(table.concat(output))
EOF
chmod +x coverage-table.lua
- name: Create coverage summary
env:
LUA_VERSION: ${{ matrix.lua-version }}
run: lua coverage-table.lua