-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathbuildspec-2-caching.yml
80 lines (68 loc) · 2.62 KB
/
buildspec-2-caching.yml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
version: 0.2
phases:
install:
commands:
#This file configures apt to remove it's cache after installs - we want this cache, so we remove this config
- rm -f /etc/apt/apt.conf.d/docker-clean
#Install required packages
- |
export DEBIAN_FRONTEND=noninteractive
#Install php7.1
apt-get update
apt-get install -y software-properties-common
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
apt-get update
# Install PHP 7.1. The ondrej/php repository also contains other versions of php, try just changing the version number
apt-get install -y php7.1\
php7.1-ldap \
php7.1-xml \
php7.1-xmlrpc \
php7.1-zip \
php7.1-mysql \
php7.1-mbstring \
php7.1-mcrypt \
php7.1-gd \
php7.1-readline \
php7.1-opcache \
php7.1-xdebug \
php7.1-dom \
php-xdebug \
php7.1-curl \
unzip
#Enable xdebug - phpunit uses this for code coverage
phpenmod xdebug
#Install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php ;
php -r "unlink('composer-setup.php');" ;
mv composer.phar /usr/local/bin/composer
#Various handy node based dev tools - do you need these during your build? Comment if not.
#npm install -g gulp
#npm install -g grunt
#npm install -g webpack
# Start Mysql if you need it
# - apt-get install -y mysql-server
# - su mysql -s /bin/bash -c "/usr/sbin/mysqld" &
build:
commands:
- echo Build started on `date`
- echo Installing composer deps
- composer install --no-progress --no-suggest
post_build:
commands:
- echo Build completed on `date`
# Do you need to do this? In many cases phpunit will use sqllite or similar to avoid the need for a real DB.
# If you don't need it delete it
# - /usr/bin/mysql -u root -e "GRANT ALL ON *.* TO 'test'@'localhost' IDENTIFIED BY '' WITH GRANT OPTION"
# - mysqladmin -u test create test
- ./vendor/bin/phpunit
cache:
paths:
# Debian package caches, so we don't need to keep redownloading debian packages:
- /var/cache/apt/**/*
- /var/lib/apt/lists/**/*
# Composer cache:
- /root/.composer/**/*
# Node modules, if you need nodejs based tools like webpack during your build
- /root/.npm/**/*
- /usr/lib/node_modules/**/*