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

ci: use tt to install rocks and EE #334

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
9 changes: 8 additions & 1 deletion .github/workflows/check_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ jobs:
with:
tarantool-version: '2.10'

- name: Setup tt
run: |
curl -L https://tarantool.io/release/2/installer.sh | bash
sudo apt-get update
sudo apt-get install -y tt
tt version

- name: Setup luacheck
run: tarantoolctl rocks install luacheck 0.25.0
run: tt rocks install luacheck 0.25.0

- run: cmake -S . -B build

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push_rockspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
- name: Check module version
uses: tarantool/actions/check-module-version@master
with:
module-name: 'crud'
module-name: ${{ env.ROCK_NAME }}

push-scm-rockspec:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master'
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@master

Expand All @@ -34,7 +34,7 @@ jobs:

push-tagged-rockspec:
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags')
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
needs: version-check
steps:
- uses: actions/checkout@master
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/reusable_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ jobs:
sudo dpkg -i tarantool_*.deb tarantool-common_*.deb tarantool-dev_*.deb
tarantool --version

- name: Setup tt
run: |
curl -L https://tarantool.io/release/2/installer.sh | bash
sudo apt-get update
sudo apt-get install -y tt
tt version

- name: Install requirements
run: ./deps.sh

- name: Install metrics
run: tarantoolctl rocks install metrics 0.12.0
run: tt rocks install metrics 0.12.0

# This server starts and listen on 8084 port that is used for tests
- name: Stop Mono server
Expand Down
33 changes: 26 additions & 7 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
remove-merger: [false]
include:
- tarantool-version: "1.10"
metrics-version: "0.16.0"
metrics-version: "0.17.0"
cartridge-version: "2.7.8"
- tarantool-version: "2.7"
remove-merger: true
Expand All @@ -34,7 +34,7 @@ jobs:
cartridge-version: "1.2.0"
- tarantool-version: "2.10"
coveralls: true
metrics-version: "0.16.0"
metrics-version: "0.17.0"
cartridge-version: "2.7.8"
fail-fast: false
# Can't install older versions on 22.04,
Expand All @@ -53,6 +53,13 @@ jobs:
run: |
sudo patch -p1 /usr/share/tarantool/luarocks/manif.lua luarocks.patch

- name: Setup tt
run: |
curl -L https://tarantool.io/release/2/installer.sh | bash
sudo apt-get update
sudo apt-get install -y tt
tt version

- name: Install requirements for community
run: |
tarantool --version
Expand All @@ -62,7 +69,7 @@ jobs:

- name: Install metrics
if: matrix.metrics-version != ''
run: tarantoolctl rocks install metrics ${{ matrix.metrics-version }}
run: tt rocks install metrics ${{ matrix.metrics-version }}

- name: Remove external merger if needed
if: ${{ matrix.remove-merger }}
Expand Down Expand Up @@ -101,13 +108,20 @@ jobs:
with:
tarantool-version: ${{ matrix.tarantool-version }}

- name: Setup tt
run: |
curl -L https://tarantool.io/release/2/installer.sh | bash
sudo apt-get update
sudo apt-get install -y tt
tt version

- name: Install requirements for community
run: |
tarantool --version
./deps.sh

- name: Install metrics
run: tarantoolctl rocks install metrics ${{ matrix.metrics-version }}
run: tt rocks install metrics ${{ matrix.metrics-version }}

# This server starts and listen on 8084 port that is used for tests
- name: Stop Mono server
Expand All @@ -133,6 +147,13 @@ jobs:
steps:
- uses: actions/checkout@master

- name: Setup tt
run: |
curl -L https://tarantool.io/release/2/installer.sh | bash
sudo apt-get update
sudo apt-get install -y tt
tt version

- name: Install requirements for enterprise
run: |
curl -O -L https://tarantool:${{ secrets.DOWNLOAD_TOKEN }}@download.tarantool.io/enterprise/release/linux/x86_64/${{ matrix.tarantool-version.folder }}/${{ matrix.tarantool-version.bundle }}.tar.gz
Expand All @@ -145,9 +166,7 @@ jobs:

- name: Install metrics
if: matrix.metrics-version != ''
run: |
source tarantool-enterprise/env.sh
tarantoolctl rocks install metrics ${{ matrix.metrics-version }}
run: tt rocks install metrics ${{ matrix.metrics-version }}

# This server starts and listen on 8084 port that is used for tests
- name: Stop Mono server
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ add_custom_target(coveralls
## Install ####################################################################
###############################################################################

find_package(TTCtl)

if(NOT DEFINED TARANTOOL_INSTALL_LUADIR)
set(TARANTOOL_INSTALL_LUADIR "${PROJECT_SOURCE_DIR}/.rocks/share/tarantool")
endif()
Expand All @@ -99,9 +101,9 @@ install(
# Don't include to rockspec as some Tarantool versions (e.g. 2.2 and 2.3)
# don't have symbols required by "tuple-merger" and "tuple-keydef" modules.
execute_process(
COMMAND bash "-c" "tarantoolctl rocks install tuple-keydef 0.0.2"
COMMAND bash "-c" "${TTCTL} rocks install tuple-keydef 0.0.2"
)

execute_process(
COMMAND bash "-c" "tarantoolctl rocks install tuple-merger 0.0.2"
COMMAND bash "-c" "${TTCTL} rocks install tuple-merger 0.0.2"
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ project:
```shell
$ git clone https://github.com/tarantool/crud.git
$ cd crud
$ tarantoolctl rocks make
$ tt rocks make
$ ./doc/playground.lua
tarantool> crud.select('customers', {{'<=', 'age', 35}}, {first = 10})
tarantool> crud.select('developers', nil, {first = 6})
```
* Install crud into a current directory:

```shell
$ tarantoolctl rocks install crud
$ tt rocks install crud
```

And add the [initialization code](#API) to storage and router instance files.
Expand Down
11 changes: 11 additions & 0 deletions cmake/FindTTCtl.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
find_program(TTCTL
NAMES tt tarantoolctl
DOC "Utility for managing Tarantool packages"
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TTCtl
REQUIRED_VARS TTCTL
)

mark_as_advanced(TTCTL)
34 changes: 22 additions & 12 deletions deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,26 @@

set -e

TTCTL=""
if command -v tt; then
TTCTL=tt
elif command -v tarantoolctl; then
TTCTL=tarantoolctl
else
printf "tt or tarantoolctl is required" 1>&2
exit 1
fi

# Test dependencies:
tarantoolctl rocks install luatest 0.5.7
tarantoolctl rocks install luacheck 0.25.0
tarantoolctl rocks install luacov 0.13.0
"$TTCTL" rocks install luatest 0.5.7
"$TTCTL" rocks install luacheck 0.25.0
"$TTCTL" rocks install luacov 0.13.0

# cluacov, luacov-coveralls and dependencies
tarantoolctl rocks install https://raw.githubusercontent.com/mpeterv/cluacov/master/cluacov-scm-1.rockspec
tarantoolctl rocks install https://raw.githubusercontent.com/LuaDist/dkjson/master/dkjson-2.5-2.rockspec
tarantoolctl rocks install https://raw.githubusercontent.com/keplerproject/luafilesystem/master/luafilesystem-scm-1.rockspec
tarantoolctl rocks install https://raw.githubusercontent.com/moteus/lua-path/master/rockspecs/lua-path-scm-0.rockspec
"$TTCTL" rocks install https://raw.githubusercontent.com/mpeterv/cluacov/master/cluacov-scm-1.rockspec
"$TTCTL" rocks install https://raw.githubusercontent.com/LuaDist/dkjson/master/dkjson-2.5-2.rockspec
"$TTCTL" rocks install https://raw.githubusercontent.com/keplerproject/luafilesystem/master/luafilesystem-scm-1.rockspec
"$TTCTL" rocks install https://raw.githubusercontent.com/moteus/lua-path/master/rockspecs/lua-path-scm-0.rockspec

# Most of this code is the workaround for
# https://github.com/moteus/luacov-coveralls/pull/30
Expand All @@ -22,14 +32,14 @@ LUACOV_COVERALLS_ROCKSPEC_URL="https://raw.githubusercontent.com/moteus/luacov-c
LUACOV_COVERALLS_ROCKSPEC_FILE="${TMPDIR}/luacov-coveralls-scm-0.rockspec"
curl -fsSL "${LUACOV_COVERALLS_ROCKSPEC_URL}" > "${LUACOV_COVERALLS_ROCKSPEC_FILE}"
sed -i -e 's@git://@git+https://@' "${LUACOV_COVERALLS_ROCKSPEC_FILE}"
tarantoolctl rocks install "${LUACOV_COVERALLS_ROCKSPEC_FILE}"
"$TTCTL" rocks install "${LUACOV_COVERALLS_ROCKSPEC_FILE}"
rm "${LUACOV_COVERALLS_ROCKSPEC_FILE}"
rmdir "${TMPDIR}"

CARTRIDGE_VERSION="${CARTRIDGE_VERSION:-2.7.8}"

tarantoolctl rocks install cartridge "$CARTRIDGE_VERSION"
tarantoolctl rocks install ddl 1.6.2
tarantoolctl rocks install migrations 0.4.2
"$TTCTL" rocks install cartridge "$CARTRIDGE_VERSION"
"$TTCTL" rocks install ddl 1.6.2
"$TTCTL" rocks install migrations 0.4.2

tarantoolctl rocks make
"$TTCTL" rocks make