Skip to content

Commit

Permalink
Github actions support (include PHP 8 tests) (#309)
Browse files Browse the repository at this point in the history
* Create run-tests.yml

* support different versions of symfony

* wip+

* fix

* fix

* wip

* fix

* remove cache

* wip

* fx

* add allowed to fail

* wip

* r

* fix

* disable libxml from tests on php version 8

* fix

* add phpunit 8 for php 8

* remove yet support for phpunit 8

* allow to fail

* fix

* allow to fail always true

* add xdebug for coverage

* always dependencies highest

* add typehint

* fix

* add symfony version to title

* update

* Element phpunit, attribute syntaxCheck: The attribute syntaxCheck is not allowed.

* remove xdebug

* add coverage

* fix

* add xdebug

* add env variable xdebug_mode
  • Loading branch information
monteiro authored Jan 7, 2021
1 parent 0e8fba3 commit fefd5fb
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 42 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: "CI"

on:
pull_request:
push:
branches:
- 'master'

env:
fail-fast: true
PHPUNIT_FLAGS: "-v"
SYMFONY_REQUIRE: ">=4.4"
XDEBUG_MODE: "coverage"

jobs:
test:
name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }}
runs-on: 'ubuntu-latest'
continue-on-error: ${{ matrix.allowed-to-fail }}

strategy:
matrix:
php-version: ['7.2.5', '7.3', '7.4', '8.0']
variant: [normal]
dependencies: [highest]
allowed-to-fail: [true]
symfony-version: [latest]
include:
- php-version: 7.2.5
dependencies: highest
variant: normal
allowed-to-fail: false
symfony-version: latest
- php-version: '8.0'
dependencies: highest
variant: normal
allowed-to-fail: true
symfony-version: latest
- php-version: '7.4'
dependencies: highest
variant: 'symfony/symfony:"4.4.*"'
allowed-to-fail: false
symfony-version: 4.4
- php-version: '7.4'
dependencies: highest
variant: 'symfony/symfony:"5.1"'
allowed-to-fail: false
symfony-version: 5.1
steps:
- name: "Checkout code"
uses: actions/checkout@v2.3.3

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@2.7.0
with:
coverage: xdebug
php-version: ${{ matrix.php-version }}
tools: composer:v2
extensions: intl, xdebug

- name: "Set composer cache directory"
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Install variant
if: matrix.variant != 'normal'
run: composer require ${{ matrix.variant }} --no-update

- name: "Install Composer dependencies (${{ matrix.dependencies }})"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--prefer-dist"

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

- name: "PHPUnit version"
run: vendor/bin/simple-phpunit --version

- name: "Run unit tests"
run: vendor/bin/phpunit --coverage-text --verbose

- name: "Run phantomjs tests"
run: phantomjs Resources/js/run-qunit.js file://`pwd`/Resources/js/index.html

- name: "Run phantomjs tests ES5"
run: phantomjs Resources/js/run-qunit.js file://`pwd`/Resources/js/index-with-es5-shim.html
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Tests/Dumper/TranslationDumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class TranslationDumperTest extends WebTestCase

private $dumper;

public function setUp()
public function setUp(): void
{
$container = $this->getContainer();

Expand Down
2 changes: 1 addition & 1 deletion Tests/WebTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected static function createKernel(array $options = array())
);
}

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->deleteTmpDir();
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"php": "^7.1",
"php": ">=7.2.5",
"symfony/framework-bundle": "~4.4|~5.0",
"symfony/finder": "~4.4|~5.0",
"symfony/console": "~4.4|~5.0",
Expand All @@ -26,7 +26,7 @@
"symfony/browser-kit": "~4.4|~5.0",
"symfony/twig-bundle": "~4.4|~5.0",
"symfony/phpunit-bridge": "^5.0",
"phpunit/phpunit": "^4.8|~5.7|~6.5"
"phpunit/phpunit": "^4.8|~5.7|~6.5|~8"
},
"replace": {
"willdurand/expose-translation-bundle": "2.5.*"
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./Tests/bootstrap.php">
<testsuites>
<testsuite name="BazingaJsTranslationBundle Test Suite">
Expand Down

0 comments on commit fefd5fb

Please sign in to comment.