diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..840119c --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,27 @@ +name: Test +on: +- push +- pull_request + +jobs: + test: + strategy: + fail-fast: false + matrix: + lua_version: ["5.4", "5.3", "5.2", "5.1"] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Lua + uses: luarocks/gh-actions-lua@master + with: + luaVersion: ${{ matrix.lua_version }} + - name: Set up LuaRocks + uses: luarocks/gh-actions-luarocks@master + - name: Setup dependencies + run: luarocks install luaunit + - name: Build luarock + run: luarocks build streams-scm-1.rockspec + - name: Run tests + run: luarocks test diff --git a/streams-scm-1.rockspec b/streams-scm-1.rockspec new file mode 100644 index 0000000..2ea2279 --- /dev/null +++ b/streams-scm-1.rockspec @@ -0,0 +1,47 @@ +rockspec_format = "3.0" +package = "streams" +version = "scm-1" + +source = { + url = "git+https://github.com/rbaltrusch/stream.lua", + branch = "master", -- this will be replaced by the release workflow +} + +description = { + summary = "Iterator-chaining library implementing common functional programming patterns such as `map`, `filter`, and `reduce`", + detailed = [[ + 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: + + ```lua + local fn = require "stream" + fn.stream{2, 3, 4, 7} + :filter(function(x) return x % 2 == 0 end) + :map(function(x) return x ^ 2 end) + :collect() -- {4, 16} + ``` + ]], + homepage = "https://github.com/rbaltrusch/stream.lua", + issues_url = "https://github.com/rbaltrusch/stream.lua/issues", + license = "MIT", + maintainer = "Richard Baltrusch", +} + +dependencies = { + "lua >= 5.1" +} + +test_dependencies = { + "luaunit", +} + +build = { + type = "builtin", + modules = { + stream = "stream.lua", + }, +} + +test = { + type = "command", + script = "tests/run_tests.lua", +}