Skip to content

Commit 00c8bb3

Browse files
authored
Upgrade PHP7.4 (#1)
1 parent 8c79fae commit 00c8bb3

28 files changed

Lines changed: 4423 additions & 275 deletions

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @rancoud

‎.github/workflows/test.yml‎

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os:
14+
- ubuntu-latest
15+
16+
services:
17+
mysql:
18+
image: mysql:5.7
19+
env:
20+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
21+
MYSQL_USER: root
22+
MYSQL_PASSWORD: ''
23+
MYSQL_DATABASE: test_database
24+
ports:
25+
- 3306:3306
26+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
27+
28+
redis:
29+
image: redis
30+
options: >-
31+
--health-cmd "redis-cli ping"
32+
--health-interval 10s
33+
--health-timeout 5s
34+
--health-retries 5
35+
ports:
36+
- 6379:6379
37+
38+
steps:
39+
- name: Verify MySQL connection from host
40+
run: |
41+
sudo apt-get install -y mysql-client
42+
mysql --host 127.0.0.1 --port 3306 -uroot --password="" -e "SHOW DATABASES"
43+
44+
- uses: actions/checkout@v2
45+
46+
- uses: shivammathur/setup-php@v2
47+
with:
48+
php-version: '7.4'
49+
coverage: xdebug
50+
51+
- name: Set files permission
52+
run: |
53+
sudo chown -R www-data:www-data /var/lib/php/sessions/
54+
sudo chmod -R 777 /var/lib/php/sessions/
55+
56+
- name: Validate composer.json and composer.lock
57+
run: composer validate
58+
59+
- name: Cache Composer packages
60+
id: composer-cache
61+
uses: actions/cache@v2
62+
with:
63+
path: vendor
64+
key: ${{ runner.os }}-node-${{ hashFiles('**/composer.lock') }}
65+
restore-keys: |
66+
${{ runner.os }}-node-
67+
68+
- name: Install dependencies
69+
if: steps.composer-cache.outputs.cache-hit != 'true'
70+
run: composer install --prefer-dist --no-progress --no-suggest
71+
72+
- name: PHPCS
73+
if: ${{ runner.os != 'Windows' }}
74+
run: |
75+
vendor/bin/php-cs-fixer fix --diff --dry-run
76+
77+
- name: PHPUnit
78+
run: |
79+
vendor/bin/phpunit --colors --coverage-text --coverage-clover coverage/clover.xml
80+
env:
81+
MYSQL_HOST: 127.0.0.1
82+
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
83+
MYSQL_USER: root
84+
MYSQL_PASSWORD:
85+
86+
- name: Upload coverage
87+
uses: codecov/codecov-action@v1.0.7
88+
if: success()
89+
with:
90+
token: ${{ secrets.CODECOV_TOKEN }}
91+
file: ./coverage/clover.xml

‎.gitignore‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44

55
# Composer
66
vendor/
7-
composer.lock
87

98
# PHP code sniffer
109
.php_cs.cache
1110

1211
# PHP Unit
1312
build/
13+
.phpunit.result.cache
1414

1515
# Dev / Testing
1616
test.php
17-
coverage/*
18-
!coverage/.gitkeep
17+
coverage/

‎.php_cs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ return PhpCsFixer\Config::create()
2424
'php_unit_strict' => true,
2525
'phpdoc_order' => true,
2626
'semicolon_after_instruction' => true,
27+
'single_import_per_statement' => false,
2728
'strict_comparison' => true,
2829
'strict_param' => true,
2930
'concat_space' => ['spacing' => 'one'],
3031
'trailing_comma_in_multiline_array' => false,
31-
'yoda_style' => null
32+
'yoda_style' => null,
33+
'single_line_throw' => false,
34+
'no_superfluous_phpdoc_tags' => false
3235
])
3336
->setFinder($finder)
3437
->setCacheFile(__DIR__.'/.php_cs.cache');

‎.travis.yml‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎README.md‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Session Package
22

3-
[![Build Status](https://travis-ci.org/rancoud/Session.svg?branch=master)](https://travis-ci.org/rancoud/Session) [![Coverage Status](https://coveralls.io/repos/github/rancoud/Session/badge.svg?branch=master)](https://coveralls.io/github/rancoud/Session?branch=master)
3+
![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/rancoud/session)
4+
[![Packagist Version](https://img.shields.io/packagist/v/rancoud/session)](https://packagist.org/packages/rancoud/session)
5+
[![Packagist Downloads](https://img.shields.io/packagist/dt/rancoud/session)](https://packagist.org/packages/rancoud/session)
6+
[![Composer dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](https://github.com/rancoud/session/blob/master/composer.json)
7+
[![Test workflow](https://img.shields.io/github/workflow/status/rancoud/session/test?label=test&logo=github)](https://github.com/rancoud/session/actions?workflow=test)
8+
[![Codecov](https://img.shields.io/codecov/c/github/rancoud/session?logo=codecov)](https://codecov.io/gh/rancoud/session)
9+
[![composer.lock](https://poser.pugx.org/rancoud/session/composerlock)](https://packagist.org/packages/rancoud/session)
410

511
Session.
612

@@ -190,5 +196,6 @@ composer require predis/predis
190196
```
191197

192198
## How to Dev
193-
`./run_all_commands.sh` for php-cs-fixer and phpunit and coverage
194-
`./run_php_unit_coverage.sh` for phpunit and coverage
199+
`composer ci` for php-cs-fixer and phpunit and coverage
200+
`composer lint` for php-cs-fixer
201+
`composer test` for phpunit and coverage

‎composer.json‎

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,27 @@
1616
}
1717
},
1818
"require": {
19-
"php": ">=7.2.0",
20-
"ext-openssl": ">=7.2.0"
19+
"php": ">=7.4.0",
20+
"ext-openssl": ">=7.4.0"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "~6.2.0",
24-
"squizlabs/php_codesniffer": "^3.0",
25-
"friendsofphp/php-cs-fixer": "^2.5",
26-
"satooshi/php-coveralls": "^1.0",
27-
"rancoud/database": "^3.0",
28-
"predis/predis": "^1.1"
23+
"friendsofphp/php-cs-fixer": "^2.16",
24+
"phpunit/phpunit": "^9.1",
25+
"predis/predis": "^1.1",
26+
"rancoud/database": "^4.0",
27+
"squizlabs/php_codesniffer": "^3.5"
28+
},
29+
"scripts": {
30+
"ci": [
31+
"@lint",
32+
"@test"
33+
],
34+
"lint": [
35+
"phpcbf",
36+
"php-cs-fixer fix"
37+
],
38+
"test": [
39+
"phpunit --colors --coverage-html ./coverage"
40+
]
2941
}
3042
}

0 commit comments

Comments
 (0)