Switch to GitHub actions (#533)

master
Antoine Bluchet 1 year ago committed by GitHub
parent fc2f2e58ea
commit 34e9804350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 94
      .github/workflows/ci.yml
  2. 76
      .travis.yml
  3. 4
      composer.json
  4. 2
      fixtures/Functional/config/test/config.yml

@ -0,0 +1,94 @@
name: CI
on:
push:
pull_request:
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHELL_VERBOSITY: 1
OCULAR_BIN: $HOME/.bin/ocular.phar
jobs:
php-cs-fixer:
runs-on: ubuntu-latest
strategy:
matrix:
php:
- '8.0'
fail-fast: false
env:
PHP_CS_FIXER_FUTURE_MODE: '1'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl, bcmath, curl, openssl, mbstring
ini-values: memory_limit=-1
tools: composer, php-cs-fixer
coverage: none
- name: Run PHP-CS-Fixer fix
run: php-cs-fixer fix --dry-run --diff --ansi
phpunit:
name: PHPUnit (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
php:
- '7.4'
- '8.0'
include:
- php: '7.4'
coverage: true
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup MySQL
run: |
sudo systemctl start mysql.service
mysql -u root -e 'create database hautelook_alice_bundle;'
- name: Setup coverage
if: matrix.coverage
run: |
wget https://scrutinizer-ci.com/ocular.phar -O $OCULAR_BIN
chmod +x $OCULAR_BIN
echo "COVERAGE=1" >> $GITHUB_ENV
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: pecl, composer
extensions: intl, bcmath, curl, openssl, mbstring
coverage: pcov
ini-values: memory_limit=-1
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Set Composer platform config
if: (startsWith(matrix.php, '8.0'))
run: composer config platform.php 7.4.99
- name: Update project dependencies
run: composer update --no-interaction --no-progress --prefer-dist --ansi
- name: Clear test app cache
run: tests/Fixtures/app/console cache:clear --ansi
- name: Run tests
if: !matrix.coverage
run: vendor/bin/phpunit --verbose --stop-on-failure
- name: Run tests
if: matrix.coverage
run: vendor/bin/phpunit --verbose --stop-on-failure --coverage-text --coverage-clover=coverage.xml
- name: Upload coverage
if: matrix.coverage
run: $OCULAR_BIN code-coverage:upload --format=php-clover coverage.xml

@ -1,76 +0,0 @@
language: php
php:
- '7.3'
- '7.4'
- nightly
branches:
only:
- master
env:
global:
- OCULAR_BIN=$HOME/.bin/ocular.phar
- PHPUNIT_BIN='vendor/bin/phpunit'
- PHPUNIT_CONFIG='phpunit.xml.dist'
- PHPUNIT_FLAGS='--stop-on-failure --verbose'
cache:
directories:
- $HOME/.composer/cache/files
- $HOME/.bin/
services:
- mysql
matrix:
fast_finish: true
include:
- php: '7.3'
env:
- COMPOSER_FLAGS="--prefer-lowest"
- SYMFONY_DEPRECATIONS_HELPER="max[self]=0"
- php: '7.3'
env: SYMFONY_REQUIRE="~3.4.0"
- php: '7.3'
env:
- COVERAGE="true"
- PHPUNIT_FLAGS="--stop-on-failure --verbose --coverage-text --coverage-clover=coverage.xml"
- LINT="1"
allow_failures:
- php: nightly
before_install:
- set -eo pipefail
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- phpenv config-rm xdebug.ini || true
- if [ "$SYMFONY_REQUIRE" != "" ]; then composer global require --no-scripts symfony/flex; fi
- |
if [ -n "$COVERAGE" ]; then
pecl install pcov;
PHPUNIT_FLAGS="$PHPUNIT_FLAGS --testdox --coverage-text"
if [ ! -e $OCULAR_BIN ]; then
wget https://scrutinizer-ci.com/ocular.phar -O $OCULAR_BIN
chmod +x $OCULAR_BIN
alias ocular="php $OCULAR_BIN"
fi
else
PHPUNIT_BIN="php -d zend.enable_gc=0 $PHPUNIT_BIN"
fi
- mysql -u root -e 'create database hautelook_alice_bundle;'
- if [[ $LINT = "1" ]]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.16.4/php-cs-fixer.phar; fi
install:
- composer update --prefer-dist $COMPOSER_FLAGS
script:
- $PHPUNIT_BIN -c $PHPUNIT_CONFIG $PHPUNIT_FLAGS
- if [[ $LINT = "1" ]]; then php php-cs-fixer.phar fix --dry-run --diff --no-ansi; fi
after_script:
- if [ -n "$COVERAGE" ]; then $OCULAR_BIN code-coverage:upload --format=php-clover coverage.xml; fi
notifications:
email: false

@ -31,7 +31,7 @@
},
"require": {
"php": "^7.3",
"php": "^7.3 || ^8.0",
"doctrine/doctrine-bundle": "^1.8 || ^2.0",
"doctrine/data-fixtures": "^1.2",
"doctrine/orm": "^2.5.11",
@ -39,7 +39,7 @@
"psr/log": "^1.0",
"symfony/finder": "^3.4 || ^4.0 || ^5.0",
"symfony/framework-bundle": "^3.4.24 || ^4.0 || ^5.0",
"theofidry/alice-data-fixtures": "^1.3"
"theofidry/alice-data-fixtures": "^1.4"
},
"require-dev": {
"phpunit/phpunit": "^8.5",

@ -4,6 +4,8 @@ parameters:
framework:
secret: test
test: ~
annotations:
cache: file
services:
data_fixtures.faker.provider.foo:

Loading…
Cancel
Save