Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ViderumGlobal/ckanext-gosh
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoran Pandovski committed Nov 1, 2017
2 parents 8491a95 + cb308db commit 4089071
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 31 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: python
python:
- "2.7"
env: PGVERSION=9.2
dist: trusty
sudo: required
cache: pip
before_install:
- chmod +x ./bin/travis-build.bash
- chmod +x ./bin/travis-run.sh
install: ./bin/travis-build.bash
script:
- ./bin/travis-run.sh
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
these badges work. The necessary Travis and Coverage config files have been
generated for you.
.. image:: https://travis-ci.org/viderum/ckanext-gosh.svg?branch=master
:target: https://travis-ci.org/viderum/ckanext-gosh
.. image:: https://travis-ci.org/ViderumGlobal/ckanext-gosh.svg?branch=master
:target: https://travis-ci.org/ViderumGlobal/ckanext-gosh

.. image:: https://coveralls.io/repos/viderum/ckanext-gosh/badge.svg
:target: https://coveralls.io/r/viderum/ckanext-gosh
.. image:: https://coveralls.io/repos/ViderumGlobal/ckanext-gosh/badge.svg
:target: https://coveralls.io/r/ViderumGlobal/ckanext-gosh

=============
ckanext-gosh
Expand Down
27 changes: 8 additions & 19 deletions bin/travis-build.bash
Original file line number Diff line number Diff line change
@@ -1,43 +1,32 @@
#!/bin/bash
set -e

echo "This is travis-build.bash..."
echo "This is travis-install-dependencies..."

echo "Installing the packages that CKAN requires..."
sudo apt-get update -qq
sudo apt-get install postgresql-$PGVERSION solr-jetty libcommons-fileupload-java:amd64=1.2.2-1
sudo apt-get install postgresql-$PGVERSION solr-jetty

echo "Installing CKAN and its Python dependencies..."
git clone https://github.com/ckan/ckan
cd ckan
export latest_ckan_release_branch=`git branch --all | grep remotes/origin/release-v | sort -r | sed 's/remotes\/origin\///g' | head -n 1`
echo "CKAN branch: $latest_ckan_release_branch"
git checkout $latest_ckan_release_branch
git checkout "ckan-2.7.2"
python setup.py develop
pip install -r requirements.txt --allow-all-external
pip install -r dev-requirements.txt --allow-all-external
pip install -r requirements.txt
pip install -r dev-requirements.txt
pip install coveralls
cd -

echo "Creating the PostgreSQL user and database..."
sudo -u postgres psql -c "CREATE USER ckan_default WITH PASSWORD 'pass';"
sudo -u postgres psql -c 'CREATE DATABASE ckan_test WITH OWNER ckan_default;'

echo "SOLR config..."
# Solr is multicore for tests on ckan master, but it's easier to run tests on
# Travis single-core. See https://github.com/ckan/ckan/issues/2972
sed -i -e 's/solr_url.*/solr_url = http:\/\/127.0.0.1:8983\/solr/' ckan/test-core.ini

echo "Initialising the database..."
cd ckan
paster db init -c test-core.ini
cd -

echo "Installing ckanext-gosh and its requirements..."
python setup.py develop
pip install -r requirements.txt
pip install -r dev-requirements.txt

echo "Moving test.ini into a subdir..."
mkdir subdir
mv test.ini subdir

echo "travis-build.bash is done."
echo "travis-install-dependencies is done."
11 changes: 3 additions & 8 deletions bin/travis-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ echo "NO_START=0\nJETTY_HOST=127.0.0.1\nJETTY_PORT=8983\nJAVA_HOME=$JAVA_HOME" |
sudo cp ckan/ckan/config/solr/schema.xml /etc/solr/conf/schema.xml
sudo service jetty restart

nosetests --ckan \
--nologcapture \
--with-pylons=subdir/test.ini \
--with-coverage \
--cover-package=ckanext.gosh \
--cover-inclusive \
--cover-erase \
--cover-tests
nosetests --ckan --with-pylons=test.travis.ini
# add this when coverage is set--with-coverage --cover-package=ckanext.gosh --cover-inclusive --cover-erase --cover-tests

49 changes: 49 additions & 0 deletions test.travis.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[DEFAULT]
debug = false
smtp_server = localhost
error_email_from = paste@localhost

[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 5000

[app:main]
use = config:ckan/test-core.ini

ckan.site_url = http://localhost:5000

solr_url = http://127.0.0.1:8983/solr

# Logging configuration
[loggers]
keys = root, ckan, sqlalchemy

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = WARN
handlers = console

[logger_ckan]
qualname = ckan
handlers =
level = INFO

[logger_sqlalchemy]
handlers =
qualname = sqlalchemy.engine
level = WARN

[handler_console]
class = StreamHandler
args = (sys.stdout,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s] %(message)s

0 comments on commit 4089071

Please sign in to comment.