@@ -67,21 +67,21 @@ jobs:
67
67
uses : actions/cache@v2
68
68
with :
69
69
path : /tmp/docker-image.tar
70
- key : cache-docker-image-test:${{ matrix.PHP_VERSION }}
70
+ key : cache-docker-image-test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE == 'true' && '-pcov' || '' }}
71
71
72
72
- name : Load Docker Image
73
73
if : steps.cache-docker-image.outputs.cache-hit == 'true'
74
74
run : docker load --input /tmp/docker-image.tar
75
75
76
76
- name : Build Docker Image
77
77
if : steps.cache-docker-image.outputs.cache-hit != 'true'
78
- run : docker build -f .github/workflows/test.Dockerfile -t 'test:${{ matrix.PHP_VERSION }}' -- build-arg 'PHP_VERSION=${{ matrix.PHP_VERSION }}' .
78
+ run : docker build -f .github/workflows/test.Dockerfile -t 'test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE == 'true' && '-pcov' || '' }}' -- build-arg 'PHP_VERSION=${{ matrix.PHP_VERSION }}' --build-arg 'CODE_COVERAGE=${{ matrix.CODE_COVERAGE }}' .
79
79
80
80
- name : Cache Composer Cache Files
81
81
uses : actions/cache@v2
82
82
with :
83
83
path : /tmp/composer-cache-files
84
- key : cache-composer-cache-files-${{ matrix.PHP_VERSION }}
84
+ key : cache-composer-cache-files-${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE == 'true' && '-pcov' || '' }}
85
85
restore-keys : |
86
86
cache-composer-cache-files-
87
87
95
95
- name : Run Unit Test
96
96
run : |
97
97
if [ "${{ matrix.CODE_COVERAGE }}" == "true" ]; then
98
- docker run --rm -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}' \
99
- apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
100
- && mkdir -p /usr/src/php/ext/pcov && curl -fsSL https://pecl.php.net/get/pcov | tar xvz -C /usr/src/php/ext/pcov --strip 1 \
101
- && docker-php-ext-install pcov \
102
- && docker-php-ext-enable pcov \
103
- && php -d 'zend.assertions=1' -d 'pcov.enabled=1' ./vendor/bin/phpunit --coverage-clover=.clover.xml
98
+ docker run --rm -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}-pcov' php -d 'zend.assertions=1' -d 'pcov.enabled=1' ./vendor/bin/phpunit --coverage-clover=.clover.xml
104
99
else
105
100
docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}' php -d 'zend.assertions=1' ./vendor/bin/phpunit
106
101
fi
@@ -114,16 +109,16 @@ jobs:
114
109
115
110
- name : Run PHPStan
116
111
if : ${{ matrix.RUN_PHPSTAN }}
117
- run : docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}' php -d 'memory_limit=2G' ./vendor/bin/phpstan analyse --level max src/ tests/
112
+ run : docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE == 'true' && '-pcov' || '' }} ' php -d 'memory_limit=2G' ./vendor/bin/phpstan analyse --level max src/ tests/
118
113
119
114
- name : Run psalm
120
115
if : ${{ matrix.RUN_PSALM }}
121
- run : mkdir -p "$HOME/.cache/psalm" && docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" -v "$HOME/.cache/psalm:/.cache/psalm" 'test:${{ matrix.PHP_VERSION }}' php ./vendor/bin/psalm
116
+ run : mkdir -p "$HOME/.cache/psalm" && docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" -v "$HOME/.cache/psalm:/.cache/psalm" 'test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE == 'true' && '-pcov' || '' }} ' php ./vendor/bin/psalm
122
117
123
118
- name : Run benchmark
124
119
if : ${{ matrix.RUN_BENCHMARK }}
125
- run : docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}' php -d 'zend.assertions=-1' ./vendor/bin/phpbench run --no-interaction --revs=1 --retry-threshold=100 --progress=none
120
+ run : docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workdir" 'test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE == 'true' && '-pcov' || '' }} ' php -d 'zend.assertions=-1' ./vendor/bin/phpbench run --no-interaction --revs=1 --retry-threshold=100 --progress=none
126
121
127
122
- name : Export Docker Image
128
123
if : steps.cache-docker-image.outputs.cache-hit != 'true'
129
- run : docker save --output /tmp/docker-image.tar 'test:${{ matrix.PHP_VERSION }}'
124
+ run : docker save --output /tmp/docker-image.tar 'test:${{ matrix.PHP_VERSION }}${{ matrix.CODE_COVERAGE == 'true' && '-pcov' || '' }} '
0 commit comments