Skip to content

Commit aa9c3ff

Browse files
author
Ivan Koptelov
committed
Add RPM's build and deploy (in travis)
1 parent 8662d92 commit aa9c3ff

File tree

3 files changed

+136
-20
lines changed

3 files changed

+136
-20
lines changed

.travis.yml

+94-20
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
sudo: required
2+
services:
3+
- docker
4+
15
language: c
2-
sudo: false
36

47
cache:
5-
directories: here
8+
directories:
9+
- $HOME/.cache
10+
11+
git:
12+
depth: 100500
613

714
matrix:
815
include:
@@ -16,26 +23,93 @@ matrix:
1623
env: LUA="luajit 2.0"
1724
- compiler: ": LuaJIT21"
1825
env: LUA="luajit 2.1"
26+
- env: OS=el DIST=6 PRODUCT=tarantool-luacheck
27+
- env: OS=el DIST=7 PRODUCT=tarantool-luacheck
28+
- env: OS=fedora DIST=26 PRODUCT=tarantool-luacheck
29+
- env: OS=fedora DIST=27 PRODUCT=tarantool-luacheck
1930

2031
install:
21-
- pip install --user hererocks
22-
- pip install --user codecov
23-
- hererocks here --$LUA -r https://github.com/mpeterv/luarocks@upgrade-install
24-
- export PATH="$PWD/here/bin:$PATH"
25-
- luarocks install lanes --upgrade --upgrade-deps
26-
- luarocks install busted --upgrade --upgrade-deps
27-
- luarocks install cluacov --upgrade --upgrade-deps
28-
32+
- |
33+
if [ -n "${LUA}" ]; then
34+
pip install --user hererocks
35+
pip install --user codecov
36+
sudo apt-get install luarocks
37+
hererocks here --$LUA -r https://github.com/mpeterv/luarocks@upgrade-install
38+
export PATH="$PWD/here/bin:$PATH"
39+
luarocks install lanes --upgrade --upgrade-deps
40+
luarocks install busted --upgrade --upgrade-deps
41+
luarocks install cluacov --upgrade --upgrade-deps
42+
fi;
2943
script:
30-
- busted -c
31-
- lua -e 'package.path="./src/?.lua;./src/?/init.lua;"..package.path' -lluacov bin/luacheck.lua luacheck-dev-1.rockspec -j2
32-
- lua -e 'package.preload.lfs=error;package.path="./src/?.lua;./src/?/init.lua;"..package.path' -lluacov bin/luacheck.lua src | grep 'I/O error'
33-
- lua -e 'package.preload.lanes=error;package.path="./src/?.lua;./src/?/init.lua;"..package.path' -lluacov bin/luacheck.lua --version | grep 'Not found'
34-
- lua install.lua path/to/luacheck
35-
- mv src src2
36-
- path/to/luacheck/bin/luacheck spec/*.lua
37-
- mv src2 src
44+
- |
45+
if [ -n "${LUA}" ]; then
46+
busted -c
47+
lua -e 'package.path="./src/?.lua;./src/?/init.lua;"..package.path' \
48+
-lluacov bin/luacheck.lua luacheck-dev-1.rockspec -j2
49+
lua -e 'package.preload.lfs=error;package.path="./src/?.lua;./src/?/init.lua;"..package.path' \
50+
-lluacov bin/luacheck.lua src | grep 'I/O error'
51+
lua -e 'package.preload.lanes=error;package.path="./src/?.lua;./src/?/init.lua;"..package.path' \
52+
-lluacov bin/luacheck.lua --version | grep 'Not found'
53+
lua install.lua path/to/luacheck
54+
mv src src2
55+
path/to/luacheck/bin/luacheck spec/*.lua
56+
mv src2 src
57+
else
58+
# Luacheck has a major.minor.patch versioning with unannotated tags.
59+
# Packpack can't handle it automaticaly, because it expects
60+
# annotated tags. We had to pass version by setting VERSION.
61+
# We set VERSION like: major.minor.patch.number_of_commits above
62+
# last major.minor.patch tag.
63+
VERSION=`git describe --tags | sed -e 's/\(.*\)-.*/\1/' -e 's/-/./'`
64+
git clone https://github.com/packpack/packpack.git packpack;
65+
VERSION=$VERSION RELEASE=$RELEASE packpack/packpack;
66+
fi;
3867
3968
after_script:
40-
- luacov
41-
- codecov -f luacov.report.out -X gcov
69+
if [ -n "${LUA}" ]; then
70+
luacov
71+
codecov -f luacov.report.out -X gcov
72+
fi;
73+
74+
before_deploy:
75+
- ls -l build/
76+
77+
deploy:
78+
# Deploy packages to PackageCloud
79+
- provider: packagecloud
80+
username: ${PACKAGECLOUD_USER}
81+
repository: "1_9"
82+
token: ${PACKAGECLOUD_TOKEN}
83+
dist: ${OS}/${DIST}
84+
package_glob: build/*.{rpm,deb}
85+
skip_cleanup: true
86+
on:
87+
branch: master
88+
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
89+
- provider: packagecloud
90+
username: ${PACKAGECLOUD_USER}
91+
repository: "1_10"
92+
token: ${PACKAGECLOUD_TOKEN}
93+
dist: ${OS}/${DIST}
94+
package_glob: build/*.{rpm,deb}
95+
skip_cleanup: true
96+
on:
97+
branch: master
98+
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
99+
- provider: packagecloud
100+
username: ${PACKAGECLOUD_USER}
101+
repository: "2_0"
102+
token: ${PACKAGECLOUD_TOKEN}
103+
dist: ${OS}/${DIST}
104+
package_glob: build/*.{rpm,deb}
105+
skip_cleanup: true
106+
on:
107+
branch: master
108+
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
109+
110+
notifications:
111+
email:
112+
recipients:
113+
114+
on_success: change
115+
on_failure: always

bin/luacheck.lua

100755100644
File mode changed.

rpm/luacheck.spec

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Name: luacheck
2+
# During package building {version} is overwritten by Packpack with
3+
# VERSION. It is set to major.minor.patch.number_of_commits_above_last_tag.
4+
# major.minor.patch tag and number of commits above are taken from the
5+
# github repository: https://github.com/tarantool/luacheck
6+
Version: 0.22.0
7+
Release: 1%{?dist}
8+
Summary: A static analyzer and a linter for Lua
9+
Group: Development/Tools
10+
License: MIT
11+
URL: https://github.com/tarantool/luacheck
12+
Source0: luacheck-%{version}.tar.gz
13+
14+
BuildArch: noarch
15+
16+
BuildRequires: tarantool >= 1.9.0.0
17+
Requires: tarantool >= 1.9.0.0
18+
19+
%description
20+
Luacheck is a command-line tool for linting and static analysis of Lua code.
21+
It is able to spot usage of undefined global variables, unused local variables
22+
and a few other typical problems within Lua programs.
23+
24+
%prep
25+
%setup -q -n luacheck-%{version}
26+
27+
%install
28+
echo \#\!/usr/bin/env tarantool$'\n'"require('luacheck.main')" > luacheck
29+
chmod +x luacheck
30+
mkdir -p %{buildroot}%{_bindir}
31+
mv luacheck %{buildroot}%{_bindir}/luacheck
32+
mkdir -p %{buildroot}%{_prefix}/share/tarantool/luacheck/
33+
cp ./src/luacheck/* %{buildroot}%{_prefix}/share/tarantool/luacheck/
34+
35+
%files
36+
%{_prefix}/share/tarantool/luacheck
37+
%{_bindir}/luacheck
38+
39+
%changelog
40+
41+
* Tue Jul 10 2018 Ivan Koptelov <[email protected]> 0.22.0-1
42+
- Initial release

0 commit comments

Comments
 (0)