Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @rancoud
91 changes: 91 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: test

on:
push:
pull_request:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest

services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_USER: root
MYSQL_PASSWORD: ''
MYSQL_DATABASE: test_database
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379

steps:
- name: Verify MySQL connection from host
run: |
sudo apt-get install -y mysql-client
mysql --host 127.0.0.1 --port 3306 -uroot --password="" -e "SHOW DATABASES"

- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: xdebug

- name: Set files permission
run: |
sudo chown -R www-data:www-data /var/lib/php/sessions/
sudo chmod -R 777 /var/lib/php/sessions/

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-node-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

- name: PHPCS
if: ${{ runner.os != 'Windows' }}
run: |
vendor/bin/php-cs-fixer fix --diff --dry-run

- name: PHPUnit
run: |
vendor/bin/phpunit --colors --coverage-text --coverage-clover coverage/clover.xml
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
MYSQL_USER: root
MYSQL_PASSWORD:

- name: Upload coverage
uses: codecov/codecov-action@v1.0.7
if: success()
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/clover.xml
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

# Composer
vendor/
composer.lock

# PHP code sniffer
.php_cs.cache

# PHP Unit
build/
.phpunit.result.cache

# Dev / Testing
test.php
coverage/*
!coverage/.gitkeep
coverage/
5 changes: 4 additions & 1 deletion .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ return PhpCsFixer\Config::create()
'php_unit_strict' => true,
'phpdoc_order' => true,
'semicolon_after_instruction' => true,
'single_import_per_statement' => false,
'strict_comparison' => true,
'strict_param' => true,
'concat_space' => ['spacing' => 'one'],
'trailing_comma_in_multiline_array' => false,
'yoda_style' => null
'yoda_style' => null,
'single_line_throw' => false,
'no_superfluous_phpdoc_tags' => false
])
->setFinder($finder)
->setCacheFile(__DIR__.'/.php_cs.cache');
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Session Package

[![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)
![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/rancoud/session)
[![Packagist Version](https://img.shields.io/packagist/v/rancoud/session)](https://packagist.org/packages/rancoud/session)
[![Packagist Downloads](https://img.shields.io/packagist/dt/rancoud/session)](https://packagist.org/packages/rancoud/session)
[![Composer dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](https://github.com/rancoud/session/blob/master/composer.json)
[![Test workflow](https://img.shields.io/github/workflow/status/rancoud/session/test?label=test&logo=github)](https://github.com/rancoud/session/actions?workflow=test)
[![Codecov](https://img.shields.io/codecov/c/github/rancoud/session?logo=codecov)](https://codecov.io/gh/rancoud/session)
[![composer.lock](https://poser.pugx.org/rancoud/session/composerlock)](https://packagist.org/packages/rancoud/session)

Session.

Expand Down Expand Up @@ -190,5 +196,6 @@ composer require predis/predis
```

## How to Dev
`./run_all_commands.sh` for php-cs-fixer and phpunit and coverage
`./run_php_unit_coverage.sh` for phpunit and coverage
`composer ci` for php-cs-fixer and phpunit and coverage
`composer lint` for php-cs-fixer
`composer test` for phpunit and coverage
28 changes: 20 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,27 @@
}
},
"require": {
"php": ">=7.2.0",
"ext-openssl": ">=7.2.0"
"php": ">=7.4.0",
"ext-openssl": ">=7.4.0"
},
"require-dev": {
"phpunit/phpunit": "~6.2.0",
"squizlabs/php_codesniffer": "^3.0",
"friendsofphp/php-cs-fixer": "^2.5",
"satooshi/php-coveralls": "^1.0",
"rancoud/database": "^3.0",
"predis/predis": "^1.1"
"friendsofphp/php-cs-fixer": "^2.16",
"phpunit/phpunit": "^9.1",
"predis/predis": "^1.1",
"rancoud/database": "^4.0",
"squizlabs/php_codesniffer": "^3.5"
},
"scripts": {
"ci": [
"@lint",
"@test"
],
"lint": [
"phpcbf",
"php-cs-fixer fix"
],
"test": [
"phpunit --colors --coverage-html ./coverage"
]
}
}
Loading