Skip to content

Commit 0bf1de0

Browse files
committed
Add unit testing github action
1 parent 33dc888 commit 0bf1de0

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

.github/workflows/tests.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Test
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
7+
test:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
lua_version: [ "5.4", "5.3", "5.2", "5.1", 'luajit-2.0', 'luajit-2.1' ]
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Lua
18+
uses: luarocks/gh-actions-lua@master
19+
with:
20+
luaVersion: ${{ matrix.lua_version }}
21+
22+
- name: Set up LuaRocks
23+
uses: luarocks/gh-actions-luarocks@master
24+
25+
- name: Setup dependencies
26+
run: luarocks install luaunit
27+
28+
- name: Build luarock
29+
run: luarocks build
30+
31+
- name: Run regression tests
32+
run: luarocks test

streams-scm.rockspec.lua

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
rockspec_format = "3.0"
2+
package = "streams"
3+
version = "scm"
4+
5+
source = {
6+
url = "git+https://github.com/rbaltrusch/stream.lua",
7+
branch = "main", -- this will be replaced by the release workflow
8+
}
9+
10+
description = {
11+
summary = "Iterator-chaining library implementing common functional programming patterns such as `map`, `filter`, and `reduce`",
12+
detailed = [[
13+
This library provides a Java-like `Stream` class that provides a fluent interface of lazily-computed and chainable iterator operations such as `map`, `filter`, and `reduce`. For example:
14+
15+
```lua
16+
local fn = require "stream"
17+
fn.stream{2, 3, 4, 7}
18+
:filter(function(x) return x % 2 == 0 end)
19+
:map(function(x) return x ^ 2 end)
20+
:collect() -- {4, 16}
21+
```
22+
]],
23+
homepage = "https://github.com/rbaltrusch/stream.lua",
24+
issues_url = "https://github.com/rbaltrusch/stream.lua/issues",
25+
license = "MIT",
26+
maintainer = "Richard Baltrusch",
27+
}
28+
29+
dependencies = {
30+
"lua >= 5.1, < 5.4"
31+
}
32+
33+
test_dependencies = {
34+
"luaunit",
35+
}
36+
37+
build = {
38+
type = "builtin",
39+
modules = {
40+
stream = "stream.lua",
41+
},
42+
}
43+
44+
test = {
45+
type = "command",
46+
script = "tests/run_tests.lua",
47+
}

0 commit comments

Comments
 (0)