Skip to content

Commit

Permalink
Use GitHub Actions instead of Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Dec 12, 2020
1 parent 33d5f73 commit f95c617
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 72 deletions.
160 changes: 160 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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"
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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 changes: 2 additions & 0 deletions build-cs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/composer.lock
/vendor
7 changes: 7 additions & 0 deletions build-cs/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"require-dev": {
"consistence/coding-standard": "^3.5",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"slevomat/coding-standard": "^4.7.2"
}
}
67 changes: 23 additions & 44 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
composer-install,
lint,
cs,
composer-normalize-check,
tests,
phpstan
"/>
Expand All @@ -33,75 +32,55 @@
</exec>
</target>

<target name="composer-normalize-check">
<target name="lint">
<exec
executable="composer"
executable="vendor/bin/parallel-lint"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="normalize"/>
<arg value="--ansi"/>
<arg value="--dry-run"/>
<arg value="--exclude"/>
<arg path="tests/PHPStan/Analyser/data"/>
<arg value="--exclude"/>
<arg path="tests/PHPStan/Rules/Methods/data"/>
<arg value="--exclude"/>
<arg path="tests/PHPStan/Rules/Functions/data"/>
<arg path="src" />
<arg path="tests" />
</exec>
</target>

<target name="composer-normalize-fix">
<target name="cs">
<exec
executable="composer"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="normalize"/>
<arg value="install"/>
<arg value="--working-dir"/>
<arg path="build-cs"/>
<arg value="--ansi"/>
</exec>
</target>

<target name="lint">
<exec
executable="vendor/bin/parallel-lint"
executable="build-cs/vendor/bin/phpcs"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="--exclude"/>
<arg path="tests/PHPStan/Analyser/data"/>
<arg value="--exclude"/>
<arg path="tests/PHPStan/Rules/Methods/data"/>
<arg value="--exclude"/>
<arg path="tests/PHPStan/Rules/Functions/data"/>
<arg path="src" />
<arg path="tests" />
<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">
<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>
</target>

<target name="cs-fix">
<exec
executable="vendor/bin/phpcbf"
executable="build-cs/vendor/bin/phpcbf"
logoutput="true"
passthru="true"
checkreturn="true"
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
@@ -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"/>
Expand Down

0 comments on commit f95c617

Please sign in to comment.