Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements per tube statistics #19

Merged
merged 10 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Linting with luacheck

on:
- push

jobs:
run-luacheck-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: tarantool/setup-tarantool@v3
with:
tarantool-version: '2.10.4'

- name: install tarantool/luacheck and execute it
run: tarantoolctl rocks install luacheck && .rocks/bin/luacheck .
52 changes: 52 additions & 0 deletions .github/workflows/push-rockspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Create and push rockspec for moonlibs/xqueue

on:
push:
tags:
- '*'

env:
ROCK_NAME: xqueue

jobs:
pack-and-push-tagged-rockspec:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@master
- uses: tarantool/setup-tarantool@v3
with:
tarantool-version: '2.6'

# 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/xqueue-scm-5.rockspec ${{ env.TAG }} "git+https://github.com/${{ github.repository }}.git"
- run: tarantoolctl rocks --server https://moonlibs.github.io/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 ${{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
60 changes: 60 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Testing with unit tests

on:
- push

jobs:
run-unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
version: ["1.10.15", "2.10.6", "2.11.0", "2.11.2"]
steps:
- uses: actions/checkout@v4
- uses: tarantool/setup-tarantool@v3
with:
tarantool-version: '${{matrix.version}}'
- name: install luacov-console
run: tarantoolctl rocks install luacov-console
- name: install luatest
run: tarantoolctl rocks install luatest
- name: run tests
env:
LUACOV_ENABLE: true
run: |
.rocks/bin/luatest --coverage -b -c -v test/
- name: print luacov-console report
run: .rocks/bin/luacov-console "$(pwd)" && .rocks/bin/luacov-console -s
- 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@master
- 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
21 changes: 11 additions & 10 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
std = "luajit"
std = "tarantool"
codes = true
globals = {
-- Tarantool variable:
"box",
-- Tarantool variables:
"table.deepcopy",
"dostring",

-- package reload:
"package.reload",
}

include_files = {
"xqueue.lua"
}

max_line_length = 140

ignore = {
"211",
"212",
"431",
"432",
"542",
"611",
-- "631",
"431", -- shadowing upvalue self
"432", -- shadowing upvalue argument
"542", -- empty if branch
}
25 changes: 25 additions & 0 deletions .luacov
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
deletestats = false
runreport = false

exclude = {
"test/",
"%.rocks/",
"builtin/",
"example",
}

-- path renaming
modules = {
['.xqueue'] = io.popen('pwd'):read('*line') .. '/xqueue.lua',
}

runreport = true
deletestats = false

coveralls = {
root = "/",
debug = true,
pathcorrect = {
{ "^/home/runner/work/xqueue/xqueue/", "" },
},
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"Lua.runtime.version": "LuaJIT"
"Lua.runtime.version": "LuaJIT",
"Lua.workspace.checkThirdParty": false
}
Loading