Skip to content

Commit

Permalink
Introduce dev tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
frankverhoeven committed Sep 20, 2021
1 parent dff812d commit 5dd83cc
Show file tree
Hide file tree
Showing 64 changed files with 519 additions and 544 deletions.
78 changes: 37 additions & 41 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,39 @@
name: Unit Tests

on:
push:
branches:
- master
pull_request:
branches:
- "*"
schedule:
- cron: '0 0 * * *'
name: Test

on: push

jobs:
php-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
COMPOSER_NO_INTERACTION: 1

strategy:
matrix:
php: [8.0, 7.4, 7.3, 7.2]
dependency-version: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }}

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2

- name: Install dependencies
run: |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress
- name: Execute Unit Tests
run: composer test
test:
runs-on: ubuntu-latest

strategy:
matrix:
php: [ 8.0, 7.4, 7.2 ]

name: PHP-${{ matrix.php }}

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

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

- name: Install Dependencies
run: composer install --no-interaction --no-ansi --no-progress

- name: Coding Standard
run: vendor/bin/phpcs --exclude=SlevomatCodingStandard.TypeHints.ReturnTypeHint,SlevomatCodingStandard.TypeHints.DeclareStrictTypes,SlevomatCodingStandard.Operators.DisallowEqualOperators,SlevomatCodingStandard.TypeHints.ParameterTypeHint,Generic.Files.LineLength,SlevomatCodingStandard.Classes.SuperfluousTraitNaming,SlevomatCodingStandard.TypeHints.PropertyTypeHint,SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming,Squiz.Strings.DoubleQuoteUsage,Squiz.Commenting.FunctionComment

- name: Execute Unit Tests
run: composer test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ phpunit.xml
/.idea
.DS_Store
.phpunit.result.cache
.phpcs-cache
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
},
"require-dev": {
"omnipay/tests": "^4.1",
"squizlabs/php_codesniffer": "^3"
"vimeo/psalm": "^4.10",
"myonlinestore/coding-standard": "^3.1"
},
"extra": {
"branch-alias": {
Expand Down
16 changes: 16 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
<arg name="basepath" value="."/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>
<arg value="sp"/>

<file>src</file>
<file>tests</file>

<rule ref="MyOnlineStore"/>
</ruleset>
14 changes: 8 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>
<testsuites>
<testsuite name="Omnipay Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
16 changes: 16 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<psalm
errorLevel="2"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="tests" />
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
Loading

0 comments on commit 5dd83cc

Please sign in to comment.