-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
38 lines (38 loc) · 1.53 KB
/
Jenkinsfile
File metadata and controls
38 lines (38 loc) · 1.53 KB
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
#!groovy
node {
stage('Checkout') {
checkout scm
}
stage('Build docker containers') {
sh '''
cp parameters.yml ./base/php-bdd/app/config/
cd ./base/php-bdd/
composer install
cd ../../
docker-compose build
docker-compose up -d
docker exec `docker ps -q -f name=.base.` /root/wait-for-it.sh -t 120 mysql:3306 --
'''
}
stage('Create database and run tests') {
sh '''
docker exec `docker ps -q -f name=.base.` php app/console doctrine:database:drop --force --if-exists
docker exec `docker ps -q -f name=.base.` php app/console doctrine:database:create
docker exec `docker ps -q -f name=.base.` php app/console doctrine:schema:update --force
docker exec `docker ps -q -f name=.base.` php app/console doctrine:fixtures:load --fixtures=src/PHPBDD/PosterBundle/Tests/DataFixtures/ORM
docker exec `docker ps -q -f name=.base.` bin/phpunit -c app/
cd ./behat-tests/
composer install
bin/behat
'''
}
stage('Stop docker containers') {
sh '''
docker-compose stop
# Uncomment this to delete unnecessary images
# docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# docker volume ls -qf dangling=true | xargs -r docker volume rm
'''
}
}