Skip to content

Commit e508e8e

Browse files
committed
build: add GitHub actions
1 parent d0d3232 commit e508e8e

File tree

6 files changed

+78
-31
lines changed

6 files changed

+78
-31
lines changed

.github/workflows/test.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Test"
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
tests:
7+
name: "Tests"
8+
9+
runs-on: ${{ matrix.operating-system }}
10+
11+
strategy:
12+
matrix:
13+
dependencies: ["lowest", "highest"]
14+
php-version:
15+
- "7.4"
16+
- "8.0"
17+
- "8.1"
18+
operating-system: ["ubuntu-latest"]
19+
20+
steps:
21+
- name: "Checkout"
22+
uses: "actions/checkout@v2"
23+
24+
- name: "Install PHP"
25+
uses: "shivammathur/setup-php@v2"
26+
with:
27+
coverage: "none"
28+
php-version: "${{ matrix.php-version }}"
29+
30+
- name: "Cache dependencies"
31+
uses: "actions/cache@v2"
32+
with:
33+
path: "~/.composer/cache"
34+
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
35+
restore-keys: "php-${{ matrix.php-version }}-composer-"
36+
37+
- name: "Install lowest dependencies"
38+
if: ${{ matrix.dependencies == 'lowest' }}
39+
run: "composer update --prefer-lowest --prefer-dist --no-interaction --no-progress --no-suggest"
40+
41+
- name: "Install highest dependencies"
42+
if: ${{ matrix.dependencies == 'highest' }}
43+
run: "composer update --prefer-dist --no-interaction --no-progress --no-suggest"
44+
45+
- name: "Unit tests"
46+
run: "vendor/bin/phpunit"
47+
48+
- name: "Coding style"
49+
run: "vendor/bin/phpcs --report=summary"
50+
51+
- name: "Static analysis"
52+
run: "vendor/bin/phpstan --no-progress"

.travis.yml

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

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
},
2626
"require-dev": {
2727
"phpunit/phpunit": "^9.5",
28-
"phpspec/prophecy-phpunit": "^2.0"
28+
"phpspec/prophecy-phpunit": "^2.0",
29+
"squizlabs/php_codesniffer": "^3.6",
30+
"brainbits/phpcs-standard": "^5.0",
31+
"phpstan/phpstan": "^0.12.99",
32+
"brainbits/phpstan-rules": "^2.0"
2933
},
3034
"autoload": {
3135
"psr-4": { "Brainbits\\Transcoder\\": "src/" }

phpcs.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
3+
<file extension="php">src/</file>
4+
<arg name="basepath" value="." />
5+
<arg name="colors" />
6+
<rule ref="Brainbits">
7+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix" />
8+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix" />
9+
</rule>
10+
</ruleset>

phpstan.neon

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
parameters:
2+
checkMissingIterableValueType: false
3+
level: 8
4+
paths:
5+
- src
6+
bootstrapFiles:
7+
- vendor/autoload.php
8+
includes:
9+
- vendor/brainbits/phpstan-rules/rules.neon

phpunit.xml.dist

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,8 @@
33
colors="true"
44
convertErrorsToExceptions="true"
55
convertNoticesToExceptions="true"
6-
convertWarningsToExceptions="true"
7-
syntaxCheck="true">
6+
convertWarningsToExceptions="true">
87
<testsuite name="transcoder">
9-
<directory>tests</directory>
8+
<directory suffix=".php">tests</directory>
109
</testsuite>
11-
<filter>
12-
<whitelist>
13-
<directory suffix=".php">src/</directory>
14-
</whitelist>
15-
</filter>
1610
</phpunit>

0 commit comments

Comments
 (0)