Skip to content

Commit

Permalink
🎉 Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
puria committed Jan 28, 2022
0 parents commit d73f2e9
Show file tree
Hide file tree
Showing 13 changed files with 476 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .busted
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- SPDX-FileCopyrightText: 2022 Puria Nafisi Azizi <puria@dyne.org>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later

return {
default = {
verbose = true,
output = "gtest"
}
}
-- vim: ft=lua
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SPDX-FileCopyrightText: 2022 Puria Nafisi Azizi <puria@dyne.org>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.lua]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab

[*.bat]
end_of_line = crlf
33 changes: 33 additions & 0 deletions .github/workflows/busted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-FileCopyrightText: 2022 Puria Nafisi Azizi <puria@dyne.org>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

name: Busted

on: [push, pull_request]

jobs:

busted:
strategy:
fail-fast: false
matrix:
lua-version: ["5.4", "5.3", "5.2", "5.1", "luajit"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: leafo/gh-actions-lua@v8
with:
luaVersion: ${{ matrix.lua-version }}
- uses: leafo/gh-actions-luarocks@v4
- name: Setup dependencies
run: |
luarocks install busted
luarocks install luacov-coveralls
- run: busted -c -v
- name: Report test coverage
if: success()
continue-on-error: true
run: luacov-coveralls -i src/luacheck -e .luarocks
env:
COVERALLS_REPO_TOKEN: ${{ github.token }}
24 changes: 24 additions & 0 deletions .github/workflows/luacheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2022 Puria Nafisi Azizi <puria@dyne.org>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

name: Luacheck

on: [push, pull_request]

jobs:

luacheck:
strategy:
fail-fast: false
matrix:
lua-version: ["5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: leafo/gh-actions-lua@v8
with:
luaVersion: ${{ matrix.lua-version }}
- uses: leafo/gh-actions-luarocks@v4
- run: luarocks install luacheck
- run: luacheck .
15 changes: 15 additions & 0 deletions .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2022 Puria Nafisi Azizi <puria@dyne.org>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

name: REUSE Compliance Check

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: fsfe/reuse-action@v1

51 changes: 51 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# SPDX-FileCopyrightText: 2022 Puria Nafisi Azizi <puria@dyne.org>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

# Compiled Lua sources
luac.out

# luarocks build files
*.src.rock
*.zip
*.tar.gz

# Object files
*.o
*.os
*.ko
*.obj
*.elf

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo
*.def
*.exp

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

.DS_Store

/luarocks
/lua
/lua_modules
/.luarocks
10 changes: 10 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- SPDX-FileCopyrightText: 2022 Puria Nafisi Azizi <puria@dyne.org>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later

std = "min"
files["spec/"].std = "+busted"
include_files = {
"src/**/*.lua",
"spec/**/*.lua"
}
10 changes: 10 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: lua-starte-template
Upstream-Contact: Puria Nafisi Azizi <puria@dyne.org>
Source: https://github.com/dyne/lua-starter-template

# Sample paragraph, commented out:
#
# Files: src/*
# Copyright: $YEAR $NAME <$CONTACT>
# License: ...
235 changes: 235 additions & 0 deletions LICENSES/AGPL-3.0-or-later.txt

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

.PHONY: test local build lint clean

LUA_VERSION:=5.1
LUA_TREE:=lua_modules
MODULE:=lua-starter-template
ROCKS:=luarocks --lua-version=${LUA_VERSION} --tree=${LUA_TREE}

local: build
${ROCKS} make --force --local ${MODULE}-dev-1.rockspec

deps:
${ROCKS} install busted
${ROCKS} install luacheck
${ROCKS} install luacov

build:
${ROCKS} build
# ${ROCKS} make ${MODULE}-dev-1.rockspec

test: luarocks build
LUA_PATH="$$(luarocks --lua-version=${LUA_VERSION} path --lr-path);;" LUA_CPATH="$$(luarocks --lua-version=${LUA_VERSION} path --lr-cpath);;" ${LUA_TREE}/bin/busted spec

luarocks:
luarocks init --lua-versions=${LUA_VERSION}
eval $(luarocks --lua-version=${LUA_VERSION} path)

lint:
pipx run reuse lint
luacheck .

clean:
rm -rf ${LUA_TREE} lua luarocks .luarocks luacov.stats.out
15 changes: 15 additions & 0 deletions lua-starter-template-dev-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package = "lua-starter-template"
version = "dev-1"
source = {
url = "*** please add URL for source tarball, zip or repository here ***"
}
description = {
homepage = "*** please enter a project homepage ***",
license = "*** please specify a license ***"
}
build = {
type = "builtin",
modules = {
starter = "src/init.lua"
}
}
7 changes: 7 additions & 0 deletions spec/test1_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
local m = require("starter")

describe("Busted unit testing framework", function()
it("should work properly", function()
assert.are.equals(m.hello(), 'world')
end)
end)
11 changes: 11 additions & 0 deletions src/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- SPDX-FileCopyrightText: 2022 Puria Nafisi Azizi <puria@dyne.org>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later

local M = {}

function M.hello()
return "world"
end

return M

0 comments on commit d73f2e9

Please sign in to comment.