Skip to content

Commit

Permalink
Fixed broken test, introduce pipeline github
Browse files Browse the repository at this point in the history
  • Loading branch information
Koen Eelen committed Apr 11, 2024
1 parent f9a2561 commit 550fc51
Show file tree
Hide file tree
Showing 13 changed files with 980 additions and 578 deletions.
10 changes: 10 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# CODEOWNERS are automatically assigned as possible reviewers to new PRs.

# Global owners (also need to be duplicated in later rules)
* @LucWollants @JonasVHG @simon-debruijn @grubolsch

# Jenkins / deployment owners
Gemfile* @willaerk @paulherbosch
Jenkinsfile* @willaerk @paulherbosch
Rakefile @willaerk @paulherbosch
lib/ @willaerk @paulherbosch
75 changes: 75 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: CI

on: push

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0']
name: PHP ${{ matrix.php-versions }}
steps:
- name: 📤 Checkout project
uses: actions/checkout@v2

- name: 🐘 Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
ini-values: xdebug.mode=coverage
tools: composer

- name: ✌️ Check PHP Version
run: php -v

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

- name: 📩 Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: 📦 Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-suggest

- name: ✅ Run tests
run: composer test

phpstan:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '7.4', '8.0' ]
name: Static analysis (PHP ${{ matrix.php-versions }})
steps:
- name: 📤 Checkout project
uses: actions/checkout@v2

- name: 🐘 Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer

- name: 📩 Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: 📦 Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-suggest

- name: 🔍 Run static analysis
run: composer phpstan
14 changes: 2 additions & 12 deletions app/BaseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ abstract class BaseServiceProvider extends AbstractServiceProvider
{
/**
* Add Service definition to container
*
* @param string $serviceName
* @param $function
* @param string|null $tag
*/
protected function add(string $serviceName, $function, ?string $tag = null): void
protected function add(string $serviceName, callable $function, ?string $tag = null): void
{
$definition = $this->getLeagueContainer()
->add($serviceName, $function);
Expand All @@ -26,12 +22,8 @@ protected function add(string $serviceName, $function, ?string $tag = null): voi

/**
* Add Service definition to container
*
* @param string $serviceName
* @param $function
* @param string|null $tag
*/
protected function addShared(string $serviceName, $function, ?string $tag = null): void
protected function addShared(string $serviceName, callable $function, ?string $tag = null): void
{
$definition = $this->getLeagueContainer()
->share($serviceName, $function);
Expand All @@ -44,7 +36,6 @@ protected function addShared(string $serviceName, $function, ?string $tag = null
/**
* Get parameter from config
*
* @param string $parameter
* @return mixed
*/
protected function parameter(string $parameter)
Expand All @@ -55,7 +46,6 @@ protected function parameter(string $parameter)
/**
* Get service from container
*
* @param string $name
* @return mixed
*/
protected function get(string $name)
Expand Down
8 changes: 4 additions & 4 deletions app/Console/DecodeJwtCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace CultuurNet\UDB3\JwtProvider\Console;

use CultuurNet\UDB3\Jwt\JWTDecoderServiceInterface;
use CultuurNet\UDB3\Jwt\JwtDecoderServiceInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -11,9 +11,9 @@

class DecodeJwtCommand extends Command
{
private JWTDecoderServiceInterface $decoder;
private JwtDecoderServiceInterface $decoder;

public function __construct(JWTDecoderServiceInterface $decoder)
public function __construct(JwtDecoderServiceInterface $decoder)
{
parent::__construct();
$this->decoder = $decoder;
Expand Down Expand Up @@ -50,6 +50,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Signature verification: ' . ($verified ? '' : ''));

// Return 0 as exit code if verified & valid, otherwise 1.
return !($valid && $verified);
return ($valid && $verified) ? 1 : 0;
}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"zendframework/zend-httphandlerrunner": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "^7.5",
"escapestudios/symfony2-coding-standard": "~2.9",
"squizlabs/php_codesniffer": "~2.5.1",
"satooshi/php-coveralls": "^2.1",
"phpstan/phpstan": "^1.10",
"rector/rector": "^1.0"
"rector/rector": "^1.0",
"phpunit/phpunit": "^9.6"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 550fc51

Please sign in to comment.