Skip to content

Commit

Permalink
feat: github actions with phpstan, phpcs and phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeriolino committed Jul 25, 2024
1 parent 8e9f990 commit 1dd7e8d
Show file tree
Hide file tree
Showing 39 changed files with 396 additions and 618 deletions.
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
| Q | A
| ---------------- | -----
| Bug report? | yes/no
| Feature request? | yes/no
| Novo SGA version | x.y.z
| PHP version | x.y.z
| Database version | MySQL 5.7/PostgreSQL 15
| Platform/OS | Linux/Windows

<!--
- Please fill in this template according to your issue.
- Replace this comment by the description of your issue.
-->
24 changes: 24 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: shivammathur/[email protected]
with:
php-version: 8.2

- name: Install dependencies
run: composer install

- name: PHP Code Standards
run: vendor/bin/phpcs

- name: PHP Code Analysis
run: vendor/bin/phpstan

- name: PHP Unit Tests
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendor/
composer.lock
.phpcs-cache
.phpunit.result.cache
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
"psr-4": { "Novosga\\": "src/" }
},
"autoload-dev": {
"psr-4": { "Novosga\\": "tests/" }
"psr-4": { "Novosga\\Tests\\": "tests/" }
},
"require": {
"php": ">=8.2",
"doctrine/orm": "^3.2",
"symfony/http-kernel": "7.1.*"
"symfony/http-kernel": "7.1.*",
"symfony/form": "7.1.*",
"symfony/event-dispatcher-contracts": "^3.5",
"symfony/validator": "7.1.*",
"symfony/security-core": "7.1.*"
},
"require-dev": {
"phpstan/phpstan": "^1.10",
Expand Down
23 changes: 23 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>

<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

<config name="installed_paths" value="../../slevomat/coding-standard"/>

<arg name="basepath" value="."/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>

<rule ref="PSR12"/>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true" />
</properties>
</rule>

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

</ruleset>
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 6
paths:
- src/
- tests/
31 changes: 31 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
convertDeprecationsToExceptions="false"
>
<php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
</php>

<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>

<extensions>
</extensions>
</phpunit>
91 changes: 0 additions & 91 deletions src/Configuration/OrderingParameter.php

This file was deleted.

23 changes: 0 additions & 23 deletions src/Configuration/ParameterInterface.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Entity/AtendimentoInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function setTempoAtendimento(DateInterval $tempoAtendimento): static;
public function getTempoAtendimento(): DateInterval;

public function setTempoDeslocamento(DateInterval $tempoDeslocamento): static;
public function getTempoDeslocamento();
public function getTempoDeslocamento(): DateInterval;

public function getCliente(): ?ClienteInterface;
public function setCliente(ClienteInterface $cliente): static;
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/EntityMetadataInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

/**
* EntityMetadataInterface.
*
*
* @template T
*
*
* @author Rogerio Lino <[email protected]>
*/
interface EntityMetadataInterface extends MetadataInterface
Expand Down
29 changes: 0 additions & 29 deletions src/Event/AdvancedEvent.php

This file was deleted.

54 changes: 0 additions & 54 deletions src/Event/Event.php

This file was deleted.

37 changes: 0 additions & 37 deletions src/Event/EventDispatcherInterface.php

This file was deleted.

Loading

0 comments on commit 1dd7e8d

Please sign in to comment.