-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kit v3 (with tarantool 3.0.1 support)
- Loading branch information
Showing
12 changed files
with
284 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Linting with luacheck | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
run-luacheck-linter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: tarantool/setup-tarantool@v3 | ||
with: | ||
tarantool-version: '2.11.2' | ||
- name: install tarantool/luacheck and execute it | ||
run: tarantoolctl rocks install luacheck && .rocks/bin/luacheck . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Create and push rockspec for moonlibs/sync | ||
|
||
on: | ||
workflow_dispatch: | ||
workflows: | ||
- "Linting with luacheck" | ||
- "Testing with unit tests" | ||
types: | ||
- completed | ||
push: | ||
tags: | ||
- '*' | ||
|
||
env: | ||
ROCK_NAME: kit | ||
|
||
jobs: | ||
pack-and-push-tagged-rockspec: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} && startsWith(github.ref, 'refs/tags/') }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: tarantool/setup-tarantool@v2 | ||
with: | ||
tarantool-version: '2.10.4' | ||
|
||
# https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions | ||
- name: Set env | ||
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
- run: tarantoolctl rocks new_version --tag=${{ env.TAG }} rockspecs/${{ env.ROCK_NAME }}-dev-1.rockspec ${{ env.TAG }} "git+https://github.com/${{ github.repository }}.git" | ||
- run: tarantoolctl rocks install ${{ env.ROCK_NAME }}-${{ env.TAG }}-1.rockspec | ||
- run: tarantoolctl rocks pack ${{ env.ROCK_NAME }}-${{ env.TAG }}-1.rockspec | ||
# Install native lua with luarocks | ||
- uses: leafo/gh-actions-lua@v9 | ||
with: | ||
luaVersion: "luajit-2.1.0-beta3" | ||
- uses: leafo/gh-actions-luarocks@v4 | ||
with: | ||
luarocksVersion: "3.8.0" | ||
- uses: unfor19/[email protected] | ||
- run: mkdir .build && cp rockspecs/${{ env.ROCK_NAME }}-dev-1.rockspec ${{ env.ROCK_NAME }}-${{ env.TAG }}-1.rockspec .build/ && cp *.src.rock .build/ | ||
- name: rebuild and publish s3 luarocks server | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.MOONLIBS_S3_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.MOONLIBS_S3_SECRET_KEY}} | ||
AWS_EC2_METADATA_DISABLED: true | ||
run: | | ||
cd .build && aws s3 sync s3://moonlibs/ ./ && luarocks-admin make_manifest . && aws s3 sync --acl public-read ./ s3://moonlibs/; | ||
- uses: "marvinpinto/action-automatic-releases@latest" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
files: | | ||
README.md | ||
${{env.ROCK_NAME}}-dev-1.rockspec | ||
${{env.ROCK_NAME}}-${{env.TAG}}-1.rockspec | ||
${{env.ROCK_NAME}}-${{env.TAG}}-1.src.rock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Testing with unit tests | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
run-unit-tests: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
version: ["1.10.15", "2.10.7", "2.11.2", "3.0.1"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: tarantool/setup-tarantool@v3 | ||
with: | ||
tarantool-version: '2.10.4' | ||
- name: install luacov-console | ||
run: tarantoolctl rocks install luacov-console | ||
- name: install luacov-coveralls | ||
run: tarantoolctl rocks install --server=http://luarocks.org luacov-coveralls | ||
- uses: tarantool/setup-tarantool@v3 | ||
with: | ||
tarantool-version: ${{matrix.version}} | ||
- name: setup perl | ||
uses: shogo82148/actions-setup-perl@v1 | ||
with: | ||
perl-version: 5.18.4 | ||
- name: show perl version | ||
run: | | ||
perl -v | ||
- name: install TAP::Harness | ||
run: | | ||
cpanm -v | ||
cpanm --notest TAP::Harness | ||
- name: run tests | ||
env: | ||
LUACOV_ENABLE: true | ||
run: | | ||
make test | ||
- name: rename luacov.stats.out | ||
run: mv luacov.stats.out luacov.stats.out-${{matrix.version}} | ||
- uses: actions/upload-artifact@master | ||
with: | ||
name: luacov.stats.out-${{matrix.version}} | ||
path: luacov.stats.out-${{matrix.version}} | ||
|
||
run-coverage-report: | ||
runs-on: ubuntu-latest | ||
needs: ["run-unit-tests"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: tarantool/setup-tarantool@v3 | ||
with: | ||
tarantool-version: '2.10.7' | ||
- name: install luacov-coveralls 0.2.3 | ||
run: tarantoolctl rocks install --server=https://luarocks.org luacov-coveralls 0.2.3 | ||
- name: install luacov-console 1.2.0 | ||
run: tarantoolctl rocks --server http://moonlibs.github.io/rocks install luacov-console 1.2.0 | ||
- name: Download run artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: luacov.stats.out-* | ||
merge-multiple: true | ||
- name: debug | ||
run: ls -la . | ||
- name: merge luacov.stats.out | ||
run: cat luacov.stats.out-* | >luacov.stats.out tarantool -e 'm={} for k in io.lines() do local vs=io.read():split(" ") vs[#vs]=nil local r = m[k] if r then for i, v in pairs(vs) do r[i]=r[i]+v end else m[k]=vs end end; for k, v in pairs(m) do print(k) print(table.concat(v, " ")) end' | ||
- name: prepare coverage report | ||
run: .rocks/bin/luacov-console . && .rocks/bin/luacov-console -s | ||
- name: publish coveralls report | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | ||
run: .rocks/bin/luacov-coveralls -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
std="tarantool" | ||
|
||
max_line_length=140 | ||
include_files = {"kit/", "kit.lua"} | ||
|
||
globals = { "kit" } | ||
|
||
read_globals = { | ||
"_TARANTOOL", | ||
"config", | ||
"package.reload", | ||
"kit", | ||
} | ||
|
||
files["kit/1/5/*.lua"] = { | ||
read_globals = { | ||
"box.fiber", | ||
"box.time", | ||
"box.time64", | ||
"box.ipc", | ||
"box.errno", | ||
} | ||
} | ||
|
||
globals = { "table" } | ||
|
||
ignore = { | ||
"121", -- setting read-only global variable | ||
"211", -- unused variable | ||
"212", -- unused argument | ||
"213", -- unused loop variable | ||
"411", -- redefinition of the variable | ||
"421", -- shadowing definition of variable | ||
"431", -- shadwing upvalue | ||
"432", -- shadowing upvalue argument | ||
"542", -- empty if branch | ||
"611", -- contains only whitespaces | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
runreport = false | ||
deletestats = false | ||
|
||
exclude = { | ||
"%.rocks/", | ||
"builtin/", | ||
"01-base%.test%.lua" | ||
} | ||
|
||
pathcorrect = { | ||
{ "^/source/kit/", "" }, | ||
} | ||
|
||
coveralls = { | ||
root = "/", | ||
debug = true, | ||
pathcorrect = { | ||
{ "^/home/runner/work/kit/kit/", "" }, | ||
{ "^/source/kit", "" }, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.PHONY := all test | ||
|
||
test: | ||
export LUACOV_ENABLE=true | ||
prove t/*.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package = "kit" | ||
version = "dev-1" | ||
source = { | ||
url = "git+https://github.com/moonlibs/kit.git", | ||
branch = "master" | ||
} | ||
description = { | ||
summary = "Compatibility kit for Tarantool", | ||
homepage = "https://github.com/moonlibs/kit.git", | ||
license = "BSD" | ||
} | ||
dependencies = { | ||
"lua >= 5.1" | ||
} | ||
build = { | ||
type = "builtin", | ||
modules = { | ||
kit = "kit.lua", | ||
["kit.1"] = "kit/1.lua", | ||
["kit.1.10"] = "kit/1/10.lua", | ||
["kit.1.5"] = "kit/1/5/init.lua", | ||
["kit.1.5.errno"] = "kit/1/5/errno.lua", | ||
["kit.1.5.fiber"] = "kit/1/5/fiber.lua", | ||
["kit.1.5.socket"] = "kit/1/5/socket.lua", | ||
["kit.1.6"] = "kit/1/6.lua", | ||
["kit.1.6.0"] = "kit/1/6/0.lua", | ||
["kit.1.6+"] = "kit/1/6+.lua", | ||
["kit.1.7"] = "kit/1/7.lua", | ||
["kit.1.9"] = "kit/1/9.lua", | ||
["kit.2"] = "kit/2.lua", | ||
["kit.3"] = "kit/3.lua", | ||
["kit.loc"] = "kit/loc.lua" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
return function(M,I) | ||
require 'kit.1'(M,I) | ||
require 'kit.1.10'(M,I) | ||
require 'kit.2'(M,I) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
local _VERSION = '2' | ||
local _VERSION = '3' | ||
|
||
if rawget(_G,'kit') then | ||
if kit._VERSION == _VERSION then | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env tarantool | ||
|
||
if os.getenv("LUACOV_ENABLE") then | ||
print("enabling luacov") | ||
require 'luacov.runner'.init() | ||
end | ||
|
||
local kit = require 'kit' | ||
box.cfg{} | ||
|
||
local tap = require 'tap' | ||
local t = tap.test("base") | ||
|
||
t:is(kit.node.ro, box.info.ro, "kit.node.ro") | ||
t:is(kit.node.lsn, box.info.lsn, "kit.node.lsn") | ||
t:is(kit.node.rw, not box.info.ro, "kit.node.rw") | ||
t:is(kit.node.uuid, box.info.uuid, "kit.node.uuid") | ||
t:is(kit.node.id, box.info.id, "kit.node.id") | ||
|
||
t:isstring(kit.node.hostname, "kit.node.hostname is string") | ||
|
||
t:ok(kit.wait_lsn(kit.node.id, kit.node.lsn, 0), "wait_lsn(lsn, 0)") | ||
t:ok(kit.wait_lsn(kit.node.id, kit.node.lsn, 0), "wait_lsn(lsn, 0)") | ||
|
||
t:is(kit.wait_lsn(kit.node.id, kit.node.lsn+1, 0), false, "wait_lsn(lsn+1, 0)") | ||
|
||
t:plan(t.total) | ||
|
||
if t.failed > 0 then | ||
os.exit(1) | ||
else | ||
os.exit(0) | ||
end |