Skip to content

Commit c04904f

Browse files
committed
Use a custom Docker image to speed up the builds
1 parent 3bcf2bc commit c04904f

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

Dockerfile.coverage

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM composer:1.5
2+
FROM php:rc-alpine
3+
4+
RUN apk add --no-cache --virtual .persistent-deps \
5+
git \
6+
icu-libs \
7+
zlib
8+
9+
RUN apk add --no-cache --virtual .build-deps \
10+
$PHPIZE_DEPS \
11+
icu-dev \
12+
zlib-dev \
13+
curl
14+
15+
RUN set -xe \
16+
&& docker-php-ext-install \
17+
intl \
18+
zip
19+
20+
COPY --from=0 /usr/bin/composer /usr/bin/composer
21+
22+
RUN curl -L -o /usr/bin/phpcov https://phar.phpunit.de/phpcov.phar \
23+
&& curl -L -o /usr/bin/coveralls https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar \
24+
&& chmod 755 /usr/bin/phpcov /usr/bin/coveralls
25+
26+
RUN apk del .build-deps
27+
28+
RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini
29+
30+
ENV COMPOSER_ALLOW_SUPERUSER 1

brigade.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,10 @@ const { events, Job } = require('brigadier');
33
const coverage = (event, project) => {
44
console.log(`===> Building ${ project.repo.cloneURL } ${ event.commit }`);
55

6-
const job = new Job('coverage', 'php:rc-alpine');
6+
const job = new Job('coverage', 'cooptilleuls/api-platform-core-brigade-coverage:latest');
77

88
job.tasks = [
99
'set -xe',
10-
'apk add --no-cache curl git openssl icu-libs zlib icu-dev zlib-dev $PHPIZE_DEPS',
11-
'docker-php-ext-install intl zip',
12-
'echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini',
13-
'curl -s -f -L -o /tmp/installer.php https://getcomposer.org/installer',
14-
'curl -s -f -L -o /tmp/install.sig https://composer.github.io/installer.sig',
15-
`php -r "
16-
\\$signature = trim(file_get_contents('/tmp/install.sig'));
17-
\\$hash = hash('SHA384', file_get_contents('/tmp/installer.php'));
18-
19-
if (hash_equals(\\$signature, \\$hash)) {
20-
echo 'Installer verified'.PHP_EOL;
21-
} else {
22-
unlink('/tmp/installer.php');
23-
echo 'Installer corrupt'.PHP_EOL;
24-
exit(1);
25-
}
26-
"`,
27-
'php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer',
28-
'curl -s -f -L -o /usr/bin/phpcov https://phar.phpunit.de/phpcov.phar',
29-
'curl -s -f -L -o /usr/bin/coveralls https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar',
30-
'chmod 755 /usr/bin/phpcov /usr/bin/coveralls',
3110
'cd /src/',
3211
'mkdir -p build/logs build/cov',
3312
'composer require --dev --no-update \'phpunit/php-code-coverage:^5.2.2\'',
@@ -39,7 +18,6 @@ const coverage = (event, project) => {
3918
];
4019

4120
job.env = {
42-
'COMPOSER_ALLOW_SUPERUSER': '1',
4321
'COVERALLS_RUN_LOCALLY': '1',
4422
'COVERALLS_REPO_TOKEN': project.secrets.coverallsToken,
4523
};

0 commit comments

Comments
 (0)