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 9c79941 commit c3b6ef5
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 109 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.4"

- 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"
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PHPStan Mockery extension

[![Build Status](https://travis-ci.com/phpstan/phpstan-mockery.svg?branch=master)](https://travis-ci.com/phpstan/phpstan-mockery)
[![Build](https://github.com/phpstan/phpstan-mockery/workflows/Build/badge.svg)](https://github.com/phpstan/phpstan-mockery/actions)
[![Latest Stable Version](https://poser.pugx.org/phpstan/phpstan-mockery/v/stable)](https://packagist.org/packages/phpstan/phpstan-mockery)
[![License](https://poser.pugx.org/phpstan/phpstan-mockery/license)](https://packagist.org/packages/phpstan/phpstan-mockery)

Expand Down
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
8 changes: 8 additions & 0 deletions build-cs/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"require-dev": {
"consistence/coding-standard": "^3.5",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"slevomat/coding-standard": "^4.7.2",
"squizlabs/php_codesniffer": "^3.3.2"
}
}
67 changes: 23 additions & 44 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
composer,
lint,
cs,
composer-normalize-check,
tests,
phpstan
"/>
Expand All @@ -21,69 +20,49 @@
</exec>
</target>

<target name="composer-normalize-check">
<target name="lint">
<exec
executable="composer"
logoutput="true"
passthru="true"
checkreturn="true"
executable="vendor/bin/parallel-lint"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="normalize"/>
<arg value="--ansi"/>
<arg value="--dry-run"/>
<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"
logoutput="true"
passthru="true"
checkreturn="true"
executable="build-cs/vendor/bin/phpcs"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg path="src" />
<arg path="tests" />
<arg value="--colors"/>
<arg value="--extensions=php"/>
<arg value="--encoding=utf-8"/>
<arg value="--tab-width=4"/>
<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="--colors"/>
<arg value="--extensions=php"/>
<arg value="--encoding=utf-8"/>
<arg value="--tab-width=4"/>
<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
94 changes: 46 additions & 48 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,48 @@
{
"name": "phpstan/phpstan-mockery",
"type": "phpstan-extension",
"description": "PHPStan Mockery extension",
"license": [
"MIT"
],
"require": {
"php": "^7.1 || ^8.0",
"phpstan/phpstan": "^0.12"
},
"require-dev": {
"consistence/coding-standard": "^3.5",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"ergebnis/composer-normalize": "^2.0.2",
"mockery/mockery": "^1.2.4",
"phing/phing": "^2.16.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^7.2",
"slevomat/coding-standard": "^4.7.2",
"squizlabs/php_codesniffer": "^3.3.2"
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "0.12-dev"
},
"phpstan": {
"includes": [
"extension.neon"
]
}
},
"autoload": {
"psr-4": {
"PHPStan\\": "src/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"minimum-stability": "dev",
"prefer-stable": true
"name": "phpstan/phpstan-mockery",
"type": "phpstan-extension",
"description": "PHPStan Mockery extension",
"license": [
"MIT"
],
"require": {
"php": "^7.1 || ^8.0",
"phpstan/phpstan": "^0.12.60"
},
"require-dev": {
"mockery/mockery": "^1.2.4",
"phing/phing": "^2.16.3",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-phpunit": "^0.12.16",
"phpstan/phpstan-strict-rules": "^0.12.5",
"phpunit/phpunit": "^7.5.20"
},
"config": {
"platform": {
"php": "7.4.6"
},
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "0.12-dev"
},
"phpstan": {
"includes": [
"extension.neon"
]
}
},
"autoload": {
"psr-4": {
"PHPStan\\": "src/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"minimum-stability": "dev",
"prefer-stable": true
}
Loading

0 comments on commit c3b6ef5

Please sign in to comment.