Skip to content

Commit f95c617

Browse files
committed
Use GitHub Actions instead of Travis CI
1 parent 33d5f73 commit f95c617

File tree

8 files changed

+202
-72
lines changed

8 files changed

+202
-72
lines changed

.github/workflows/build.yml

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "Build"
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- "master"
10+
11+
jobs:
12+
lint:
13+
name: "Lint"
14+
runs-on: "ubuntu-latest"
15+
16+
strategy:
17+
matrix:
18+
php-version:
19+
- "7.1"
20+
- "7.2"
21+
- "7.3"
22+
- "7.4"
23+
- "8.0"
24+
25+
steps:
26+
- name: "Checkout"
27+
uses: "actions/checkout@v2"
28+
29+
- name: "Install PHP"
30+
uses: "shivammathur/setup-php@v2"
31+
with:
32+
coverage: "none"
33+
php-version: "${{ matrix.php-version }}"
34+
35+
- name: "Validate Composer"
36+
run: "composer validate"
37+
38+
- name: "Install dependencies"
39+
run: "composer install --no-interaction --no-progress --no-suggest"
40+
41+
- name: "Update PHPUnit"
42+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
43+
run: "composer require --dev phpunit/phpunit:'^9.5' --update-with-dependencies"
44+
45+
46+
- name: "Lint"
47+
run: "vendor/bin/phing lint"
48+
49+
coding-standards:
50+
name: "Coding Standard"
51+
52+
runs-on: "ubuntu-latest"
53+
54+
steps:
55+
- name: "Checkout"
56+
uses: "actions/checkout@v2"
57+
58+
- name: "Install PHP"
59+
uses: "shivammathur/setup-php@v2"
60+
with:
61+
coverage: "none"
62+
php-version: "7.3"
63+
64+
- name: "Validate Composer"
65+
run: "composer validate"
66+
67+
- name: "Install dependencies"
68+
run: "composer install --no-interaction --no-progress --no-suggest"
69+
70+
- name: "Lint"
71+
run: "vendor/bin/phing lint"
72+
73+
- name: "Coding Standard"
74+
run: "vendor/bin/phing cs"
75+
76+
tests:
77+
name: "Tests"
78+
runs-on: "ubuntu-latest"
79+
80+
strategy:
81+
fail-fast: false
82+
matrix:
83+
php-version:
84+
- "7.1"
85+
- "7.2"
86+
- "7.3"
87+
- "7.4"
88+
- "8.0"
89+
dependencies:
90+
- "lowest"
91+
- "highest"
92+
93+
steps:
94+
- name: "Checkout"
95+
uses: "actions/checkout@v2"
96+
97+
- name: "Install PHP"
98+
uses: "shivammathur/setup-php@v2"
99+
with:
100+
coverage: "none"
101+
php-version: "${{ matrix.php-version }}"
102+
103+
- name: "Install lowest dependencies"
104+
if: ${{ matrix.dependencies == 'lowest' }}
105+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
106+
107+
- name: "Install highest dependencies"
108+
if: ${{ matrix.dependencies == 'highest' }}
109+
run: "composer update --no-interaction --no-progress --no-suggest"
110+
111+
- name: "Update PHPUnit"
112+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
113+
run: "composer require --dev phpunit/phpunit:'^9.5' --update-with-dependencies"
114+
115+
- name: "Tests"
116+
run: "vendor/bin/phing tests"
117+
118+
static-analysis:
119+
name: "PHPStan"
120+
runs-on: "ubuntu-latest"
121+
122+
strategy:
123+
fail-fast: false
124+
matrix:
125+
php-version:
126+
- "7.1"
127+
- "7.2"
128+
- "7.3"
129+
- "7.4"
130+
- "8.0"
131+
dependencies:
132+
- "lowest"
133+
- "highest"
134+
135+
steps:
136+
- name: "Checkout"
137+
uses: "actions/checkout@v2"
138+
139+
- name: "Install PHP"
140+
uses: "shivammathur/setup-php@v2"
141+
with:
142+
coverage: "none"
143+
php-version: "${{ matrix.php-version }}"
144+
extensions: mbstring
145+
tools: composer:v2
146+
147+
- name: "Install lowest dependencies"
148+
if: ${{ matrix.dependencies == 'lowest' }}
149+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
150+
151+
- name: "Install highest dependencies"
152+
if: ${{ matrix.dependencies == 'highest' }}
153+
run: "composer update --no-interaction --no-progress --no-suggest"
154+
155+
- name: "Update PHPUnit"
156+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
157+
run: "composer require --dev phpunit/phpunit:'^9.5' --update-with-dependencies"
158+
159+
- name: "PHPStan"
160+
run: "vendor/bin/phing phpstan"

.travis.yml

-18
This file was deleted.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1 align="center">PHPDoc-Parser for PHPStan</h1>
22

33
<p align="center">
4-
<a href="https://travis-ci.com/phpstan/phpdoc-parser"><img src="https://api.travis-ci.com/phpstan/phpdoc-parser.svg?branch=master" alt="Build Status"></a>
4+
<a href="https://github.com/phpstan/phpdoc-parser/actions"><img src="https://github.com/phpstan/phpdoc-parser/workflows/Build/badge.svg" alt="Build Status"></a>
55
<a href="https://packagist.org/packages/phpstan/phpdoc-parser"><img src="https://poser.pugx.org/phpstan/phpdoc-parser/v/stable" alt="Latest Stable Version"></a>
66
<a href="https://choosealicense.com/licenses/mit/"><img src="https://poser.pugx.org/phpstan/phpstan/license" alt="License"></a>
77
<a href="https://phpstan.org/"><img src="https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat" alt="PHPStan Enabled"></a>
@@ -27,4 +27,4 @@ Afterwards you can either run the whole build including linting and coding stand
2727

2828
or run only tests using
2929

30-
vendor/bin/phing tests
30+
vendor/bin/phing tests

build-cs/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/composer.lock
2+
/vendor

build-cs/composer.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"require-dev": {
3+
"consistence/coding-standard": "^3.5",
4+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
5+
"slevomat/coding-standard": "^4.7.2"
6+
}
7+
}

build.xml

+23-44
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
composer-install,
77
lint,
88
cs,
9-
composer-normalize-check,
109
tests,
1110
phpstan
1211
"/>
@@ -33,75 +32,55 @@
3332
</exec>
3433
</target>
3534

36-
<target name="composer-normalize-check">
35+
<target name="lint">
3736
<exec
38-
executable="composer"
37+
executable="vendor/bin/parallel-lint"
3938
logoutput="true"
4039
passthru="true"
4140
checkreturn="true"
4241
>
43-
<arg value="normalize"/>
44-
<arg value="--ansi"/>
45-
<arg value="--dry-run"/>
42+
<arg value="--exclude"/>
43+
<arg path="tests/PHPStan/Analyser/data"/>
44+
<arg value="--exclude"/>
45+
<arg path="tests/PHPStan/Rules/Methods/data"/>
46+
<arg value="--exclude"/>
47+
<arg path="tests/PHPStan/Rules/Functions/data"/>
48+
<arg path="src" />
49+
<arg path="tests" />
4650
</exec>
4751
</target>
4852

49-
<target name="composer-normalize-fix">
53+
<target name="cs">
5054
<exec
5155
executable="composer"
5256
logoutput="true"
5357
passthru="true"
5458
checkreturn="true"
5559
>
56-
<arg value="normalize"/>
60+
<arg value="install"/>
61+
<arg value="--working-dir"/>
62+
<arg path="build-cs"/>
5763
<arg value="--ansi"/>
5864
</exec>
59-
</target>
60-
61-
<target name="lint">
6265
<exec
63-
executable="vendor/bin/parallel-lint"
66+
executable="build-cs/vendor/bin/phpcs"
6467
logoutput="true"
6568
passthru="true"
6669
checkreturn="true"
6770
>
68-
<arg value="--exclude"/>
69-
<arg path="tests/PHPStan/Analyser/data"/>
70-
<arg value="--exclude"/>
71-
<arg path="tests/PHPStan/Rules/Methods/data"/>
72-
<arg value="--exclude"/>
73-
<arg path="tests/PHPStan/Rules/Functions/data"/>
74-
<arg path="src" />
75-
<arg path="tests" />
71+
<arg value="--extensions=php"/>
72+
<arg value="--encoding=utf-8"/>
73+
<arg value="--tab-width=4"/>
74+
<arg value="--ignore=tests/*/data,tests/*/traits"/>
75+
<arg value="-sp"/>
76+
<arg path="src"/>
77+
<arg path="tests"/>
7678
</exec>
7779
</target>
7880

79-
<target name="cs">
80-
<php expression="PHP_VERSION_ID &gt;= 70400 ?'true':'false'" returnProperty="isPHP74" level="verbose" />
81-
<if>
82-
<equals arg1="${isPHP74}" arg2="false" />
83-
<then>
84-
<exec
85-
executable="vendor/bin/phpcs"
86-
logoutput="true"
87-
passthru="true"
88-
checkreturn="true"
89-
>
90-
<arg value="--extensions=php"/>
91-
<arg value="--encoding=utf-8"/>
92-
<arg value="--tab-width=4"/>
93-
<arg value="--ignore=tests/*/data,tests/*/traits"/>
94-
<arg value="-sp"/>
95-
<arg path="src"/>
96-
<arg path="tests"/>
97-
</exec>
98-
</then>
99-
</if>
100-
</target>
101-
10281
<target name="cs-fix">
10382
<exec
104-
executable="vendor/bin/phpcbf"
83+
executable="build-cs/vendor/bin/phpcbf"
10584
logoutput="true"
10685
passthru="true"
10786
checkreturn="true"

composer.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
"php": "^7.1 || ^8.0"
77
},
88
"require-dev": {
9-
"consistence/coding-standard": "^3.5",
10-
"ergebnis/composer-normalize": "^2.0.2",
11-
"phing/phing": "^2.16.0",
9+
"phing/phing": "^2.16.3",
1210
"php-parallel-lint/php-parallel-lint": "^1.2",
1311
"phpstan/extension-installer": "^1.0",
14-
"phpstan/phpstan": "^0.12.26",
15-
"phpstan/phpstan-strict-rules": "^0.12",
16-
"phpunit/phpunit": "^6.3",
17-
"slevomat/coding-standard": "^4.7.2",
12+
"phpstan/phpstan": "^0.12.60",
13+
"phpstan/phpstan-strict-rules": "^0.12.5",
14+
"phpunit/phpunit": "^7.5.20",
1815
"symfony/process": "^4.0"
1916
},
2017
"config": {
18+
"platform": {
19+
"php": "7.4.6"
20+
},
2121
"sort-packages": true
2222
},
2323
"extra": {

phpcs.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<ruleset name="PHPStan PHPDoc Parser">
3-
<rule ref="vendor/consistence/coding-standard/Consistence/ruleset.xml">
3+
<rule ref="build-cs/vendor/consistence/coding-standard/Consistence/ruleset.xml">
44
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat"/>
55
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameAfterKeyword"/>
66
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>

0 commit comments

Comments
 (0)