From fad3c2a13aeb7cf91387a62af3f3575d7b7bd66b Mon Sep 17 00:00:00 2001 From: piotrbisaga <78412233+piotrbisaga@users.noreply.github.com> Date: Fri, 24 Sep 2021 12:25:25 +0200 Subject: [PATCH] IBX-829 [CI] Moved CS and PHPUnit jobs to Github Actions (#60) * IBX-829 [CI] Moved jobs to Github Actions * IBX-829-small-correction * IBX-829-adjusting-GHactions * IBX-829-adjustment * IBX-829 review fixes --- .github/workflows/ci.yaml | 49 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 16 +++---------- composer.json | 4 +++- 3 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..7eaea89 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,49 @@ +name: CI + +on: + push: + branches: + - master + - '[0-9]+.[0-9]+' + pull_request: ~ + +jobs: + tests: + name: Tests + runs-on: "ubuntu-20.04" + timeout-minutes: 10 + + strategy: + fail-fast: false + matrix: + php: + - '7.1' + - '7.2' + - '7.3' + - '7.4' + composer_options: [ "" ] + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP Action + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: pdo_sqlite, gd + tools: cs2pr + + - uses: "ramsey/composer-install@v1" + with: + dependency-versions: "highest" + composer-options: "${{ matrix.composer_options }}" + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Run code style check + run: composer run-script check-cs -- --format=checkstyle | cs2pr + + - name: Run test suite + run: composer run-script --timeout=600 test diff --git a/.travis.yml b/.travis.yml index 766c3fc..ce1d1a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,11 +21,6 @@ branches: matrix: include: - - name: "Code Style Check" - env: CHECK_CS=1 - - name: "PHP 7.3 Integration tests" - php: 7.3 - env: PHPUNIT_CONFIG="phpunit-integration-legacy.xml" - name: "Browser fieldtype tests" php: 7.3 env: @@ -49,15 +44,10 @@ before_install: - echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini install: - # Install packages if needed - - if [ "${CHECK_CS}" == "1" -o "${PHPUNIT_CONFIG}" != "" ]; then travis_retry composer install --prefer-dist --no-interaction --no-suggest ; fi - # Prepare whole environment if needed - - if [ "${BEHAT_OPTS}" != "" ]; then ./.travis/prepare_ezplatform.sh ${INSTALL_EZ_INSTALL_TYPE}; fi + - ./.travis/prepare_ezplatform.sh ${INSTALL_EZ_INSTALL_TYPE} script: - - if [ "${CHECK_CS}" == "1" ] ; then ./vendor/bin/php-cs-fixer fix -v --dry-run --show-progress=estimating ; fi - - if [ "${PHPUNIT_CONFIG}" != '' ]; then ./vendor/bin/phpunit -c "${PHPUNIT_CONFIG}"; fi - - if [ "${BEHAT_OPTS}" != "" ]; then cd "$HOME/build/ezplatform"; docker-compose exec --user www-data app sh -c "bin/ezbehat ${BEHAT_OPTS}" ; fi + - cd "$HOME/build/ezplatform"; docker-compose exec --user www-data app sh -c "bin/ezbehat ${BEHAT_OPTS}" after_failure: # Will show us the last bit of the log of container's main processes @@ -68,4 +58,4 @@ after_failure: - docker ps -s after_script: - - if [ "${BEHAT_OPTS}" != "" ] ; then bin/ezreport ; fi + - bin/ezreport diff --git a/composer.json b/composer.json index a6c3a5d..c225af6 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,9 @@ "phpunit/phpunit": "^6.4" }, "scripts": { - "fix-cs": "@php ./vendor/bin/php-cs-fixer fix -v --show-progress=estimating" + "fix-cs": "php-cs-fixer fix -v --show-progress=estimating", + "check-cs": "@fix-cs --dry-run", + "test": "phpunit -c phpunit-integration-legacy.xml" }, "extra": { "_ezplatform_branch_for_behat_tests": "2.5",