Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #10 from elbgoods/feature/add-gh-action
Browse files Browse the repository at this point in the history
add gh action test runner
  • Loading branch information
Gummibeer authored Feb 3, 2020
2 parents 166d1f9 + b40ffe9 commit 6aa1755
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 5 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: run-tests

on: push

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [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@v1

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

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest

- name: php-cs-test
run: bin/php-cs-test

- name: php-md-test
run: bin/php-md-test ./src

- name: php-tlint-test
run: bin/php-tlint-test

- name: php-insights-test
run: bin/php-insights-test
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Packagist](https://img.shields.io/packagist/l/elbgoods/ci-test-tools?style=flat-square)](https://packagist.org/packages/elbgoods/ci-test-tools)
[![PHP from Packagist](https://img.shields.io/packagist/php-v/elbgoods/ci-test-tools?style=flat-square)](https://packagist.org/packages/elbgoods/ci-test-tools)
[![Packagist Version](https://img.shields.io/packagist/v/elbgoods/ci-test-tools?style=flat-square)](https://packagist.org/packages/elbgoods/ci-test-tools)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/elbgoods/ci-test-tools/run-tests?style=flat-square)](https://github.com/elbgoods/ci-test-tools/actions?query=workflow%3Arun-tests)

## Installation

Expand Down Expand Up @@ -82,3 +83,18 @@ vendor/bin/php-md-test
#### Configuration

If you think that a rule should be adjusted/ignored open a PR in [this repo](https://github.com/elbgoods/ci-test-tools) to discuss it.

### PHP Insights

* **tool:** https://github.com/nunomaduro/phpinsights
* **config:** [configs/phpinsights.php](configs/phpinsights.php)

#### Usage

```bash
vendor/bin/php-insights-test
```

#### Configuration

If you think that a rule should be adjusted/ignored open a PR in [this repo](https://github.com/elbgoods/ci-test-tools) to discuss it.
2 changes: 1 addition & 1 deletion bin/php-md-test
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -e

DIR="$(dirname "$(readlink -f "$0")")"
vendor/bin/phpmd ./app text ${DIR}/../configs/phpmd.xml
vendor/bin/phpmd ${1:-./app} text ${DIR}/../configs/phpmd.xml
2 changes: 1 addition & 1 deletion bin/php-tlint-test
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -e

vendor/bin/tlint lint
vendor/bin/tlint lint --no-interaction
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
],
"require": {
"php": "^7.2",
"friendsofphp/php-cs-fixer": "^2.16",
"friendsofphp/php-cs-fixer": "^2.16.1",
"jasonmccreary/laravel-test-assertions": "^0.3",
"pdepend/pdepend": "@stable",
"phpmd/phpmd": "^2.8",
"phpunit/phpunit": "^8.0",
"tightenco/tlint": "^3.0",
"tightenco/tlint": "^3.0.7",
"illuminate/support": "^6.0",
"nunomaduro/phpinsights": "^1.12"
},
Expand Down
2 changes: 1 addition & 1 deletion src/PHPUnit/Assertions/ModelAssertions.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static function assertIsTranslatableString($actual): void
PHPUnit::assertIsArray($actual);
PHPUnit::assertArrayHasKey('en', $actual);
PHPUnit::assertIsString($actual['en']);
foreach ($actual as $locale => $translation) {
foreach ($actual as $translation) {
NullableTypeAssertions::assertIsNullableString($translation);
}
}
Expand Down
3 changes: 3 additions & 0 deletions tlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"preset": "\\Elbgoods\\CiTestTools\\TlintPreset"
}

0 comments on commit 6aa1755

Please sign in to comment.