diff --git a/.travis.yml b/.travis.yml index 2775fe842be..e4bcf7c215d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,15 @@ -sudo: required +sudo: false language: python cache: + pip: true directories: - - $HOME/.cache/pip + - $HOME/buildout-cache before_cache: - rm -f $HOME/.cache/pip/log/debug.log -python: - - "2.7" - virtualenv: system_site_packages: true @@ -28,87 +26,113 @@ addons: - postgresql-9.6-postgis-2.3 - nginx -env: - - BACKEND: 'geonode.geoserver' - ON_TRAVIS: 'True' - TEST_RUN_CORE: 'True' - MONITORING_ENABLED: 'False' - - BACKEND: 'geonode.geoserver' - ON_TRAVIS: 'True' - TEST_RUN_INTERNAL_APPS: 'True' - MONITORING_ENABLED: 'False' - - BACKEND: 'geonode.geoserver' - DOCKER_COMPOSE_VERSION: 1.19.0 - # This is GeoServer server address - GEOSERVER_SERVER_URL: http://localhost:8080/geoserver/ - GEOSERVER_SERVER_PORT: 8080 - ON_TRAVIS: 'True' - TEST_RUN_INTEGRATION: 'True' - TEST_RUN_INTEGRATION_CSW: 'False' - TEST_RUN_INTEGRATION_BDD: 'False' - MONITORING_ENABLED: 'False' - CELERY_ALWAYS_EAGER: 'True' - - BACKEND: 'geonode.geoserver' - DOCKER_COMPOSE_VERSION: 1.19.0 - # This is GeoServer server address - GEOSERVER_SERVER_URL: http://localhost:8080/geoserver/ - GEOSERVER_SERVER_PORT: 8080 - ON_TRAVIS: 'True' - TEST_RUN_INTEGRATION: 'False' - TEST_RUN_INTEGRATION_CSW: 'True' - TEST_RUN_INTEGRATION_BDD: 'False' - MONITORING_ENABLED: 'False' - CELERY_ALWAYS_EAGER: 'True' - - BACKEND: 'geonode.geoserver' - DOCKER_COMPOSE_VERSION: 1.19.0 - # This is GeoServer server address - GEOSERVER_SERVER_URL: http://localhost:8080/geoserver/ - GEOSERVER_SERVER_PORT: 8080 - ON_TRAVIS: 'True' - TEST_RUN_INTEGRATION: 'False' - TEST_RUN_INTEGRATION_CSW: 'False' - TEST_RUN_INTEGRATION_BDD: 'True' - MONITORING_ENABLED: 'False' - CELERY_ALWAYS_EAGER: 'True' - - BACKEND: 'geonode.qgis_server' - DJANGO_SETTINGS_MODULE: 'geonode.local_settings' - DOCKER_COMPOSE_VERSION: 1.19.0 - # This is qgis server address - QGIS_SERVER_URL: http://localhost:9000/ - # This is the location of docker network bridge - # So QGIS server can access this address - SITEURL: http://localhost:8000/ - QGIS_SERVER_PORT: 9000 - ON_TRAVIS: 'True' - TEST_RUN_CORE: 'True' - MONITORING_ENABLED: 'False' - CELERY_ALWAYS_EAGER: 'True' - - BACKEND: 'geonode.qgis_server' - DJANGO_SETTINGS_MODULE: 'geonode.local_settings' - DOCKER_COMPOSE_VERSION: 1.19.0 - # This is qgis server address - QGIS_SERVER_URL: http://localhost:9000/ - # This is the location of docker network bridge - # So QGIS server can access this address - SITEURL: http://localhost:8000/ - QGIS_SERVER_PORT: 9000 - ON_TRAVIS: 'True' - TEST_RUN_INTERNAL_APPS: 'True' - MONITORING_ENABLED: 'False' - CELERY_ALWAYS_EAGER: 'True' - - BACKEND: 'geonode.qgis_server' - DJANGO_SETTINGS_MODULE: 'geonode.local_settings' - DOCKER_COMPOSE_VERSION: 1.19.0 - # This is qgis server address - QGIS_SERVER_URL: http://localhost:9000/ - # This is the location of docker network bridge - # So QGIS server can access this address - SITEURL: http://localhost:8000/ - QGIS_SERVER_PORT: 9000 - ON_TRAVIS: 'True' - TEST_RUN_INTEGRATION: 'True' - MONITORING_ENABLED: 'False' - CELERY_ALWAYS_EAGER: 'True' +matrix: + fast_finish: true + include: + - name: "GeoServer-backend Core Modules Smoke Tests" + python: 2.7 + env: + - BACKEND: 'geonode.geoserver' + ON_TRAVIS: 'True' + TEST_RUN_CORE: 'True' + MONITORING_ENABLED: 'False' + - name: "GeoServer-backend Contrib Apps Smoke Tests" + python: 2.7 + env: + - BACKEND: 'geonode.geoserver' + ON_TRAVIS: 'True' + TEST_RUN_INTERNAL_APPS: 'True' + MONITORING_ENABLED: 'False' + - name: "GeoServer-backend Integration Tests" + python: 2.7 + env: + - BACKEND: 'geonode.geoserver' + DOCKER_COMPOSE_VERSION: 1.19.0 + # This is GeoServer server address + GEOSERVER_SERVER_URL: http://localhost:8080/geoserver/ + GEOSERVER_SERVER_PORT: 8080 + ON_TRAVIS: 'True' + TEST_RUN_INTEGRATION: 'True' + TEST_RUN_INTEGRATION_CSW: 'False' + TEST_RUN_INTEGRATION_BDD: 'False' + MONITORING_ENABLED: 'False' + CELERY_ALWAYS_EAGER: 'True' + - name: "GeoServer-backend Integration CSW Tests" + python: 2.7 + env: + - BACKEND: 'geonode.geoserver' + DOCKER_COMPOSE_VERSION: 1.19.0 + # This is GeoServer server address + GEOSERVER_SERVER_URL: http://localhost:8080/geoserver/ + GEOSERVER_SERVER_PORT: 8080 + ON_TRAVIS: 'True' + TEST_RUN_INTEGRATION: 'False' + TEST_RUN_INTEGRATION_CSW: 'True' + TEST_RUN_INTEGRATION_BDD: 'False' + MONITORING_ENABLED: 'False' + CELERY_ALWAYS_EAGER: 'True' + - name: "GeoServer-backend Integration BDD Tests" + python: 2.7 + env: + - BACKEND: 'geonode.geoserver' + DOCKER_COMPOSE_VERSION: 1.19.0 + # This is GeoServer server address + GEOSERVER_SERVER_URL: http://localhost:8080/geoserver/ + GEOSERVER_SERVER_PORT: 8080 + ON_TRAVIS: 'True' + TEST_RUN_INTEGRATION: 'False' + TEST_RUN_INTEGRATION_CSW: 'False' + TEST_RUN_INTEGRATION_BDD: 'True' + MONITORING_ENABLED: 'False' + CELERY_ALWAYS_EAGER: 'True' + - name: "QGis Server-backend Core Modules Smoke Tests" + python: 2.7 + env: + - BACKEND: 'geonode.qgis_server' + DJANGO_SETTINGS_MODULE: 'geonode.local_settings' + DOCKER_COMPOSE_VERSION: 1.19.0 + # This is qgis server address + QGIS_SERVER_URL: http://localhost:9000/ + # This is the location of docker network bridge + # So QGIS server can access this address + SITEURL: http://localhost:8000/ + QGIS_SERVER_PORT: 9000 + ON_TRAVIS: 'True' + TEST_RUN_CORE: 'True' + MONITORING_ENABLED: 'False' + CELERY_ALWAYS_EAGER: 'True' + - name: "QGis Server-backend Contrib Apps Smoke Tests" + python: 2.7 + env: + - BACKEND: 'geonode.qgis_server' + DJANGO_SETTINGS_MODULE: 'geonode.local_settings' + DOCKER_COMPOSE_VERSION: 1.19.0 + # This is qgis server address + QGIS_SERVER_URL: http://localhost:9000/ + # This is the location of docker network bridge + # So QGIS server can access this address + SITEURL: http://localhost:8000/ + QGIS_SERVER_PORT: 9000 + ON_TRAVIS: 'True' + TEST_RUN_INTERNAL_APPS: 'True' + MONITORING_ENABLED: 'False' + CELERY_ALWAYS_EAGER: 'True' + - name: "QGis Server-backend Integration Tests" + python: 2.7 + env: + - BACKEND: 'geonode.qgis_server' + DJANGO_SETTINGS_MODULE: 'geonode.local_settings' + DOCKER_COMPOSE_VERSION: 1.19.0 + # This is qgis server address + QGIS_SERVER_URL: http://localhost:9000/ + # This is the location of docker network bridge + # So QGIS server can access this address + SITEURL: http://localhost:8000/ + QGIS_SERVER_PORT: 9000 + ON_TRAVIS: 'True' + TEST_RUN_INTEGRATION: 'True' + MONITORING_ENABLED: 'False' + CELERY_ALWAYS_EAGER: 'True' branches: only: @@ -117,6 +141,7 @@ branches: - 2.6.x before_install: + - mkdir -p $HOME/buildout-cache/{eggs,downloads} - scripts/misc/geoserver_server_setup.sh before_install - scripts/misc/qgis_server_setup.sh before_install - chmod +x scripts/misc/bdd_setup.sh diff --git a/pavement.py b/pavement.py index 617e8bfd043..d12010881c0 100644 --- a/pavement.py +++ b/pavement.py @@ -141,31 +141,35 @@ def setup_geoserver(options): jetty_runner = download_dir / \ os.path.basename(dev_config['JETTY_RUNNER_URL']) - grab( - options.get( - 'geoserver', - dev_config['GEOSERVER_URL']), - geoserver_bin, - "geoserver binary") - grab( - options.get( - 'jetty', - dev_config['JETTY_RUNNER_URL']), - jetty_runner, - "jetty runner") - - if not geoserver_dir.exists(): - geoserver_dir.makedirs() - - webapp_dir = geoserver_dir / 'geoserver' - if not webapp_dir: - webapp_dir.makedirs() - - print 'extracting geoserver' - z = zipfile.ZipFile(geoserver_bin, "r") - z.extractall(webapp_dir) + if _django_11 and (integration_tests or integration_csw_tests or integration_bdd_tests): + """Will make use of the docker container for the Integration Tests""" + pass + else: + grab( + options.get( + 'geoserver', + dev_config['GEOSERVER_URL']), + geoserver_bin, + "geoserver binary") + grab( + options.get( + 'jetty', + dev_config['JETTY_RUNNER_URL']), + jetty_runner, + "jetty runner") - _install_data_dir() + if not geoserver_dir.exists(): + geoserver_dir.makedirs() + + webapp_dir = geoserver_dir / 'geoserver' + if not webapp_dir: + webapp_dir.makedirs() + + print 'extracting geoserver' + z = zipfile.ZipFile(geoserver_bin, "r") + z.extractall(webapp_dir) + + _install_data_dir() @task @@ -485,7 +489,7 @@ def start(): """ Start GeoNode (Django, GeoServer & Client) """ - # sh('sleep 30') + sh('sleep 30') info("GeoNode is now available.") @@ -526,7 +530,7 @@ def stop_geoserver(): info('Stopping geoserver (process number %s)' % int(pid)) os.kill(int(pid), signal.SIGKILL) os.kill(int(pid), 9) - # sh('sleep 30') + sh('sleep 30') # Check if the process that we killed is alive. try: os.kill(int(pid), 0) @@ -801,7 +805,7 @@ def test_bdd(): call_task('reset') call_task('setup') call_task('sync') - # sh('sleep 30') + sh('sleep 30') info("GeoNode is now available, running the bdd tests now.") sh('py.test') @@ -837,7 +841,7 @@ def test_integration(options): # Start QGis Server call_task('start_qgis_server') - # sh('sleep 30') + sh('sleep 30') name = options.get('name', 'geonode.tests.integration') settings = options.get('settings', '') @@ -871,7 +875,7 @@ def test_integration(options): sh('%s python -W ignore manage.py runmessaging %s' % (settings, foreground)) sh('%s python -W ignore manage.py runserver %s %s' % (settings, bind, foreground)) - # sh('sleep 30') + sh('sleep 30') settings = 'REUSE_DB=1 %s' % settings live_server_option = '--liveserver=localhost:8000' @@ -925,8 +929,7 @@ def run_tests(options): _backend = os.environ.get('BACKEND', OGC_SERVER['default']['BACKEND']) if _backend == 'geonode.geoserver' and 'geonode.geoserver' in INSTALLED_APPS: call_task('test_integration', - options={'name': 'geonode.upload.tests.integration', - 'settings': 'geonode.upload.tests.test_settings'}) + options={'name': 'geonode.upload.tests.integration'}) elif integration_csw_tests: call_task('test_integration', options={'name': 'geonode.tests.csw'}) diff --git a/travis.cfg b/travis.cfg new file mode 100644 index 00000000000..28d23c731a2 --- /dev/null +++ b/travis.cfg @@ -0,0 +1,19 @@ +[buildout] +extends = + base.cfg + plone-x.x.x.cfg + solr.cfg + solr-x.x.x.cfg + versions.cfg +parts += + code-analysis + +# caches, see also .travis.yaml +# one should not depend on '/home/travis' but it seems stable in containers. +eggs-directory = /home/travis/buildout-cache/eggs +download-cache = /home/travis/buildout-cache/downloads + +[code-analysis] +recipe = plone.recipe.codeanalysis +pre-commit-hook = False +# return-status-codes = True