Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit 0bd95fc

Browse files
committed
Use GitHub actions
1 parent 3d51c6f commit 0bd95fc

File tree

2 files changed

+53
-21
lines changed

2 files changed

+53
-21
lines changed

.github/workflows/php.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: PHP
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
run:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- php: 7.4
17+
composer: '--prefer-lowest'
18+
desc: "Lowest versions"
19+
- php: 7.4
20+
coverage: '--coverage-clover /tmp/clover.xml'
21+
- php: 8.0
22+
- php: 8.1
23+
- php: 8.2
24+
name: PHP ${{ matrix.php }} ${{ matrix.desc }}
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php }}
33+
coverage: xdebug
34+
35+
- name: Validate composer.json and composer.lock
36+
run: composer validate
37+
38+
- name: Install dependencies
39+
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer }}
40+
41+
- name: Run PHPUnit
42+
run: vendor/bin/phpunit ${{ matrix.coverage }}
43+
44+
- name: Upload coverage to Scrutinizer
45+
if: ${{ matrix.coverage }}
46+
run: >
47+
wget https://scrutinizer-ci.com/ocular.phar -O "/tmp/ocular.phar" &&
48+
php "/tmp/ocular.phar" code-coverage:upload --format=php-clover /tmp/clover.xml

README.md

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,6 @@ Copy the PHPUnit configuration into the projects root folder
2727
[vfsStream](https://github.com/mikey179/vfsStream) is a stream wrapper for a virtual file system that may be helpful
2828
in unit tests to mock the real file system.
2929

30-
### Codeception (optional)
31-
[Codeception](http://codeception.com/) is a BDD style testing frameworks for PHP. It can be used for unit, functional
32-
and integration tests.
33-
34-
The [Codeception module for Jasny MVC](https://github.com/jasny/codeception-module) allows you to run tests for
35-
applications that use Jasny MVC.
36-
37-
Codeception isn't installed by default. It can be installed through composer.
38-
39-
composer require --dev codeception/codeception jasny/codeception-module
40-
41-
### PHP Cloc
42-
43-
[phpcloc](https://github.com/appzcoder/phpcloc) Count the lines of codes in the project as PHP implementation of cloc.
44-
4530
### PHP CodeSniffer
4631
[phpcs](https://github.com/squizlabs/PHP_CodeSniffer) tokenises PHP files and detects violations of a defined set of
4732
coding standards. It is an essential development tool that ensures your code remains clean and consistent.
@@ -65,7 +50,6 @@ Composer can be configured to run all tests
6550
"scripts": {
6651
"test": [
6752
"phpunit",
68-
"phpcloc cloc src",
6953
"phpstan analyse",
7054
"phpcs -p src"
7155
]
@@ -83,14 +67,14 @@ To run all tests do
8367
Open source projects should all of these quality assurance services. Closed source project may use a single service
8468
to both run tests and code quality checks in order to save costs.
8569

86-
### Travis
87-
[Travis CI](https://travis-ci.org) will run all unit tests on each pull-request and push to the master branch.
70+
### GitHub actions
71+
[GitHub actions](https://github.com/features/actions) will run all unit tests on each pull-request and push to the master branch.
8872

89-
Copy the Travis CI configuration file from the php-code-quality directory.
73+
Copy the .github folder from the php-code-quality directory.
9074

91-
cp vendor/jasny/php-code-quality/travis.yml.dist .travis.yml
75+
cp -r vendor/jasny/php-code-quality/.github .
9276

9377
### Scrutinizer
9478
[Scrutinizer](https://scrutinizer-ci.com/) tests code quality using PHP CodeSniffer, PHPStan and a custom analysis
95-
tool from Scrutinizer. It also collects tests coverage results from Travis CI.
79+
tool from Scrutinizer. It also collects tests coverage results.
9680

0 commit comments

Comments
 (0)