-
Notifications
You must be signed in to change notification settings - Fork 38
/
run-tests.sh
executable file
·61 lines (47 loc) · 1.51 KB
/
run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
# quit on errors:
set -o errexit
# quit on unbound symbols:
set -o nounset
WORKDIR=$(mktemp -d)
finish() {
echo "Cleaning up."
docker-compose -f docker-compose.full.yml down --volumes --remove-orphans &
pipenv --rm || true
rm -rf "${WORKDIR}"
}
trap finish EXIT
PROJECT_NAME="my-site"
cookiecutter --no-input -o "$WORKDIR" . \
project_name=${PROJECT_NAME} \
database=${COOKIECUTTER_DATABASE:-postgresql} \
elasticsearch=${COOKIECUTTER_ELASTICSEARCH:-7}
cd "${WORKDIR}/${PROJECT_NAME}"
# Check local installation (this also generates the Pipfile.lock)
./scripts/bootstrap
# Initialize git in the repository for 'check-manifest' to work
git init
git add -A
# Update MANIFEST.in
pipenv run check-manifest -u || true
# Build application docker images
./docker/build-images.sh
# Fire up a full instance via docker-compose.full.yml
# We will use the services (DB, ES, etc) for running the tests locally
docker-compose -f docker-compose.full.yml up -d
./docker/wait-for-services.sh --full
echo "All services are up."
docker-compose -f docker-compose.full.yml down
echo "Services successfully stopped"
# Fire up the services we need for testing
docker-compose up -d
./docker/wait-for-services.sh
# Run the instance tests
REQUIREMENTS=prod ./run-tests.sh