Skip to content

Commit

Permalink
IBX-828:Moved unit tests to Github Actions (#155)
Browse files Browse the repository at this point in the history
* IBX-828:Moved unit tests to Github Actions

* Run CI again

* php 7.4 job fix

* excluding memio/spec-gen

* removing first line
  • Loading branch information
piotrbisaga authored Oct 22, 2021
1 parent b920f22 commit 901a75d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 14 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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
"require-dev": {
"phpunit/phpunit": "^6.5.14 || ^7.5.20",
"matthiasnoback/symfony-dependency-injection-test": "^2.3.1",
"phpspec/phpspec": "^5.1.2",
"phpspec/phpspec": "^5.1.2 || ^6.1",
"ezsystems/ezplatform-code-style": "^0.1.0",
"friendsofphp/php-cs-fixer": "^2.16.1",
"memio/spec-gen": "^0.9.0",
"symfony/phpunit-bridge": "^5.1"
},
"autoload": {
Expand All @@ -34,6 +33,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
3 changes: 0 additions & 3 deletions phpspec.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
extensions:
Memio\SpecGen\MemioSpecGenExtension: ~

suites:
http_cache:
namespace: EzSystems\PlatformHttpCacheBundle
Expand Down

0 comments on commit 901a75d

Please sign in to comment.