Skip to content

Commit 5a2910d

Browse files
authored
PHP 8.x is supported now (#27)
* PHP 8.x is supported now * Update GitHub actions matrix settings * Dockerfile fixed * Minimal version for dev-packages updated * Try to fix CS checking on CI * Coverage enabling forced for XDebug 3 * GitHub action updated * Changelog updated
1 parent a16edc5 commit 5a2910d

File tree

6 files changed

+54
-41
lines changed

6 files changed

+54
-41
lines changed

.github/workflows/tests.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ on:
1717
jobs: # Docs: <https://help.github.com/en/articles/workflow-syntax-for-github-actions>
1818
tests:
1919
name: PHP ${{ matrix.php }} (${{ matrix.setup }} setup)
20-
runs-on: ubuntu-latest
20+
runs-on: ubuntu-20.04
2121
timeout-minutes: 10
2222
strategy:
2323
fail-fast: false
2424
matrix:
2525
setup: ['basic', 'lowest']
26-
php: ['7.2', '7.3', '7.4']
26+
php: ['7.3', '7.4', '8.0']
2727
include:
28-
- php: '7.2'
28+
- php: '7.3'
2929
setup: 'basic'
3030
coverage: 'true'
31-
- php: '7.4'
31+
- php: '8.0'
3232
setup: 'basic'
3333
coverage: 'true'
3434
steps:
@@ -39,7 +39,7 @@ jobs: # Docs: <https://help.github.com/en/articles/workflow-syntax-for-github-ac
3939
uses: shivammathur/setup-php@v2 # Action page: <https://github.com/shivammathur/setup-php>
4040
with:
4141
php-version: ${{ matrix.php }}
42-
extensions: mbstring, pdo, pdo_sqlite, sqlite3 # definition is required for php 7.4
42+
extensions: mbstring, pdo, pdo_sqlite, sqlite3, xdebug # definition is required for php 7.4
4343

4444
- name: Get Composer Cache Directory # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
4545
id: composer-cache
@@ -54,13 +54,13 @@ jobs: # Docs: <https://help.github.com/en/articles/workflow-syntax-for-github-ac
5454

5555
- name: Install lowest Composer dependencies
5656
if: matrix.setup == 'lowest'
57-
run: composer update --prefer-dist --no-interaction --prefer-lowest --ansi
57+
run: composer update --prefer-dist --no-interaction --prefer-lowest --no-progress --ansi
5858

5959
- name: Install basic Composer dependencies
6060
if: matrix.setup == 'basic'
61-
run: composer update --prefer-dist --no-interaction --ansi
61+
run: composer update --prefer-dist --no-interaction --no-progress --ansi
6262

63-
- name: Show most important packages versions
63+
- name: Show most important package versions
6464
run: composer info | grep -e laravel -e spiral -e phpunit/phpunit -e phpstan/phpstan
6565

6666
- name: Execute tests
@@ -69,6 +69,8 @@ jobs: # Docs: <https://help.github.com/en/articles/workflow-syntax-for-github-ac
6969

7070
- name: Execute tests with code coverage
7171
if: matrix.coverage == 'true'
72+
env:
73+
XDEBUG_MODE: coverage
7274
run: composer test-cover
7375

7476
- uses: codecov/codecov-action@v1 # Docs: <https://github.com/codecov/codecov-action>
@@ -80,7 +82,7 @@ jobs: # Docs: <https://help.github.com/en/articles/workflow-syntax-for-github-ac
8082

8183
cs-check:
8284
name: Check Code Style
83-
runs-on: ubuntu-latest
85+
runs-on: ubuntu-20.04
8486
steps:
8587
- name: Check out code
8688
uses: actions/checkout@v2
@@ -102,8 +104,8 @@ jobs: # Docs: <https://help.github.com/en/articles/workflow-syntax-for-github-ac
102104
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
103105
restore-keys: ${{ runner.os }}-composer-
104106

105-
- name: Install Composer dependencies
106-
run: composer update --prefer-dist --no-interaction --ansi
107+
- name: Install required Composer packages
108+
run: composer require 'spiral/code-style:^1.0' -n --no-progress --prefer-dist # `--ignore-platform-reqs` is required only for PHP 8.0
107109

108110
- name: Execute check
109-
run: composer cs-check
111+
run: php ./vendor/bin/spiral-cs check ./bin ./src ./tests --ansi

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].
66

7-
## UNRELEASED
7+
## v3.7.0
8+
9+
### Added
10+
11+
- Support PHP `8.x`
812

913
### Changed
1014

1115
- Composer `2.x` is supported now
16+
- Minimal required PHP version now is `7.3` (`7.2` security support ended January 1st, 2021)
17+
- Dev-dependency `mockery/mockery` minimal required version changed from `^1.3.1` to `^1.3.2`
18+
- Dev-dependency `phpstan/phpstan` minimal required version changed from `~0.12` to `~0.12.34`
19+
20+
### Removed
21+
22+
- Code-style checking and fixing for local development (packages `spiral/code-style` and `friendsofphp/php-cs-fixer` does not supports PHP `8.x`), but using GitHub this actions still running
1223

1324
## v3.6.0
1425

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:7.3.5-alpine
1+
FROM php:8.0-alpine
22

33
ENV COMPOSER_HOME="/tmp/composer"
44

@@ -8,11 +8,10 @@ RUN set -x \
88
&& apk add --no-cache binutils git \
99
&& apk add --no-cache --virtual .build-deps autoconf pkgconf make g++ gcc 1>/dev/null \
1010
# install xdebug (for testing with code coverage), but do not enable it
11-
&& pecl install xdebug-2.9.6 1>/dev/null \
11+
&& pecl install xdebug-3.0.0 1>/dev/null \
1212
&& apk del .build-deps \
13-
&& mkdir -p /src ${COMPOSER_HOME}/cache/{repo,files} \
13+
&& mkdir --parents --mode=777 /src ${COMPOSER_HOME}/cache/repo ${COMPOSER_HOME}/cache/files \
1414
&& ln -s /usr/bin/composer /usr/bin/c \
15-
&& chmod -R 777 ${COMPOSER_HOME} \
1615
&& composer --version \
1716
&& php -v \
1817
&& php -m

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ latest: clean ## Install latest php dependencies
2020
docker-compose run $(RUN_APP_ARGS) app composer update -n --ansi --prefer-dist --prefer-stable
2121

2222
install: clean ## Install regular php dependencies
23-
docker-compose run $(RUN_APP_ARGS) app composer update -n --prefer-dist --no-interaction
23+
docker-compose run $(RUN_APP_ARGS) app composer update -n --prefer-dist
2424

2525
lowest: clean ## Install lowest php dependencies
2626
docker-compose run $(RUN_APP_ARGS) app composer update -n --ansi --prefer-dist --prefer-lowest
@@ -29,7 +29,7 @@ test: ## Execute php tests and linters
2929
docker-compose run $(RUN_APP_ARGS) app composer test
3030

3131
test-cover: ## Execute php tests with coverage
32-
docker-compose run --rm --user "0:0" app sh -c 'docker-php-ext-enable xdebug && su $(shell whoami) -s /bin/sh -c "composer phpunit-cover"'
32+
docker-compose run --rm --user "0:0" -e 'XDEBUG_MODE=coverage' app sh -c 'docker-php-ext-enable xdebug && su $(shell whoami) -s /bin/sh -c "composer phpunit-cover"'
3333

3434
shell: ## Start shell into container with php
3535
docker-compose run $(RUN_APP_ARGS) app sh

composer.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^7.2",
18+
"php": "^7.3 || ^8.0",
1919
"ext-mbstring": "*",
2020
"illuminate/contracts": "~6.0 || ~7.0 || ~8.0",
2121
"illuminate/support": "~6.0 || ~7.0 || ~8.0",
@@ -30,10 +30,9 @@
3030
"ext-pdo_sqlite": "*",
3131
"ext-sqlite3": "*",
3232
"laravel/laravel": "~6.0 || ~7.0 || ~8.0",
33-
"mockery/mockery": "^1.3.1",
34-
"phpstan/phpstan": "~0.12",
35-
"phpunit/phpunit": "^8.0 || ^9.3",
36-
"spiral/code-style": "^1.0"
33+
"mockery/mockery": "^1.3.2",
34+
"phpstan/phpstan": "~0.12.34",
35+
"phpunit/phpunit": "^8.0 || ^9.3"
3736
},
3837
"autoload": {
3938
"psr-4": {
@@ -52,8 +51,6 @@
5251
"phpunit": "@php ./vendor/bin/phpunit --no-coverage --colors=always",
5352
"phpunit-cover": "@php ./vendor/bin/phpunit",
5453
"phpstan": "@php ./vendor/bin/phpstan analyze -c ./phpstan.neon.dist --no-progress --ansi",
55-
"cs-check": "@php ./vendor/bin/spiral-cs check ./bin ./src ./tests --ansi",
56-
"cs-fix": "@php ./vendor/bin/spiral-cs fix ./bin ./src ./tests --ansi",
5754
"test": [
5855
"@phpstan",
5956
"@phpunit"

phpunit.xml.dist

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,31 @@
1111
processIsolation="false"
1212
forceCoversAnnotation="true"
1313
stopOnFailure="false">
14+
1415
<testsuites>
1516
<testsuite name="Unit">
1617
<directory suffix="Test.php">./tests</directory>
1718
</testsuite>
1819
</testsuites>
19-
<filter>
20-
<whitelist processUncoveredFilesFromWhitelist="true">
20+
21+
<coverage includeUncoveredFiles="false" processUncoveredFiles="true">
22+
<include>
2123
<directory suffix=".php">./src</directory>
22-
<exclude>
23-
<directory>./vendor</directory>
24-
</exclude>
25-
</whitelist>
26-
</filter>
27-
<logging>
28-
<!--log type="coverage-html" target="./coverage/html"/-->
29-
<log type="coverage-xml" target="./coverage/xml"/>
30-
<log type="coverage-clover" target="./coverage/clover.xml"/>
31-
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
32-
</logging>
24+
</include>
25+
<exclude>
26+
<directory>./vendor</directory>
27+
<directory>./tests</directory>
28+
</exclude>
29+
<report>
30+
<clover outputFile="./coverage/clover.xml"/>
31+
<html outputDirectory="./coverage/html"/>
32+
<text outputFile="php://stdout" showUncoveredFiles="false"/>
33+
<xml outputDirectory="./coverage/xml"/>
34+
</report>
35+
</coverage>
36+
3337
<php>
34-
<env name="APP_KEY" value="base64:+hY09mlBag/d7Qhq2SjE/i2iUzZBS1dGObLqcHZU2Ac="/>
35-
<env name="APP_URL" value="http://unit-test"/>
38+
<server name="APP_KEY" value="base64:+hY09mlBag/d7Qhq2SjE/i2iUzZBS1dGObLqcHZU2Ac=" force="true"/>
39+
<server name="APP_URL" value="http://unit-test" force="true"/>
3640
</php>
3741
</phpunit>

0 commit comments

Comments
 (0)