Skip to content

Commit 83240a9

Browse files
authored
Add unit testing Github action workflow (#3)
* Add unit testing github action * Add rockspec arg to testing workflow * Fix test pipeline by fixing rockspec name * Fix test pipeline by fixing rockspec name * Try fix rockspec version field * Fix workflow branch * Try add support for lua 5.4 * Format test workflow file
1 parent fbb0222 commit 83240a9

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

.github/workflows/tests.yaml

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

streams-scm-1.rockspec

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-1"
4+
5+
source = {
6+
url = "git+https://github.com/rbaltrusch/stream.lua",
7+
branch = "master", -- 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"
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)