Skip to content

Commit

Permalink
IBX-828:Moved unit tests to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbisaga authored and piotrbisaga committed Oct 5, 2021
1 parent f9f70b9 commit 20105ea
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 9 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 2 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ env:
matrix:
fast_finish: true
include:
- php: 7.1
- php: 7.2
- php: 7.3
env: CHECK_CS=true
# Functional
- php: 7.1
env: TEST_CMD="bin/behat --profile=rest --tags=~@broken --suite=fullJson" PHP_IMAGE=ezsystems/php:7.1-v1
Expand All @@ -36,15 +32,12 @@ branches:
before_script:
- travis_retry composer selfupdate
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- if [ "$TEST_CMD" = "" ] ; then travis_retry composer install --prefer-dist --no-interaction ; fi
- if [ "$TEST_CMD" != "" ] ; then ./tests/.travis/prepare_for_functional_tests.sh ; fi
- ./tests/.travis/prepare_for_functional_tests.sh
# Execute Symfony command if injected into test matrix
- if [ "${SYMFONY_CMD}" != "" ] ; then cd "$HOME/build/ezplatform"; docker-compose exec --user www-data app sh -c "bin/console ${SYMFONY_CMD}" ; fi

script:
- if [ "$TEST_CMD" = "" ] ; then php vendor/bin/phpunit --coverage-text && php vendor/bin/phpspec run --format=pretty ; fi
- if [ "$TEST_CMD" != "" ] ; then cd "$HOME/build/ezplatform"; docker-compose exec --user www-data app sh -c "$TEST_CMD" ; fi
- if [ "$CHECK_CS" = "true" ]; then phpenv config-rm xdebug.ini && ./vendor/bin/php-cs-fixer fix -v --dry-run --diff --show-progress=estimating; fi
- cd "$HOME/build/ezplatform"; docker-compose exec --user www-data app sh -c "$TEST_CMD"

notifications:
slack:
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"fix-cs": "php-cs-fixer fix -v --show-progress=estimating",
"unit": "phpunit -c phpunit.xml",
"spec": "phpspec run --format=pretty",
"check-cs": "@fix-cs --dry-run",
"test": [
"@unit",
"@spec"
Expand Down

0 comments on commit 20105ea

Please sign in to comment.