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

Migrate CI to github actions #71

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI

on:
push:
branches:
- master
- '[0-9]+.[0-9x]+'
pull_request:

jobs:
check_composer:
name: Check composer.json
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: '7.4'
- run: composer validate --strict --no-check-lock

tests:
name: "Tests on PHP ${{ matrix.php }}${{ matrix.name_suffix }}"
runs-on: ubuntu-latest

env:
SYMFONY_DEPRECATIONS_HELPER: 'max[direct]=0' # TODO remove that once upgrading dev-deps job to run on PHPUnit 9.5 on PHP 8

strategy:
fail-fast: false
matrix:
php: [ '7.1', '7.2', '7.3', '7.4' ]
min_stability: [ '' ]
name_suffix: [ '' ]
composer_flags: [ '' ]
symfony_version: [ '' ]
coverage: [ 'none' ]
include:
- php: '7.4'
min_stability: 'dev'
name_suffix: ' (dev deps)'
coverage: 'xdebug'
- php: '7.1'
min_stability: ''
name_suffix: ' (lowest deps)'
composer_flags: '--prefer-lowest'
coverage: 'none'
- php: '7.4'
name_suffix: ' (Symfony LTS 4.x)'
symfony_version: '^4'
coverage: 'none'

steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
coverage: "${{ matrix.coverage }}"
php-version: "${{ matrix.php }}"

- name: Configure stability
if: "matrix.min_stability != ''"
run: composer config minimum-stability "${{ matrix.min_stability }}"

- name: force Symfony version
run: composer require "symfony/lts:${{ matrix.symfony_version }}@dev" --dev --no-update
if: "matrix.symfony_version != ''"

- name: Install dependencies
run: composer update --ansi --no-progress --prefer-dist --no-interaction ${{ matrix.composer_flags }}

- name: Install PHPUnit
run: vendor/bin/simple-phpunit install

- name: Run tests
if: "matrix.coverage == 'none'"
run: vendor/bin/simple-phpunit -v --colors=always

- name: Run tests with code coverage
if: "matrix.coverage != 'none'"
run: vendor/bin/simple-phpunit -v --colors=always --coverage-clover=coverage.clover

- name: Install coverage uploader
if: "matrix.coverage != 'none'"
run: wget https://scrutinizer-ci.com/ocular.phar

- name: Upload code coverage to Scrutinizer
if: "matrix.coverage != 'none'"
run: php ocular.phar code-coverage:upload --format=php-clover coverage.clover
49 changes: 0 additions & 49 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions Command/CloudCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ abstract protected function doExecuteCommand(InputInterface $input, OutputInterf

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
2 changes: 2 additions & 0 deletions Command/ModifyCloudCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ protected function configure()

/**
* {@inheritDoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
2 changes: 2 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*
* @return TreeBuilder
*/
public function getConfigTreeBuilder()
{
Expand Down
2 changes: 2 additions & 0 deletions DependencyInjection/XabbuhPandaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ private function loadClouds(array $clouds, ContainerBuilder $container, array $k

/**
* {@inheritDoc}
*
* @return string
*/
public function getNamespace()
{
Expand Down
17 changes: 14 additions & 3 deletions Event/EventFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

namespace Xabbuh\PandaBundle\Event;

use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\InputBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\EventDispatcher\Event;

/**
* Create Panda events based on requests.
Expand Down Expand Up @@ -117,7 +118,12 @@ public static function createEncodingProgressEventFromRequest(Request $request)
public static function createVideoCreatedEventFromRequest(Request $request)
{
$videoId = $request->request->get('video_id');
$encodingIds = $request->request->get('encoding_ids');
if ($request->request instanceof InputBag) {
$encodingIds = $request->request->all('encoding_ids');
} else {
// BC for symfony < 5.1
$encodingIds = $request->request->get('encoding_ids');
}

if (null === $videoId || !is_string($videoId)) {
throw new \InvalidArgumentException('no valid video id given');
Expand All @@ -142,7 +148,12 @@ public static function createVideoCreatedEventFromRequest(Request $request)
public static function createVideoEncodedEventFromRequest(Request $request)
{
$videoId = $request->request->get('video_id');
$encodingIds = $request->request->get('encoding_ids');
if ($request->request instanceof InputBag) {
$encodingIds = $request->request->all('encoding_ids');
} else {
// BC for symfony < 5.1
$encodingIds = $request->request->get('encoding_ids');
}

if (null === $videoId || !is_string($videoId)) {
throw new \InvalidArgumentException('no valid video id given');
Expand Down
1 change: 0 additions & 1 deletion Form/Extension/VideoUploaderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

/**
Expand Down
5 changes: 1 addition & 4 deletions Tests/Command/CancelEncodingCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Xabbuh\PandaBundle\Tests\Command;

use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
use Symfony\Component\Console\Command\Command;
use Xabbuh\PandaBundle\Command\CancelEncodingCommand;
use Xabbuh\PandaClient\Model\Encoding;
Expand All @@ -21,9 +20,7 @@
*/
class CancelEncodingCommandTest extends CloudCommandTest
{
use SetUpTearDownTrait;

private function doSetUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
5 changes: 1 addition & 4 deletions Tests/Command/ChangeUrlCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Xabbuh\PandaBundle\Tests\Command;

use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
use Symfony\Component\Console\Command\Command;
use Xabbuh\PandaBundle\Command\ChangeUrlCommand;
use Xabbuh\PandaClient\Model\Notifications;
Expand All @@ -21,9 +20,7 @@
*/
class ChangeUrlCommandTest extends CloudCommandTest
{
use SetUpTearDownTrait;

private function doSetUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
5 changes: 1 addition & 4 deletions Tests/Command/CloudCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@

namespace Xabbuh\PandaBundle\Tests\Command;

use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
use Xabbuh\PandaClient\Exception\PandaException;

/**
* @author Christian Flothmann <[email protected]>
*/
abstract class CloudCommandTest extends CommandTest
{
use SetUpTearDownTrait;

/**
* @var \Xabbuh\PandaClient\Api\CloudManager|\PHPUnit_Framework_MockObject_MockObject
*/
Expand All @@ -33,7 +30,7 @@ abstract class CloudCommandTest extends CommandTest

protected $apiMethod;

private function doSetUp()
protected function setUp(): void
{
$this->createCloudManagerMock();

Expand Down
5 changes: 1 addition & 4 deletions Tests/Command/CloudInfoCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Xabbuh\PandaBundle\Tests\Command;

use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
use Symfony\Component\Console\Command\Command;
use Xabbuh\PandaBundle\Command\CloudInfoCommand;
use Xabbuh\PandaClient\Model\Cloud;
Expand All @@ -21,9 +20,7 @@
*/
class CloudInfoCommandTest extends CloudCommandTest
{
use SetUpTearDownTrait;

private function doSetUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
5 changes: 1 addition & 4 deletions Tests/Command/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Xabbuh\PandaBundle\Tests\Command;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Tester\CommandTester;
Expand All @@ -23,8 +22,6 @@
*/
abstract class CommandTest extends TestCase
{
use SetUpTearDownTrait;

/**
* @var Application
*/
Expand All @@ -40,7 +37,7 @@ abstract class CommandTest extends TestCase
*/
protected $commandTester;

private function doSetUp()
protected function setUp(): void
{
$this->command = $this->createCommand();

Expand Down
5 changes: 1 addition & 4 deletions Tests/Command/CreateEncodingCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Xabbuh\PandaBundle\Tests\Command;

use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
use Symfony\Component\Console\Command\Command;
use Xabbuh\PandaBundle\Command\CreateEncodingCommand;
use Xabbuh\PandaClient\Model\Encoding;
Expand All @@ -22,9 +21,7 @@
*/
class CreateEncodingCommandTest extends CloudCommandTest
{
use SetUpTearDownTrait;

private function doSetUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
5 changes: 1 addition & 4 deletions Tests/Command/CreateProfileCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Xabbuh\PandaBundle\Tests\Command;

use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
use Symfony\Component\Console\Command\Command;
use Xabbuh\PandaBundle\Command\CreateProfileCommand;
use Xabbuh\PandaClient\Model\Profile;
Expand All @@ -21,9 +20,7 @@
*/
class CreateProfileCommandTest extends CloudCommandTest
{
use SetUpTearDownTrait;

private function doSetUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
5 changes: 1 addition & 4 deletions Tests/Command/DeleteEncodingCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Xabbuh\PandaBundle\Tests\Command;

use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
use Symfony\Component\Console\Command\Command;
use Xabbuh\PandaBundle\Command\DeleteEncodingCommand;
use Xabbuh\PandaClient\Model\Encoding;
Expand All @@ -21,9 +20,7 @@
*/
class DeleteEncodingCommandTest extends CloudCommandTest
{
use SetUpTearDownTrait;

private function doSetUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
Loading