Skip to content

Commit

Permalink
Merge pull request #417 from craue/gha
Browse files Browse the repository at this point in the history
migrate from Travis CI to GitHub Actions
  • Loading branch information
craue committed Aug 28, 2023
2 parents 9e25a75 + 7a9ec43 commit 32b0945
Show file tree
Hide file tree
Showing 42 changed files with 420 additions and 274 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/Tests export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.travis_install_dependencies.sh export-ignore
/.travis.yml export-ignore
/phpstan-config.neon export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
31 changes: 31 additions & 0 deletions .github/workflows/composer-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Composer Lint

on:
pull_request: ~
push: ~

jobs:
composer-lint:
name: Composer Lint
runs-on: ubuntu-latest

strategy:
matrix:
php:
- '8.2'

steps:
- name: checkout
uses: actions/checkout@v3

- name: setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2, composer-normalize:2
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: run composer-normalize
run: composer-normalize --dry-run
31 changes: 31 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Static Analysis

on:
pull_request: ~
push: ~

jobs:
static-analysis-phpstan:
name: Static Analysis with PHPStan
runs-on: ubuntu-latest

strategy:
matrix:
php:
- '8.2'

steps:
- name: checkout
uses: actions/checkout@v3

- name: setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: install dependencies with Composer
uses: ramsey/composer-install@v2

- name: run PHPStan
run: vendor/bin/phpstan analyse
106 changes: 106 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Tests

on:
pull_request: ~
push: ~

concurrency:
group: ${{ github.workflow }} @ ${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
tests:
name: PHP ${{ matrix.php }} - ${{ matrix.dependencies || format('Symfony {0}', matrix.symfony) }}${{ (matrix.note && format(' ({0})', matrix.note)) || '' }}${{ (matrix.allow-failure && ' 🔕') || '' }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.allow-failure || false }}
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}
SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.symfony-deprecations }}
PARAM_DB_DRIVER: ${{ matrix.db-driver }}

strategy:
fail-fast: false
matrix:
include:
-
php: '7.3'
dependencies: lowest
-
php: '8.2'
dependencies: highest
symfony-deprecations: max[indirect]=5722
-
php: '7.3'
symfony: '4.4.*'
-
php: '7.3'
symfony: '4.4.*'
note: sqlite
db-driver: pdo_sqlite
-
php: '7.4'
symfony: '5.4.*'
# TODO remove as soon as Symfony >= 5.0 is required
-
php: '7.4'
symfony: '5.4.*'
note: contao-polyfill-symfony
contao-polyfill-symfony: true
-
php: '8.0'
symfony: '5.4.*'
-
php: '8.1'
symfony: '5.4.*'
-
php: '8.1'
symfony: '6.3.*'
symfony-deprecations: max[indirect]=5722
-
php: '8.2'
symfony: '6.4.*'
stability: dev
allow-failure: true

steps:
- name: checkout
uses: actions/checkout@v3

- name: setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysql, redis
coverage: pcov
ini-values: memory_limit=-1
tools: flex
env:
fail-fast: true # interrupt on extension setup error

# TODO remove as soon as Symfony >= 5.0 is required
- name: require contao/polyfill-symfony
if: matrix.contao-polyfill-symfony == true
run: composer require --no-update --dev contao/polyfill-symfony

- name: use dev dependencies
if: matrix.stability == 'dev'
run: composer config minimum-stability dev

- name: install dependencies with Composer
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist

- name: run PHPUnit
run: vendor/bin/phpunit -v --coverage-clover build/logs/clover.xml

- name: upload code coverage data
if: github.repository == 'craue/CraueFormFlowBundle'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: PHP ${{ matrix.php }} - ${{ matrix.dependencies || format('Symfony {0}', matrix.symfony) }}${{ (matrix.note && format(' ({0})', matrix.note)) || '' }}
run: |
unset SYMFONY_REQUIRE
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
84 changes: 0 additions & 84 deletions .travis.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .travis_install_dependencies.sh

This file was deleted.

2 changes: 1 addition & 1 deletion CraueFormFlowBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class CraueFormFlowBundle extends Bundle {

/**
* {@inheritDoc}
* @return void
*/
public function boot() {
/*
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/LegacySessionCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class LegacySessionCompilerPass implements CompilerPassInterface {

/**
* {@inheritDoc}
* @return void
*/
public function process(ContainerBuilder $container) : void {
// TODO remove as soon as Symfony >= 5.3 is required
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/CraueFormFlowExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CraueFormFlowExtension extends Extension implements CompilerPassInterface
const FORM_FLOW_TAG = 'craue.form.flow';

/**
* {@inheritDoc}
* @return void
*/
public function load(array $config, ContainerBuilder $container) {
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
Expand All @@ -33,7 +33,7 @@ public function load(array $config, ContainerBuilder $container) {
}

/**
* {@inheritDoc}
* @return void
*/
public function process(ContainerBuilder $container) {
$baseFlowDefinitionMethodCalls = $container->getDefinition('craue.form.flow')->getMethodCalls();
Expand Down
6 changes: 3 additions & 3 deletions Form/Extension/FormFlowFormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class FormFlowFormExtension extends AbstractTypeExtension {

/**
* {@inheritDoc}
* @return string
*/
public function getExtendedType() {
return FormType::class;
Expand All @@ -28,7 +28,7 @@ public static function getExtendedTypes() : iterable {
}

/**
* {@inheritDoc}
* @return void
*/
public function configureOptions(OptionsResolver $resolver) {
$resolver->setDefined([
Expand All @@ -40,7 +40,7 @@ public function configureOptions(OptionsResolver $resolver) {
}

/**
* {@inheritDoc}
* @return void
*/
public function buildForm(FormBuilderInterface $builder, array $options) {
if (array_key_exists('flow_instance', $options) && array_key_exists('flow_instance_key', $options)) {
Expand Down
6 changes: 3 additions & 3 deletions Form/Extension/FormFlowHiddenFieldExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class FormFlowHiddenFieldExtension extends AbstractTypeExtension {

/**
* {@inheritDoc}
* @return string
*/
public function getExtendedType() {
return HiddenType::class;
Expand All @@ -28,7 +28,7 @@ public static function getExtendedTypes() : iterable {
}

/**
* {@inheritDoc}
* @return void
*/
public function configureOptions(OptionsResolver $resolver) {
$resolver->setDefined([
Expand All @@ -38,7 +38,7 @@ public function configureOptions(OptionsResolver $resolver) {
}

/**
* {@inheritDoc}
* @return void
*/
public function finishView(FormView $view, FormInterface $form, array $options) {
if (array_key_exists('flow_instance_key', $options) && $view->vars['name'] === $options['flow_instance_key']) {
Expand Down
Loading

0 comments on commit 32b0945

Please sign in to comment.