travis: provide local OBS setup and clone base data.

This commit is contained in:
Jimmy Berry 2017-10-19 00:24:13 -05:00
parent ed662be413
commit c4d8661f1c
2 changed files with 60 additions and 2 deletions

View File

@ -49,16 +49,26 @@ matrix:
- flake8
- env: TEST_SUITE=nosetests
sudo: required
services:
- docker
language: python
python: 2.7
before_install:
# provides xmllint used by test_bootstrap_copy (tests.freeze_tests.TestFreeze)
- sudo apt-get install libxml2-utils
install:
# needed to install osc from git in requirements.txt
- pip install pycurl urlgrabber
# urlgrabber needed to install osc from git in requirements.txt
# m2crypto for osc to be runable as used in docker-compose-obs
- pip install pycurl urlgrabber m2crypto
- pip install -r requirements.txt
- pip install python-coveralls
before_script:
# travis-ci/travis-ci#7008: stop services to make room for OBS setup
- sudo service mysql stop
- sudo service memcached stop
- ./dist/ci/docker-compose-obs
# Needs python prefix to use the correct interpretor.
- python ./obs_clone.py --debug --apiurl-target local
script:
- nosetests --with-coverage --cover-package=. --cover-inclusive
after_success:

48
dist/ci/docker-compose-obs vendored Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
set -e
OBS_DIRECTORY=${OBS_DIRECTORY:-.open-build-service}
if [ ! -d "$OBS_DIRECTORY" ] ; then
git clone --depth 1 https://github.com/openSUSE/open-build-service.git "$OBS_DIRECTORY"
if [ ! -f ~/.oscrc ] ; then
# openSUSE/open-build-service#3946: would elevate the need, but rejected.
eval $(./dist/ci/osc-credentials-throwaway)
OBS_USER="$user" OBS_PASS="$pass" ./dist/ci/osc-init
fi
cat <<EOF >> ~/.oscrc
[http://0.0.0.0:3000]
user = Admin
pass = opensuse
aliases = local
EOF
fi
cd "$OBS_DIRECTORY"
git pull origin master
# https://github.com/openSUSE/open-build-service/blob/master/CONTRIBUTING.md
git submodule init
git submodule update
rake docker:build
# See `docker-compose logs` instead of changing output redirection.
docker-compose up -d --remove-orphans
osc='osc'
if ! which osc &> /dev/null ; then
# Workaround for pip install that occurs on travis.
osc='osc-wrapper.py'
fi
until $osc -q -A local api /about 2> /dev/null ; do
echo "waiting for OBS to be responsive..."
((c++)) && ((c==60)) && docker-compose logs && exit 1
sleep 1
done