diff --git a/.gitignore b/.gitignore index c063212..e50cc44 100644 --- a/.gitignore +++ b/.gitignore @@ -20,5 +20,8 @@ doc/apidoc # benchmarks results bench.*.result.txt +# packpack build directory +/build + # temporary directory for make apidoc-lint doc/apidoc-lint-tmp diff --git a/.gitmodules b/.gitmodules index bd8c04a..3c99aa9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "test-run"] path = test-run url = https://github.com/tarantool/test-run.git +[submodule "3rd_party/packpack"] + path = 3rd_party/packpack + url = https://github.com/packpack/packpack.git diff --git a/.travis.yml b/.travis.yml index ffad6fd..01a2039 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,65 +1,76 @@ language: c -sudo: true +sudo: required -dist: trusty +services: + - docker -env: - - SHARD_VERSION=1.2 AVRO_SCHEMA=2.3.2 - - SHARD_VERSION=2.1 AVRO_SCHEMA=2.3.2 - - SHARD_VERSION=1.2 AVRO_SCHEMA=3.0.0 - - SHARD_VERSION=2.1 AVRO_SCHEMA=3.0.0 - -branches: - only: - - master +cache: + directories: + - $HOME/.cache -before_install: - - sudo apt-get -qq update - - curl http://download.tarantool.org/tarantool/1.9/gpgkey | - sudo apt-key add -release=`lsb_release -c -s` +git: + depth: 100500 - # install https download transport for APT - - sudo apt-get -y install apt-transport-https +env: + matrix: + - OS=el DIST=6 + - OS=el DIST=7 + - OS=fedora DIST=26 + - OS=fedora DIST=27 + - SHARD_VERSION=1.2 AVRO_SCHEMA=2.3.2 + - SHARD_VERSION=2.1 AVRO_SCHEMA=2.3.2 + - SHARD_VERSION=1.2 AVRO_SCHEMA=3.0.0 + - SHARD_VERSION=2.1 AVRO_SCHEMA=3.0.0 - # append two lines to a list of source repositories - - sudo rm -f /etc/apt/sources.list.d/*tarantool*.list - - echo "deb http://download.tarantool.org/tarantool/1.9/ubuntu/ trusty main" | - sudo tee /etc/apt/sources.list.d/tarantool_1_9.list - - echo "deb-src http://download.tarantool.org/tarantool/1.9/ubuntu/ trusty main" | - sudo tee -a /etc/apt/sources.list.d/tarantool_1_9.list +script: + - git describe --long + - | + if [ -n "${OS}" ]; then + git submodule update --recursive --init + ./3rd_party/packpack/packpack + else + ./tools/ubuntu.trusty.test.sh + fi -install: - - sudo apt-get update - - sudo apt-get -y install tarantool tarantool-dev - - cd .. - - git clone https://github.com/rtsisyk/msgpuck - - cd msgpuck - - cmake . - - sudo make install - - cd .. - - tarantoolctl rocks install shard "${SHARD_VERSION}" - - tarantoolctl rocks install avro-schema "${AVRO_SCHEMA}" - - cd graphql - - git submodule update --recursive --init - - tarantoolctl rocks install lulpeg - - tarantoolctl rocks install lrexlib-pcre - - tarantoolctl rocks install http - - cd .. - # lua (with dev headers) is necessary for luacheck - - sudo apt-get install lua5.1 - - sudo apt-get install liblua5.1-0-dev - - wget "http://luarocks.github.io/luarocks/releases/luarocks-2.4.4.tar.gz" - - tar xf luarocks-2.4.4.tar.gz - - cd luarocks-2.4.4 - - ./configure - - make build - - sudo make install - - cd ../graphql - - sudo luarocks install luacheck - - sudo pip install virtualenv - - sudo luarocks install ldoc +before_deploy: + - ls -l build/ -script: - - make apidoc-lint - - make test +deploy: + # Deploy packages to PackageCloud + - provider: packagecloud + username: ${PACKAGECLOUD_USER} + repository: "1_9" + token: ${PACKAGECLOUD_TOKEN} + dist: ${OS}/${DIST} + package_glob: build/*.{rpm,deb} + skip_cleanup: true + on: + branch: master + condition: -n "${OS}" + - provider: packagecloud + username: ${PACKAGECLOUD_USER} + repository: "1_10" + token: ${PACKAGECLOUD_TOKEN} + dist: ${OS}/${DIST} + package_glob: build/*.{rpm,deb} + skip_cleanup: true + on: + branch: master + condition: -n "${OS}" + - provider: packagecloud + username: ${PACKAGECLOUD_USER} + repository: "2_0" + token: ${PACKAGECLOUD_TOKEN} + dist: ${OS}/${DIST} + package_glob: build/*.{rpm,deb} + skip_cleanup: true + on: + branch: master + condition: -n "${OS}" +notifications: + email: + recipients: + - build@tarantool.org + on_success: change + on_failure: always diff --git a/3rd_party/packpack b/3rd_party/packpack new file mode 160000 index 0000000..30ff7b5 --- /dev/null +++ b/3rd_party/packpack @@ -0,0 +1 @@ +Subproject commit 30ff7b51654c19b8919d01ca8d4aa480e87e8241 diff --git a/Makefile b/Makefile index ee93810..e5fb180 100644 --- a/Makefile +++ b/Makefile @@ -69,3 +69,7 @@ serve-apidoc: apidoc .PHONY: demo demo: ./demo/demo.lua $(TESTDATA) + +.PHONY: rpm +rpm: + OS=el DIST=7 ./3rd_party/packpack/packpack diff --git a/README.md b/README.md index 64fb9e4..ac56f9d 100644 --- a/README.md +++ b/README.md @@ -374,18 +374,19 @@ make test * For use: * tarantool, * lulpeg, - * >=tarantool/avro-schema-2.0-71-gfea0ead, - * >=tarantool/shard-1.1-91-gfa88bf8 (but < 2.0) or - >=tarantool/shard-2.1-0-g0a7d98f (optional), + * \>=tarantool/avro-schema-2.0-71-gfea0ead, + * \>=tarantool/shard-1.1-91-gfa88bf8 (but < 2.0) or + \>=tarantool/shard-2.1-0-g0a7d98f (optional), * lrexlib-pcre2 or lrexlib-pcre (optional), * tarantool/http (optional, for GraphiQL). * For test (additionally to 'for use'): * python 2.7, * virtualenv, * luacheck, - * >=tarantool/avro-schema-2.2.2-4-g1145e3e, - * >=tarantool/shard-1.1-92-gec1a27e (but < 2.0) or - >=tarantool/shard-2.1-0-g0a7d98f, + * \>=tarantool/avro-schema-2.2.2-4-g1145e3e, + * \>=tarantool/shard-1.1-92-gec1a27e (but < 2.0) or + \>=tarantool/shard-2.1-0-g0a7d98f, + * lrexlib-pcre2 or lrexlib-pcre, * tarantool/http. * For building apidoc (additionally to 'for use'): * ldoc. diff --git a/rpm/prebuild-el-6.sh b/rpm/prebuild-el-6.sh new file mode 100755 index 0000000..0df654a --- /dev/null +++ b/rpm/prebuild-el-6.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +set -exu # Strict shell (w/o -o pipefail) + +sudo yum -y install https://centos6.iuscommunity.org/ius-release.rpm +sudo yum -y install python27 python27-devel diff --git a/rpm/tarantool-graphql.spec b/rpm/tarantool-graphql.spec new file mode 100644 index 0000000..69b089a --- /dev/null +++ b/rpm/tarantool-graphql.spec @@ -0,0 +1,70 @@ +Name: tarantool-graphql +# During package building {version} is overwritten by Packpack with +# VERSION. It is set to major.minor.patch.number_of_commits_above_last_tag. +# major.minor.patch tag and number of commits above are taken from the +# github repository: https://github.com/tarantool/graphql +Version: 0.0.1 +Release: 1%{?dist} +Summary: Set of adapters for GraphQL query language to the Tarantool data model +Group: Applications/Databases +License: BSD +URL: https://github.com/tarantool/graphql +Source0: https://github.com/tarantool/graphql/archive/%{version}/graphql-%{version}.tar.gz +BuildArch: noarch + +# Dependencies for `make test` +BuildRequires: python-virtualenv +BuildRequires: tarantool-luacheck +BuildRequires: tarantool >= 1.9.0.0 +BuildRequires: tarantool-lulpeg +BuildRequires: tarantool-avro-schema >= 2.2.2.4 +BuildRequires: tarantool-shard >= 1.1.92 +BuildRequires: tarantool-lrexlib-pcre2 +BuildRequires: tarantool-http + +# Weak references are not supported in RHEL / CentOS. +# +# https://fedoraproject.org/wiki/Packaging:WeakDependencies +# https://bugzilla.redhat.com/show_bug.cgi?id=91458 +# https://bugzilla.redhat.com/show_bug.cgi?id=1427674 + +# Dependencies for a user +Requires: tarantool >= 1.9.0.0 +Requires: tarantool-lulpeg +Requires: tarantool-avro-schema >= 2.0.71 +#Suggests: tarantool-shard >= 1.1.91 +#Suggests: tarantool-lrexlib-pcre2 +#Suggests: tarantool-http + +%description +Set of adapters for GraphQL query language to the Tarantool data model + +# /usr/share/tarantool +%define module_dir %{_datadir}/tarantool +%define br_module_dir %{buildroot}%{module_dir} + +%prep +%setup -q -n %{name}-%{version} + +%check +# Originally 'check' section is executed in +# /build/usr/src/degub/tarantool-graphql directory. +# It makes names of unix sockets too long and therefore tests fail. +# To avoid it we copy sources to /build/graphql and run tests there. +cp -R . /build/graphql +cd /build/graphql +make test + +%install +mkdir -p %{br_module_dir} +cp -r graphql %{br_module_dir} + +%files +%{module_dir}/graphql + +%changelog +* Thu Jul 12 2018 Ivan Koptelov 0.0.1-1 +- Initial release 0.0.1 + +* Sun May 20 2018 Alexander Turenko 0.0.0-1 +- Create pseudo-release 0.0.0 for testing deployment diff --git a/tools/ubuntu.trusty.test.sh b/tools/ubuntu.trusty.test.sh new file mode 100755 index 0000000..a3dbc10 --- /dev/null +++ b/tools/ubuntu.trusty.test.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +set -exu # Strict shell (w/o -o pipefail) + +sudo apt-get -qq update +curl http://download.tarantool.org/tarantool/1.9/gpgkey | \ + sudo apt-key add - +release=`lsb_release -c -s` + +# install https download transport for APT +sudo apt-get -y install apt-transport-https + +# append two lines to a list of source repositories +sudo rm -f /etc/apt/sources.list.d/*tarantool*.list +echo "deb http://download.tarantool.org/tarantool/1.9/ubuntu/ ${release} main" | \ + sudo tee /etc/apt/sources.list.d/tarantool_1_9.list +echo "deb-src http://download.tarantool.org/tarantool/1.9/ubuntu/ ${release} main" | \ + sudo tee -a /etc/apt/sources.list.d/tarantool_1_9.list + +sudo apt-get update +sudo apt-get -y install tarantool tarantool-dev libmsgpuck-dev luarocks + +tarantoolctl rocks install lulpeg +tarantoolctl rocks install lrexlib-pcre +tarantoolctl rocks install http +tarantoolctl rocks install shard "${SHARD_VERSION}" +tarantoolctl rocks install avro-schema "${AVRO_SCHEMA}" + +sudo luarocks install luacheck +sudo pip install virtualenv + +git submodule update --recursive --init +make test