Use GitHub Actions instead of Travis CI

This commit is contained in:
Ondrej Mirtes 2020-12-12 16:30:17 +01:00
parent 33d5f73f71
commit f95c617ed5
No known key found for this signature in database
GPG Key ID: 8E730BA25823D8B5
8 changed files with 205 additions and 75 deletions

160
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,160 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Build"
on:
pull_request:
push:
branches:
- "master"
jobs:
lint:
name: "Lint"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: "Validate Composer"
run: "composer validate"
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Update PHPUnit"
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
run: "composer require --dev phpunit/phpunit:'^9.5' --update-with-dependencies"
- name: "Lint"
run: "vendor/bin/phing lint"
coding-standards:
name: "Coding Standard"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "7.3"
- name: "Validate Composer"
run: "composer validate"
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Lint"
run: "vendor/bin/phing lint"
- name: "Coding Standard"
run: "vendor/bin/phing cs"
tests:
name: "Tests"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
dependencies:
- "lowest"
- "highest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress --no-suggest"
- name: "Update PHPUnit"
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
run: "composer require --dev phpunit/phpunit:'^9.5' --update-with-dependencies"
- name: "Tests"
run: "vendor/bin/phing tests"
static-analysis:
name: "PHPStan"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
dependencies:
- "lowest"
- "highest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
extensions: mbstring
tools: composer:v2
- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress --no-suggest"
- name: "Update PHPUnit"
if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
run: "composer require --dev phpunit/phpunit:'^9.5' --update-with-dependencies"
- name: "PHPStan"
run: "vendor/bin/phing phpstan"

View File

@ -1,18 +0,0 @@
language: php
php:
- 7.1
- 7.2
- 7.3
- 7.4
- master
matrix:
allow_failures:
- php: master
before_script:
- composer self-update
- composer update --no-interaction
script:
- vendor/bin/phing

View File

@ -1,7 +1,7 @@
<h1 align="center">PHPDoc-Parser for PHPStan</h1>
<p align="center">
<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>
<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>
<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>
<a href="https://choosealicense.com/licenses/mit/"><img src="https://poser.pugx.org/phpstan/phpstan/license" alt="License"></a>
<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
or run only tests using
vendor/bin/phing tests
vendor/bin/phing tests

2
build-cs/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/composer.lock
/vendor

7
build-cs/composer.json Normal file
View File

@ -0,0 +1,7 @@
{
"require-dev": {
"consistence/coding-standard": "^3.5",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"slevomat/coding-standard": "^4.7.2"
}
}

View File

@ -6,7 +6,6 @@
composer-install,
lint,
cs,
composer-normalize-check,
tests,
phpstan
"/>
@ -33,31 +32,6 @@
</exec>
</target>
<target name="composer-normalize-check">
<exec
executable="composer"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="normalize"/>
<arg value="--ansi"/>
<arg value="--dry-run"/>
</exec>
</target>
<target name="composer-normalize-fix">
<exec
executable="composer"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="normalize"/>
<arg value="--ansi"/>
</exec>
</target>
<target name="lint">
<exec
executable="vendor/bin/parallel-lint"
@ -77,31 +51,36 @@
</target>
<target name="cs">
<php expression="PHP_VERSION_ID &gt;= 70400 ?'true':'false'" returnProperty="isPHP74" level="verbose" />
<if>
<equals arg1="${isPHP74}" arg2="false" />
<then>
<exec
executable="vendor/bin/phpcs"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="--extensions=php"/>
<arg value="--encoding=utf-8"/>
<arg value="--tab-width=4"/>
<arg value="--ignore=tests/*/data,tests/*/traits"/>
<arg value="-sp"/>
<arg path="src"/>
<arg path="tests"/>
</exec>
</then>
</if>
<exec
executable="composer"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="install"/>
<arg value="--working-dir"/>
<arg path="build-cs"/>
<arg value="--ansi"/>
</exec>
<exec
executable="build-cs/vendor/bin/phpcs"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="--extensions=php"/>
<arg value="--encoding=utf-8"/>
<arg value="--tab-width=4"/>
<arg value="--ignore=tests/*/data,tests/*/traits"/>
<arg value="-sp"/>
<arg path="src"/>
<arg path="tests"/>
</exec>
</target>
<target name="cs-fix">
<exec
executable="vendor/bin/phpcbf"
executable="build-cs/vendor/bin/phpcbf"
logoutput="true"
passthru="true"
checkreturn="true"

View File

@ -6,18 +6,18 @@
"php": "^7.1 || ^8.0"
},
"require-dev": {
"consistence/coding-standard": "^3.5",
"ergebnis/composer-normalize": "^2.0.2",
"phing/phing": "^2.16.0",
"phing/phing": "^2.16.3",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.26",
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^6.3",
"slevomat/coding-standard": "^4.7.2",
"phpstan/phpstan": "^0.12.60",
"phpstan/phpstan-strict-rules": "^0.12.5",
"phpunit/phpunit": "^7.5.20",
"symfony/process": "^4.0"
},
"config": {
"platform": {
"php": "7.4.6"
},
"sort-packages": true
},
"extra": {

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset name="PHPStan PHPDoc Parser">
<rule ref="vendor/consistence/coding-standard/Consistence/ruleset.xml">
<rule ref="build-cs/vendor/consistence/coding-standard/Consistence/ruleset.xml">
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat"/>
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameAfterKeyword"/>
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>