Skip to content

Commit

Permalink
Merge pull request #20 from tattersoftware/tools
Browse files Browse the repository at this point in the history
Update dev toolkit
  • Loading branch information
MGatner committed Jul 16, 2021
2 parents 87bfe2e + cb99b6c commit e2b1d56
Show file tree
Hide file tree
Showing 14 changed files with 523 additions and 207 deletions.
3 changes: 1 addition & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
interval: daily
23 changes: 18 additions & 5 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
paths:
- 'src/**'
- 'tests/**'
- 'composer.**'
- 'phpstan*'
- '.github/workflows/analyze.yml'
push:
Expand All @@ -17,23 +18,30 @@ on:
paths:
- 'src/**'
- 'tests/**'
- 'composer.**'
- 'phpstan*'
- '.github/workflows/analyze.yml'

jobs:
build:
name: Analyze code
name: PHP ${{ matrix.php-versions }} Static Analysis
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['7.3', '7.4', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: ${{ matrix.php-versions }}
tools: composer, pecl, phpunit
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3, grpc
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3, grpc
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
Expand All @@ -59,8 +67,13 @@ jobs:
key: ${{ runner.os }}-phpstan-${{ github.sha }}
restore-keys: ${{ runner.os }}-phpstan-

- name: Install dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
- name: Install dependencies (limited)
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: Install dependencies (authenticated)
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/compare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# When a PR is opened or a push is made, compare
# code for backwards compatibility.
name: RoaveBC

on:
pull_request:
branches:
- develop
paths:
- 'src/**'

jobs:
compare:
name: Compare for Backwards Compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Run comparison (limited)
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
uses: docker://nyholm/roave-bc-check-ga

- name: Run comparison (authenticated)
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
uses: docker://nyholm/roave-bc-check-ga
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
83 changes: 83 additions & 0 deletions .github/workflows/inspect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# When a PR is opened or a push is made, perform an
# architectural inspection on the code using Deptrac.
name: Deptrac

on:
pull_request:
branches:
- 'develop'
paths:
- 'src/**'
- 'tests/**'
- 'composer.**'
- 'depfile.yaml'
- '.github/workflows/inspect.yml'
push:
branches:
- 'develop'
paths:
- 'src/**'
- 'tests/**'
- 'composer.**'
- 'depfile.yaml'
- '.github/workflows/inspect.yml'

jobs:
build:
name: PHP ${{ matrix.php-versions }} Architectural Inspection
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer, pecl, phive, phpunit
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3, grpc
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

- name: Create composer cache directory
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}

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

- name: Create Deptrac cache directory
run: mkdir -p build/

- name: Cache Deptrac results
uses: actions/cache@v2
with:
path: build
key: ${{ runner.os }}-deptrac-${{ github.sha }}
restore-keys: ${{ runner.os }}-deptrac-

- name: Install dependencies (limited)
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: Install dependencies (authenticated)
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

- name: Run architectural inspection
run: |
sudo phive --no-progress install --global qossmic/deptrac --trust-gpg-keys B8F640134AB1782E
deptrac analyze --cache-file=build/deptrac.cache
46 changes: 41 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ on:

jobs:
main:
name: Build and test
name: PHP ${{ matrix.php-versions }} Unit Tests

strategy:
max-parallel: 1
matrix:
php-versions: ['7.2', '7.3', '7.4']
php-versions: ['7.3', '7.4', '8.0']

runs-on: ubuntu-latest

Expand All @@ -35,8 +35,10 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
tools: composer, pecl, phpunit
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3, grpc
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3, grpc
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
Expand All @@ -49,10 +51,44 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
- name: Install dependencies (limited)
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: Install dependencies (authenticated)
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

- name: Test with PHPUnit
run: vendor/bin/phpunit --verbose --coverage-text
env:
TERM: xterm-256color
TACHYCARDIA_MONITOR_GA: enabled

- if: matrix.php-versions == '8.0'
name: Mutate with Infection
run: |
composer global require infection/infection
git fetch --depth=1 origin $GITHUB_BASE_REF
infection --threads=2 --skip-initial-tests --coverage=build/phpunit --git-diff-base=origin/$GITHUB_BASE_REF --git-diff-filter=AM --logger-github --ignore-msi-with-no-mutations
- if: matrix.php-versions == '8.0'
name: Run Coveralls
run: vendor/bin/php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }}

coveralls:
needs: [main]
name: Coveralls Finished
runs-on: ubuntu-latest
steps:
- name: Upload Coveralls results
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
33 changes: 33 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Nexus\CsConfig\Factory;
use PhpCsFixer\Finder;
use Tatter\Tools\Standard;

$finder = Finder::create()
->files()
->in(__DIR__)
->exclude('build')
->append([__FILE__]);

// Remove overrides for incremental changes
$overrides = [
'array_indentation' => false,
'braces' => false,
'indentation_type' => false,
];

$options = [
'finder' => $finder,
'cacheFile' => 'build/.php-cs-fixer.cache',
];

/* Reenable after incremental changes are applied
return Factory::create(new Standard(), $overrides, $options)->forLibrary(
'Library',
'Tatter Software',
'',
2021
);
*/
return Factory::create(new Standard(), $overrides, $options)->forProjects();
Loading

0 comments on commit e2b1d56

Please sign in to comment.