Skip to content

Commit

Permalink
Merge pull request #20 from trejjam/feature/github-actions-php-8
Browse files Browse the repository at this point in the history
Allow PHP ^8.0, add Github Actions
  • Loading branch information
Ocramius authored May 7, 2021
2 parents 00cd927 + 8c91141 commit 0e96bca
Show file tree
Hide file tree
Showing 17 changed files with 365 additions and 109 deletions.
268 changes: 268 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
name: "build"

on:
pull_request:
paths-ignore:
- ".docs/**"
push:
branches:
- "master"
schedule:
- cron: "0 8 * * 1" # At 08:00 on Monday

env:
extensions: "json hash"
cache-version: "1"
composer-version: "v2"
composer-install: "composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-stable"

jobs:
qa:
name: "Quality assurance"
runs-on: "${{ matrix.operating-system }}"

strategy:
matrix:
php-version: ["7.4"]
operating-system: ["ubuntu-latest"]
fail-fast: false

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

- name: "Setup PHP cache environment"
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

- name: "Cache PHP extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.extcache.outputs.dir }}"
key: "${{ steps.extcache.outputs.key }}"
restore-keys: "${{ steps.extcache.outputs.key }}"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer:${{ env.composer-version }} "

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'

- name: "Get Composer cache directory"
id: "composercache"
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'

- name: "Cache PHP dependencies"
uses: "actions/cache@v2"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"

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

- name: "Install dependencies"
run: "${{ env.composer-install }}"

- name: "Coding Standard"
run: "make cs"

static-analysis:
name: "Static analysis"
runs-on: "${{ matrix.operating-system }}"

strategy:
matrix:
php-version: ["7.4"]
operating-system: ["ubuntu-latest"]
fail-fast: false

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

- name: "Setup PHP cache environment"
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

- name: "Cache PHP extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.extcache.outputs.dir }}"
key: "${{ steps.extcache.outputs.key }}"
restore-keys: "${{ steps.extcache.outputs.key }}"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer:${{ env.composer-version }} "

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'

- name: "Get Composer cache directory"
id: "composercache"
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'

- name: "Cache PHP dependencies"
uses: "actions/cache@v2"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: "Install dependencies"
run: "${{ env.composer-install }}"

- name: "PHPStan"
run: "make phpstan"

tests:
name: "Tests"
runs-on: "${{ matrix.operating-system }}"

strategy:
matrix:
php-version: ["7.4", "8.0"]
operating-system: ["ubuntu-latest"]
composer-args: [ "" ]
include:
- php-version: "7.4"
operating-system: "ubuntu-latest"
composer-args: "--prefer-lowest"
- php-version: "8.1"
operating-system: "ubuntu-latest"
composer-args: "--ignore-platform-reqs"
fail-fast: false

continue-on-error: "${{ matrix.php-version == '8.1' }}"

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

- name: "Setup PHP cache environment"
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

- name: "Cache PHP extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.extcache.outputs.dir }}"
key: "${{ steps.extcache.outputs.key }}"
restore-keys: "${{ steps.extcache.outputs.key }}"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer:${{ env.composer-version }} "

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'

- name: "Get Composer cache directory"
id: "composercache"
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'

- name: "Cache PHP dependencies"
uses: "actions/cache@v2"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: "Install dependencies"
run: "${{ env.composer-install }} ${{ matrix.composer-args }}"

- name: "Setup problem matchers for PHPUnit"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"'

- name: "Tests"
run: "make tests"

mutation-tests:
name: "Mutation tests"
runs-on: "${{ matrix.operating-system }}"

strategy:
matrix:
php-version: ["7.4", "8.0"]
operating-system: ["ubuntu-latest"]
composer-args: [ "" ]
include:
- php-version: "7.4"
operating-system: "ubuntu-latest"
composer-args: "--prefer-lowest"
- php-version: "8.1"
operating-system: "ubuntu-latest"
composer-args: "--ignore-platform-reqs"
fail-fast: false

continue-on-error: "${{ matrix.php-version == '8.1' }}"

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

- name: "Setup PHP cache environment"
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

- name: "Cache PHP extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.extcache.outputs.dir }}"
key: "${{ steps.extcache.outputs.key }}"
restore-keys: "${{ steps.extcache.outputs.key }}"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer:${{ env.composer-version }} "

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'

- name: "Get Composer cache directory"
id: "composercache"
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'

- name: "Cache PHP dependencies"
uses: "actions/cache@v2"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: "Install dependencies"
run: "${{ env.composer-install }} ${{ matrix.composer-args }}"

- name: "Tests"
run: "make mutation-tests"
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.PHONY: install qa cs phpstan tests mutation-tests

install:
composer update

qa: phpstan cs

cs:
vendor/bin/phpcs

phpstan:
vendor/bin/phpstan analyse

tests:
vendor/bin/phpunit

mutation-tests:
vendor/bin/infection --min-msi=100 --min-covered-msi=100
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![`roave/no-floaters`](logo/roave-no-floaters.png)

[![Build Status](https://travis-ci.org/Roave/no-floaters.png?branch=master)](https://travis-ci.org/Roave/no-floaters)
[![Build Status](https://badgen.net/github/checks/Roave/no-floaters/master)](https://github.com/Roave/no-floaters/actions)
[![Latest Stable Version](https://poser.pugx.org/roave/no-floaters/v/stable.png)](https://packagist.org/packages/roave/no-floaters)

This library is a [PHPStan](https://github.com/phpstan/phpstan) plugin
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
"MIT"
],
"require": {
"php": "^7.2",
"php": "^7.4 | ^8.0",
"nikic/php-parser": "^4.0",
"phpstan/phpstan": "^0.12"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"infection/infection": "^0.11.4",
"doctrine/coding-standard": "^8.0",
"infection/infection": "^0.21.5",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^7.4",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.4"
},
"autoload": {
Expand Down
11 changes: 7 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
</testsuite>
</testsuites>

<filter>
<whitelist>
<coverage includeUncoveredFiles="true"
processUncoveredFiles="true"
ignoreDeprecatedCodeUnits="true"
disableCodeCoverageIgnore="true">
<include>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</include>
</coverage>
</phpunit>
Loading

0 comments on commit 0e96bca

Please sign in to comment.