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 5c2da38 commit 5de413b
Show file tree
Hide file tree
Showing 10 changed files with 171 additions and 46 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# 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"

This comment has been minimized.

Copy link
@localheinz

localheinz Dec 12, 2020

Contributor

You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.


- 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"

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 PHPStan"
if: matrix.php-version == '8.0'
run: "composer require --dev phpstan/phpstan:'^0.12.60' --update-with-dependencies"

- name: "PHPStan"
run: "vendor/bin/phing phpstan"
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Create release"

on:
push:
tags:
- '*'

jobs:
deploy:
name: "Deploy"
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: Generate changelog
id: changelog
uses: metcalfc/changelog-generator@v0.4.4
with:
myToken: ${{ secrets.GITHUB_TOKEN }}

- name: "Create release"
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.changelog.outputs.changelog }}
14 changes: 0 additions & 14 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 Extension Installer

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

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
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.8",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"slevomat/coding-standard": "^5.0.4"
}
}
33 changes: 9 additions & 24 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,
phpstan
"/>

Expand All @@ -20,45 +19,31 @@
</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 path="src" />
</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"
>
<arg path="src" />
</exec>
</target>

<target name="cs">
<exec
executable="vendor/bin/phpcs"
executable="build-cs/vendor/bin/phpcs"
logoutput="true"
passthru="true"
checkreturn="true"
Expand All @@ -73,7 +58,7 @@

<target name="cs-fix">
<exec
executable="vendor/bin/phpcbf"
executable="build-cs/vendor/bin/phpcbf"
logoutput="true"
passthru="true"
checkreturn="true"
Expand Down
8 changes: 2 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@
},
"require-dev": {
"composer/composer": "^1.8",
"consistence/coding-standard": "^3.8",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"ergebnis/composer-normalize": "^2.0.2",
"phing/phing": "^2.16",
"phing/phing": "^2.16.3",
"php-parallel-lint/php-parallel-lint": "^1.2.0",
"phpstan/phpstan-strict-rules": "^0.11",
"slevomat/coding-standard": "^5.0.4"
"phpstan/phpstan-strict-rules": "^0.11 || ^0.12"
},
"config": {
"sort-packages": true
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 Extension Installer">
<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
3 changes: 3 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public function uninstall(Composer $composer, IOInterface $io): void
// noop
}

/**
* @return array<string, string>
*/
public static function getSubscribedEvents(): array
{
return [
Expand Down

0 comments on commit 5de413b

Please sign in to comment.