forked from edgewall/trac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
225 lines (225 loc) · 8.23 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
version: ~> 1.0
dist: bionic
language: python
addons:
apt:
packages: [libapr1-dev, libaprutil1-dev, liblz4-dev, libutf8proc-dev, swig,
firefox-geckodriver, python3-tidylib]
homebrew:
packages: [[email protected], subversion, geckodriver, tidy-html5]
firefox: latest
cache:
ccache: true
directories:
- "$HOME/.cache/pip"
- "$HOME/.pyenv"
- "$HOME/src"
- "$HOME/Library/Caches/Homebrew"
before_install:
- set -e
- test -d "$HOME/.pip" || mkdir "$HOME/.pip"
- |
{
echo "[global]"
echo "cache-dir = $HOME/.cache/pip"
echo "[list]"
echo "format = columns"
} >"$HOME/.pip/pip.conf"
- |
if [ "$TRAVIS_OS_NAME" = linux ]; then
: ${pyver:=$TRAVIS_PYTHON_VERSION}
elif [ "$TRAVIS_OS_NAME" = osx ]; then
python_prefix="$(brew --prefix [email protected])"
export PATH="$python_prefix/libexec/bin:$PATH"
pyver="$(python -c 'import sys; print("%d.%d" % sys.version_info[:2])')"
venvdir="$HOME/venv-$pyver"
python -m venv "$venvdir"
source "$venvdir/bin/activate"
# Link Subversion bindings to the virtualenv
if [ "$build" != minimum ]; then
python_global="$python_prefix/libexec/bin/python"
print_sitelib='from distutils.sysconfig import get_python_lib; print(get_python_lib())'
sitelib_global="$($python_global -c "$print_sitelib")"
sitelib_venv="$(python -c "$print_sitelib")"
ln -s "$sitelib_global/svn" "$sitelib_venv/svn"
ln -s "$sitelib_global/libsvn" "$sitelib_venv/libsvn"
python -c 'from svn import core; print(str(core.SVN_VERSION, "ascii"))'
fi
else
echo "Unknown environment: '$TRAVIS_OS_NAME'"
exit 1
fi
- pip install --upgrade pip setuptools wheel
- python --version
- pip list
install:
- set -e
- |
if [ "$TRAVIS_BUILD_STAGE_NAME" = Test ]; then
requires='Jinja2 selenium pytidylib'
if [ "$build" != minimum ]; then requires="$requires Babel Pygments docutils textile pytz"; fi
if [ "$tracdb" = postgresql ]; then requires="$requires psycopg2"; fi
if [ "$tracdb" = mysql ]; then requires="$requires PyMySQL"; fi
else
requires='Jinja2 Babel'
fi
pip install $requires
python -c 'import sys, pkg_resources as p; p.require(sys.argv[1:])' $requires
- pip list
- |
if [ "$build" != minimum -a "$TRAVIS_BUILD_STAGE_NAME" = Test -a "$TRAVIS_OS_NAME" = linux ]; then
(
set -ex
test -d "$HOME/src" || mkdir "$HOME/src"
svnver=1.14.1
svnurl="https://archive.apache.org/dist/subversion/subversion-$svnver.tar.bz2"
svnsrc="$HOME/src/subversion-$svnver.tar.bz2"
svnpybin="$HOME/src/subversion-${svnver}-py${pyver}.tar.gz"
if ! tar xzf "$svnpybin" -C / || \
[ "$(python -c 'from svn import core; print(str(core.SVN_VER_NUM, "ascii"))')" != "$svnver" ];
then
curl -o "/tmp/subversion-$svnver.tar.bz2" "$svnurl"
mv "/tmp/subversion-$svnver.tar.bz2" "$svnsrc"
if git --git-dir "$HOME/src/py3c" count-objects >/dev/null 2>&1; then
git --git-dir "$HOME/src/py3c" fetch origin
else
rm -rf "$HOME/src/py3c"
git clone --mirror https://github.com/encukou/py3c "$HOME/src/py3c"
fi
test -d "$HOME/work" || mkdir "$HOME/work"
tar xaf "$svnsrc" -C "$HOME/work"
git --git-dir "$HOME/src/py3c" archive --format=tar --prefix=py3c/ v1.1 | tar xf - -C "$HOME/work"
set +ex
cd "$HOME/work/subversion-$svnver"
set -ex
prefix="$(python -c 'import sys; print(sys.prefix)')"
./autogen.sh
./configure \
--prefix="$prefix" \
--with-apr=/usr/bin/apr-1-config \
--with-apr-util=/usr/bin/apu-1-config \
--with-swig=/usr/bin/swig \
--with-py3c="$HOME/work/py3c" \
--without-apxs \
--without-doxygen \
--without-berkeley-db \
--without-gpg-agent \
--without-gnome-keyring \
--without-kwallet \
--without-jdk \
--disable-javahl \
PERL=none \
RUBY=none \
PYTHON="$(python -c 'import sys; print(sys.executable)')"
sitedir="$(python -c '\
import os, sys; \
print(os.path.join(sys.prefix, "lib", \
"python{0}.{1}".format(*sys.version_info), \
"site-packages")); \
')"
# travis-ci environment has 2 cpu cores
make -j3 \
swig_pydir="$sitedir/libsvn" \
swig_pydir_extra="$sitedir/svn" \
all swig-py
make \
DESTDIR=/tmp/subversion-bin \
swig_pydir="$sitedir/libsvn" \
swig_pydir_extra="$sitedir/svn" \
install install-swig-py
tar czf "$svnpybin" -C /tmp/subversion-bin "${prefix#/}"
tar xzf "$svnpybin" -C /
fi
python -c 'from svn import core; print(str(core.SVN_VERSION, "ascii"))'
)
fi
- |
case "$tracdb" in
sqlite) tracdb_uri='sqlite:test.db' ;;
postgresql) tracdb_uri='postgres://tracuser:password@localhost/trac?schema=tractest' ;;
mysql) tracdb_uri='mysql://tracuser:password@localhost/trac?charset=utf8mb4' ;;
*) tracdb_uri= ;;
esac
echo ".uri = $tracdb_uri" >Makefile.cfg
- echo "$tracdb_version"
before_script:
- |
case "$tracdb" in
postgresql)
if [ "$TRAVIS_OS_NAME" = osx ]; then
rm -rf /usr/local/var/postgres
pg_ctl initdb --pgdata /usr/local/var/postgres
pg_ctl -w start --pgdata /usr/local/var/postgres --log /usr/local/var/postgres/postgresql.log || {
rc=$?
cat /usr/local/var/postgres/postgresql.log
exit $rc
}
createuser -s postgres
fi
tracdb_version="PostgreSQL: $(psql -U postgres -t -c 'SELECT version()')"
echo "$tracdb_version"
psql -U postgres -e -c "CREATE USER tracuser NOSUPERUSER NOCREATEDB CREATEROLE PASSWORD 'password';"
psql -U postgres -e -c "CREATE DATABASE trac OWNER tracuser;"
tracdb_uri='postgres://tracuser:password@localhost/trac?schema=tractest'
;;
mysql)
tracdb_version="MySQL: $(mysql -u root -sN -e 'SELECT version()')"
echo "$tracdb_version"
mysql -u root -v -e "CREATE DATABASE trac DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;"
mysql -u root -v -e "CREATE USER tracuser@localhost IDENTIFIED BY 'password';"
mysql -u root -v -e "GRANT ALL ON trac.* TO tracuser@localhost; FLUSH PRIVILEGES;"
tracdb_uri='mysql://tracuser:password@localhost/trac?charset=utf8mb4'
;;
sqlite)
tracdb_version=
tracdb_uri='sqlite:test.db'
;;
*)
tracdb_version=
tracdb_uri=
;;
esac
echo ".uri = $tracdb_uri" >Makefile.cfg
- echo "$tracdb_version"
script:
- set -e
- if [ "$build" != minimum ]; then make compile; fi
- make Trac.egg-info unit-test functional-test;
before_deploy:
- cat contrib/travis/edgewall_host_key >> $HOME/.ssh/known_hosts
- keyfile=/tmp/id_rsa
- openssl aes-256-cbc -K $encrypted_c097e63a4ddf_key -iv $encrypted_c097e63a4ddf_iv
-in contrib/travis/id_rsa.enc -out "$keyfile".base64 -d
- cat "$keyfile".base64 | base64 --decode >"$keyfile"
- chmod 0600 "$keyfile"
- pip install setuptools-git
- make compile release
notifications:
email:
recipients:
secure: lIn4a3G6ww61t3o12DS4aWwEwD6Hl2kxcsZgkxvhU2MgzviJ5j3EBV5F/BlbQmR1BqM51qgDOXoQTO+y9cvzAYBkIy/gfLqZjAl0hfZep6iGZgl1cnUW4c5i9+wkF8PzTaQm+q9gwlIQ7JVedWw9jzHBIn80tCgTcavahAzyelk=
jobs:
include:
- {os: linux, python: '3.9', env: 'tracdb= build=minimum'}
- {os: linux, python: '3.9', env: 'tracdb='}
- {os: linux, python: '3.8', env: 'tracdb='}
- {os: linux, python: '3.7', env: 'tracdb='}
- {os: linux, python: '3.6', env: 'tracdb='}
- {os: linux, python: '3.5', env: 'tracdb='}
- {os: linux, python: '3.9', env: 'tracdb=sqlite'}
- {os: linux, python: '3.9', env: 'tracdb=postgresql', services: postgresql}
- {os: linux, python: '3.9', env: 'tracdb=mysql', services: mysql}
- {os: osx, osx_image: xcode12.2, language: generic, env: 'tracdb= build=minimum'}
- {os: osx, osx_image: xcode12.2, language: generic, env: 'tracdb='}
- {os: osx, osx_image: xcode12.2, language: generic, env: 'tracdb=sqlite'}
- {os: osx, osx_image: xcode12.2, language: generic, env: 'tracdb=postgresql'}
- stage: deploy
before_script: skip
script: skip
deploy:
provider: script
skip_cleanup: true
script: scp -i "$keyfile" dist/Trac-* [email protected]:/var/ftp/pub/trac/incoming
on:
repo: edgewall/trac
all_branches: true