Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(actions): add test github action #9

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{js,json,vue,css,less,scss}]
indent_size = 2

[Makefile]
indent_style = tab
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Tests

on:
push:
branches: ["master"]
pull_request:
branches: ["*"]

permissions:
contents: read

jobs:
tests:

strategy:
matrix:
php_version: ["7.4", "8.0", "8.1", "8.2", "8.3"]

runs-on: ubuntu-latest
container:
image: "lephare/php:${{ matrix.php_version }}"
env:
XDEBUG_MODE: coverage

steps:
- uses: actions/checkout@v4

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Install dependencies (PHP ${{ matrix.php_version }})
run: |
composer config --global cache-dir .composer
composer install --prefer-dist --no-interaction --no-progress

- name: Coding Style (PHP ${{ matrix.php_version }})
run: |
composer run-script lint:ci
composer run-script analyse

- name: Unit Tests (PHP ${{ matrix.php_version }})
run: composer run-script test:ci
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendor
.idea
*.cache
composer.lock
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('lephare_import');

/** @var ArrayNodeDefinition */
/** @var ArrayNodeDefinition $rootNode */
$rootNode = $treeBuilder->getRootNode();

$rootNode
Expand Down
2 changes: 1 addition & 1 deletion Tests/EventSubscriber/EmailReportSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function testPostExecuteWithEmailRecipients(): void
$this->createSubscriber()->onPostExecute($event);
}

public function provideEmails(): iterable
public static function provideEmails(): iterable
{
$f = Factory::create();

Expand Down
13 changes: 12 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,33 @@
},
"extra": {
"branch-alias": {
"dev-main": "2.0-dev"
"dev-master": "2.0-dev"
}
},
"config": {
"sort-packages": true
},
"require-dev": {
"doctrine/collections": "^1.6|^2.0",
"fakerphp/faker": "^1.23",
"friendsofphp/php-cs-fixer": "^3.3",
"phpspec/prophecy-phpunit": "^2.2",
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^9.6",
"symfony/config": "^5.4|^6.0|^7.0",
"symfony/event-dispatcher": "^5.4|^6.0|^7.0",
"symfony/mailer": "^5.4|^6.0|^7.0",
"symfony/maker-bundle": "^1.36",
"symfony/twig-bridge": "^5.4|^6.0|^7.0"
},
"scripts": {
"analyse": "./vendor/bin/phpstan analyse --no-progress",
"lint": "./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run",
"lint:ci": "@lint:fix --using-cache=no --dry-run",
"lint:fix": "./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php",
"test:ci": "@test --colors=never --coverage-text",
"test": "./vendor/bin/phpunit"
},
"suggest": {
"symfony/mailer": "to enable support for email reports",
"symfony/twig-bridge": "to enable support for templated emails reports"
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ parameters:
- vendor/
- node_modules/
- Resources/
ignoreErrors:
-
message: '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface::.+\(\)#'
paths:
- DependencyInjection/Configuration.php
tmpDir: .phpstan.cache
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" syntaxCheck="false" bootstrap="vendor/autoload.php">
<phpunit backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="vendor/autoload.php">

<testsuites>
<testsuite name="ImportBundle test suite">
Expand Down