Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5dd592f
Fix phpstan-static-php-parser on PHP 7.4
ondrejmirtes Feb 6, 2020
10d285f
Enhancement: Run lint target using GitHub Actions
localheinz Feb 4, 2020
b086c3a
Rename action name
ondrejmirtes Feb 4, 2020
4b7b5ce
Rename steps
ondrejmirtes Feb 4, 2020
0cd2cba
Run Phing targets separately
ondrejmirtes Feb 4, 2020
8777cb8
Fix: Move workflow definition into appropriate directory
localheinz Feb 4, 2020
5aa888b
Fix: Expand build matrix
localheinz Feb 4, 2020
85cf998
Fix: Run jobs in parallel instead of job with multiple steps
localheinz Feb 4, 2020
b286210
Enhancement: Use shivammathur/setup-php to install PHP
localheinz Feb 4, 2020
1db51ba
Fix: Rename workflow definition file
localheinz Feb 4, 2020
a71b6f0
Run PHPCS only on PHP 7.4
ondrejmirtes Feb 4, 2020
97e7554
Use ComposerRequireChecker 2.1.0 that supports PHP 7.4
ondrejmirtes Feb 4, 2020
bebc469
Run static-analysis-with-static-php-parser on all PHP versions
ondrejmirtes Feb 4, 2020
6ea30af
Non-strict Composer validate
ondrejmirtes Feb 4, 2020
4636e47
Title Case is nicer
ondrejmirtes Feb 4, 2020
728e583
PHPCS will run only if Lint is successful, no need to && them together
ondrejmirtes Feb 4, 2020
dd91823
Enhancement: Run builds for pushes to any branch
localheinz Feb 5, 2020
a076bab
Fix: Run builds for pushes to master only
localheinz Feb 5, 2020
8367aa7
Try advice for Composer issue
ondrejmirtes Feb 6, 2020
d0f0197
Clean up what Travis CI does
ondrejmirtes Feb 6, 2020
10d041a
Enhancement: Configure COMPOSER_ROOT_VERSION environment variable for…
localheinz Feb 6, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
196 changes: 196 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Build"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name used here does not need to match the name of the workflow definition file.

However, I think it makes sense when they have at least a similar name.


on:
pull_request:
push:
branches:
- "master"

env:
COMPOSER_ROOT_VERSION: "0.12.x-dev"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this could be a potential workaround, @ondrejmirtes - I have moved it to the workflow level (so we don't have to repeat it).

It's currently not possible to use anchors - see https://github.community/t5/GitHub-Actions/Support-for-YAML-anchors/m-p/30336.


jobs:
coding-standards:
name: "Coding Standard"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@1.8.2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Validate Composer"
run: "composer validate"

- name: "Cache dependencies"
uses: "actions/cache@v1.0.3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"

- name: "Install dependencies"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Composer Normalize"
run: "vendor/bin/phing composer-normalize-check"

- name: "Lint"
run: "vendor/bin/phing lint"

- name: "Coding Standard"
run: "vendor/bin/phing cs"

dependency-analysis:
name: "Dependency Analysis"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@1.8.2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Cache dependencies"
uses: "actions/cache@v1.0.3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"

- name: "Install dependencies"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Composer Require Checker"
run: "vendor/bin/phing composer-require-checker"

tests:
name: "Tests"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@1.8.2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Cache dependencies"
uses: "actions/cache@v1.0.3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"

- name: "Install dependencies"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Tests"
run: "vendor/bin/phing tests"

static-analysis:
name: "PHPStan"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@1.8.2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Cache dependencies"
uses: "actions/cache@v1.0.3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"

- name: "Install dependencies"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "PHPStan"
run: "vendor/bin/phing phpstan"

static-analysis-with-static-php-parser:
name: "PHPStan with static PHP parser"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@1.8.2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Cache dependencies"
uses: "actions/cache@v1.0.3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"

- name: "Install dependencies"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "PHPStan with static PHP-Parser"
run: "vendor/bin/phing phpstan-static-php-parser"
21 changes: 4 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
os: linux
dist: xenial
language: php

stages:
- test
- name: phar
if: (branch = master OR tag IS present) && type = push

php:
- 7.1
- 7.2
- 7.3
- 7.4
- master

env:
global:
secure: "EpvZZ1v6JvefnfhgYm3Y2WprJxjgr6zDw2FJs+WISEtd1PHJToFJOE59vW7DRTcr5ycR4jrHyANqqIJWbH1k3A3wuyavmkissNKHbFK6vmLtAC9TuI/x5zBd+/T5yQ6i6uBe43nDzbkrQDYtGyNMdn1FXhWV9Z/hNCZ6uD0aiO5+d49NFJoexUOt3+LCxrZAGCCsm49KYRff/62QxO2Wajlfdhx+PLO0igY/i9N3oUQoVfbBEbP1ZSAPLv7ZkZGL4XdMMYEGYqnOeMWk39MYID34RmCYteWRfED4oqYbi4rzOpW8YeA/YkuHGThIykSLBrjdAfwUpekVEAI9r1gdrh91Gkpm/W/trFygdfI2gqev5GVjbYgmKQMm50l1W8wiD+Tb+AMUIttEXGjgwd+K2rn1RBHjM+CjPEWWdppg/7OOYVIJg0gIr94TN2LCQWDfFN5SxIIf0BpQmWteGEPCDpxCc3jsjpaVFXQ2jrui69Pdjr8/u7XCisQD9zpn4sQ43GZkdHC4rGOoBrjXQDWMB/LZyYNymJ6fkkuceqSgn6vDyBEkp9UBR1CIv4P8Ray86qEPodDFbPZMVX2JqDwUHMH3HVl4FINPYtVW3/VNUK7VihKd33+AjoX7anRTeq0T8jXUT4IF6tAxbO4DaDBB4XjQ3vCBDH15WxwIxy81KKA="
Expand All @@ -22,9 +13,6 @@ before_script:
- if php --ri xdebug >/dev/null; then phpenv config-rm xdebug.ini; fi
- composer update --no-interaction

script:
- vendor/bin/phing

jobs:
allow_failures:
- php: master
Expand All @@ -33,6 +21,8 @@ jobs:
- stage: test
php: 7.3
name: Compiler tests
os: linux
dist: xenial
script:
- |
cd compiler && \
Expand All @@ -41,13 +31,10 @@ jobs:
../bin/phpstan analyse -l 8 src tests && \
php bin/compile && \
../tmp/phpstan.phar
- stage: test
php: 7.3
name: PHPStan with static reflection for PHP-Parser
script:
- vendor/bin/phing phpstan-static-php-parser
- stage: phar
php: 7.3
os: linux
dist: xenial
before_install:
- |
openssl aes-256-cbc -K $encrypted_bd816b4f73f9_key -iv $encrypted_bd816b4f73f9_iv -in build/key.gpg.enc -out build/key.gpg -d && \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# PHPStan - PHP Static Analysis Tool

[![Build Status](https://travis-ci.org/phpstan/phpstan-src.svg)](https://travis-ci.org/phpstan/phpstan-src)
[![Build](https://github.com/phpstan/phpstan-src/workflows/Build/badge.svg)](https://github.com/phpstan/phpstan-src/actions)
[![PHPStan Enabled](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)

---
Expand Down
26 changes: 23 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project name="PHPStan" default="check">
<property name="path.composer-require-checker"
value="tmp/composer-require-checker-2.0.0.phar"/>
value="tmp/composer-require-checker-2.1.0.phar"/>
<property name="url.composer-require-checker"
value="https://github.com/maglnet/ComposerRequireChecker/releases/download/2.0.0/composer-require-checker.phar"/>
value="https://github.com/maglnet/ComposerRequireChecker/releases/download/2.1.0/composer-require-checker.phar"/>
<if>
<os family="windows"/>
<then>
Expand Down Expand Up @@ -280,6 +280,26 @@
</target>

<target name="phpstan-static-php-parser">
<property name="phpstan.config" value="build/phpstan-generated.neon"/>
<touch file="${phpstan.config}"/>
<append
destFile="${phpstan.config}"
text="includes: [ phpstan.static-php-parser.neon"
append="false"
></append>
<if>
<equals arg1="${isPHP74}" arg2="true" />
<then>
<append
destFile="${phpstan.config}"
text=", ignore-gte-php7.4-errors.neon"
></append>
</then>
</if>
<append
destFile="${phpstan.config}"
text=" ]"
></append>
<exec
executable="php"
logoutput="true"
Expand All @@ -291,7 +311,7 @@
<arg path="bin/phpstan"/>
<arg value="analyse"/>
<arg value="-c"/>
<arg path="build/phpstan.static-php-parser.neon"/>
<arg path="${phpstan.config}"/>
<arg value="-l"/>
<arg value="8"/>
<arg path="build/PHPStan"/>
Expand Down