Skip to content

Commit

Permalink
Merge pull request #357 from markstory/update-ci
Browse files Browse the repository at this point in the history
Update CI to github.
  • Loading branch information
markstory committed Nov 24, 2020
2 parents e4444f9 + 379ec89 commit 324252e
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 58 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- '*'

jobs:
testsuite-linux:
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
php-version: ['7.2', '7.4', '8.0']
prefer-lowest: ['']
include:
- php-version: '7.2'
prefer-lowest: 'prefer-lowest'

steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: pcov

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

- name: Get date part for cache key
id: key-date
run: echo "::set-output name=date::$(date +'%Y-%m')"

- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}

- name: Composer install
run: |
if [[ ${{ matrix.php-version }} == '8.0' ]]; then
composer install --ignore-platform-reqs
elif ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
composer update --prefer-lowest --prefer-stable
else
composer install
fi
- name: Run PHPUnit
run: |
if [[ ${{ matrix.php-version }} == '7.4' ]]; then
vendor/bin/phpunit --coverage-clover=coverage.xml
else
vendor/bin/phpunit
fi
- name: Code Coverage Report
if: success() && matrix.php-version == '7.4'
uses: codecov/codecov-action@v1

cs-stan:
name: Coding Standard & Static Analysis
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl
coverage: none
tools: psalm:~4.1.0, phpstan:^0.12

- name: Composer Install
run: composer install

- name: Run phpcs
run: vendor/bin/phpcs -p src/ tests/

- name: Run psalm
run: psalm --output-format=github

- name: Run phpstan
run: phpstan analyse
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
"require": {
"php": ">=7.2.0",
"cakephp/cakephp": "^4.0",
"markstory/mini-asset": ">=1.4.0 <2.0.0",
"markstory/mini-asset": ">=1.9.1 <2.0.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "~8.5.0",
"phpunit/phpunit": "^8.5 | ^9.3",
"cakephp/cakephp-codesniffer": "^4.0"
},
"autoload": {
Expand All @@ -51,13 +51,13 @@
"@test",
"@stan"
],
"cs-check": "phpcs -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/TestCase/",
"cs-fix": "phpcbf --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/TestCase/",
"cs-check": "phpcs -p src/ tests/TestCase/",
"cs-fix": "phpcbf src/ tests/TestCase/",
"test": "phpunit --stderr",
"stan": "phpstan analyse src/ && psalm --show-info=false",
"stan-test": "phpstan analyse tests/",
"psalm": "psalm",
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^0.12 vimeo/psalm:^3.0 && mv composer.backup composer.json",
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^0.12 vimeo/psalm:~4.1.0 && mv composer.backup composer.json",
"coverage-test": "phpunit --stderr --coverage-clover=clover.xml"
}
}
File renamed without changes.
5 changes: 3 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
parameters:
level: 5
checkMissingIterableValueType: false
autoload_files:
bootstrapFiles:
- tests/bootstrap.php
ignoreErrors:
paths:
- src/
19 changes: 11 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="tests/bootstrap.php"
>
<phpunit bootstrap="tests/bootstrap.php">
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>

<testsuites>
<testsuite name="asset-compress">
<directory>tests/</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="asset-compress">
<directory>tests/</directory>
</testsuite>
</testsuites>
</phpunit>
4 changes: 2 additions & 2 deletions tests/TestCase/Middleware/AssetCompressMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

use AssetCompress\Middleware\AssetCompressMiddleware;
use Cake\Core\Configure;
use Cake\Http\Response;
use Cake\Http\ServerRequest;
use Cake\TestSuite\TestCase;
use Laminas\Diactoros\Response;
use Laminas\Diactoros\ServerRequest;
use MiniAsset\AssetConfig;

class AssetCompressMiddlewareTest extends TestCase
Expand Down

0 comments on commit 324252e

Please sign in to comment.