Skip to content

Commit 7da0a4c

Browse files
committed
Try running docker-compose during CI
1 parent 1bd0251 commit 7da0a4c

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
__pycache__
22
.happy
33
.coverage
4+
.env
45
db.sqlite3
56
ci.db
67
server.log

circle.yml

+17
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ jobs:
1515
key: coverage-{{ .Revision }}
1616
paths:
1717
- .coverage
18+
integration:
19+
docker:
20+
- image: nibbleproject/nibble-ci
21+
steps:
22+
- checkout
23+
- setup_remote_docker
24+
- run:
25+
name: Install requirements
26+
command: sudo pipenv install --system --dev
27+
- run:
28+
name: Run integration tests
29+
command: |
30+
set -x
31+
docker-compose up -d
32+
docker-compose stop
1833
coverage:
1934
docker:
2035
- image: nibbleproject/nibble-ci
@@ -75,6 +90,7 @@ workflows:
7590
master:
7691
jobs:
7792
- test
93+
- integration
7894
- coverage:
7995
requires:
8096
- test
@@ -84,6 +100,7 @@ workflows:
84100
- deploy_staging:
85101
requires:
86102
- test
103+
- integration
87104
filters:
88105
branches:
89106
only: master

docker-compose.yml

+4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
web:
22
build: .
33
environment:
4+
- DATABASE_USER
45
- DATABASE_PASSWORD
56
links:
67
- postgres
78
ports:
89
- "5000:5000"
910
postgres:
1011
image: postgres
12+
environment:
13+
- POSTGRES_USER=test
14+
- POSTGRES_PASSWORD=test

docker/run.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ if [ "$1" = 'start' ];
44
then
55
if [ -n "$DATABASE_URL" ]; then
66

7-
echo "There's a database url already...???"
7+
echo "Found a database URL, skipping setup."
88

99
elif [ -n "$POSTGRES_PORT_5432_TCP_ADDR" ]; then
1010

1111
echo 'We got postgres!!!!'
1212

13+
if [ -z "$DATABASE_USER" ]; then
14+
echo 'No application database user defined. Stopping.'
15+
exit 1
16+
fi
17+
1318
if [ -z "$DATABASE_PASSWORD" ]; then
1419
echo 'No application database password defined. Stopping.'
1520
exit 1
@@ -63,7 +68,7 @@ then
6368
export DATABASE_URL="postgres://$DATABASE_USER:$DATABASE_PASSWORD@$POSTGRES_PORT_5432_TCP_ADDR:$POSTGRES_PORT_5432_TCP_PORT/$DATABASE_NAME"
6469

6570
else
66-
echo 'No database ¯\_(ツ)_/¯'
71+
echo 'No database defined, stopping. ¯\_(ツ)_/¯'
6772
exit 1
6873
fi
6974

0 commit comments

Comments
 (0)