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

draft: fixes fencing and hot-reload in 2.11+ #29

Merged
merged 6 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
6 changes: 3 additions & 3 deletions .github/workflows/push-rockspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ env:

jobs:
pack-and-push-tagged-rockspec:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@master
- uses: tarantool/setup-tarantool@v1
with:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Run unit tests

on:
push:

env:
ROCK_NAME: config

jobs:
run-luacheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: tarantool/setup-tarantool@v2
with:
tarantool-version: '2.10.7'
- name: install luacheck 0.26.0
run: tarantoolctl rocks install luacheck 0.26.0
- name: run luacheck
run: .rocks/bin/luacheck .
run-unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
version: ["1.10.15", "2.8.4", "2.10.6", "2.10.7-gc64-amd64", "2.11.0", "2.11.1"]
steps:
- uses: actions/checkout@master
- uses: docker/setup-buildx-action@v2
- name: run test suite for ${{matrix.version}}
run: make test-${{matrix.version}}
- 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
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@v2
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
- uses: actions/download-artifact@master
with:
name: luacov.stats.out
- 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
23 changes: 23 additions & 0 deletions .luacov
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
runreport = false
deletestats = false

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

pathcorrect = {
{ "^/source/config/", "" },
}

coveralls = {
root = "/",
debug = true,
pathcorrect = {
{ "^/home/runner/work/config/config/", "" },
{ "^/source/config", "" },
},
}
6 changes: 6 additions & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM tarantool/tarantool:2.10 as builder
RUN apk add -u git cmake make gcc musl-dev curl wget
WORKDIR /root
RUN tarantoolctl rocks install luatest scm-1
RUN tarantoolctl rocks install luacov-console 1.1.0
RUN tarantoolctl rocks --server https://moonlibs.github.io/rocks install package-reload scm-1
11 changes: 7 additions & 4 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM tarantool/tarantool:2.10
ARG IMAGE=1.10.14
FROM config-test-builder as builder

RUN apk add -u git cmake make gcc musl-dev
RUN tarantoolctl rocks install luatest 0.5.7
RUN tarantoolctl rocks install luacov-console
FROM tarantool/tarantool:${IMAGE}

WORKDIR /root
COPY --from=builder /root/.rocks /root/.rocks
WORKDIR /opt/tarantool
17 changes: 10 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
.PHONY := all test

run-compose:
make -C test run-compose
run-etcd:
make -C test run-compose-etcd

build-testing-image:
docker build -t config-test -f Dockerfile.test .
config-test-builder:
docker build -t config-test-builder -f Dockerfile.build .

test: build-testing-image run-compose
docker run --name config-test \
config-test-%: config-test-builder run-etcd
docker build -t $(@) --build-arg IMAGE=$(subst config-test-,,$@) -f Dockerfile.test .

test-%: config-test-%
docker run --name $(<) \
--net tt_net \
-e TT_ETCD_ENDPOINTS="http://etcd0:2379,http://etcd1:2379,http://etcd2:2379" \
--rm -v $$(pwd):/source/config \
-v $$(pwd)/data:/tmp/ \
--workdir /source/config \
--entrypoint '' \
config-test \
$(<) \
./run_test_in_docker.sh
Loading