mirror of https://github.com/MieuxVoter/mvapi
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.3 KiB
40 lines
1.3 KiB
version: 2
|
|
jobs:
|
|
build:
|
|
# We need a machine executor to mount volumes
|
|
machine:
|
|
image: ubuntu-1604:201903-01
|
|
|
|
environment:
|
|
TEST_RESULTS: /tmp/test-results
|
|
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Add a secret key
|
|
command: echo "DJANGO_SECRET_KEY=ersldnfnfkfhfhefhfadhfadsklfhaskdlfhdvn" >> .env.local
|
|
- run:
|
|
name: Start container
|
|
command: |
|
|
set -x
|
|
docker-compose up -d
|
|
# docker-compose start 3 services
|
|
# - project_web_1
|
|
# - project_dash_1
|
|
# - project_db_1
|
|
|
|
# Recover service name for web
|
|
WEB=$(docker ps --format "{{.Names}}" -f name=web)
|
|
|
|
# we start another container with curl in the same network
|
|
docker run --network container:$WEB \
|
|
circleci/buildpack-deps:curl-dind --retry 10 --retry-delay 1 --retry-connrefused http://localhost:8000/api/
|
|
|
|
mkdir -p $TEST_RESULTS
|
|
|
|
# Notice this `set -o pipefail`, this will cause script to fail if `make test` fails
|
|
# without this option, script returns success regardless of testing result due to pipe after test command
|
|
set -ou pipefail
|
|
|
|
docker exec -it $WEB python manage.py test | tee ${TEST_RESULTS}/django-test.out
|