Skip to content

Commit

Permalink
[spcgeonode] CI : use docker executor again and run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierdalang committed Oct 22, 2018
1 parent 9ac5c90 commit 071c24f
Showing 1 changed file with 29 additions and 18 deletions.
47 changes: 29 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
version: 2
version: 2.1

jobs:
build:
machine: true

docker:
- image: circleci/buildpack-deps:trusty

parameters:
cache_layers:
default: false
type: boolean

steps:

- checkout

- run:
name: Install Docker Compose
command: |
sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- setup_remote_docker:
docker_layer_caching: << parameters.cache_layers >>

- run:
name: Build and start the stack
Expand All @@ -25,10 +30,10 @@ jobs:
m=60
until [ $n -gt $m ]
do
echo "Waiting 60 seconds..."
sleep 60
DJANGO_STATUS=$(docker inspect --format="{{json .State.Health.Status}}" spcgeonode_django_1)
GEOSERVER_STATUS=$(docker inspect --format="{{json .State.Health.Status}}" spcgeonode_geoserver_1)
echo ""
echo "Waited $n min (out of $m min)"
echo "Django: $DJANGO_STATUS"
echo "Geoserver: $GEOSERVER_STATUS"
Expand All @@ -44,28 +49,33 @@ jobs:
- run:
name: Show state (debug)
command: docker ps
when: always
when: on_fail

- run:
name: Geoserver logs (debug)
command: docker logs spcgeonode_geoserver_1 --tail 500
when: always
when: on_fail

- run:
name: Django logs (debug)
command: docker logs spcgeonode_django_1 --tail 500
when: always
when: on_fail

# - run: Run the Geonode integration test suite # TODO : reenable this if we manage to have them pass
# - run: docker-compose -f docker-compose.yml exec postgres psql -U postgres -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity;"
# - run: docker-compose -f docker-compose.yml exec postgres psql -U postgres -c "CREATE DATABASE test_postgres WITH TEMPLATE postgres;"
# - run: docker-compose -f docker-compose.yml exec django python manage.py test geonode.tests.integration
- run:
name: Run test suite
command: |
docker-compose exec django bash -c 'python manage.py test $(python -c "import sys;from geonode import settings;sys.stdout.write('\'' '\''.join([a for a in settings.GEONODE_APPS]))")'
working_directory: scripts/spcgeonode/

# TODO : run integration tests too

workflows:
version: 2

commit:
jobs:
- build
- build:
cache_layers: true

nightly:
triggers:
- schedule:
Expand All @@ -75,4 +85,5 @@ workflows:
only:
- spcgeonode-release
jobs:
- build
- build:
cache_layers: false

0 comments on commit 071c24f

Please sign in to comment.