diff --git a/.github/workflows/browser-tests.yaml b/.github/workflows/browser-tests.yaml new file mode 100644 index 0000000..ab05bb7 --- /dev/null +++ b/.github/workflows/browser-tests.yaml @@ -0,0 +1,19 @@ +name: Browser tests + +on: + push: + branches: + - main + - '[0-9]+.[0-9]+' + pull_request: ~ + +jobs: + query-fieldtype: + name: "Page Builder browser tests" + uses: ibexa/gh-workflows/.github/workflows/browser-tests.yml@main + with: + project-edition: 'oss' + project-version: '^4.0.x-dev' + test-suite: '--profile=browser --suite=admin-ui --tags=@contentQuery' + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..4fd01ab --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,72 @@ +name: CI + +on: + push: + branches: + - main + - '[0-9]+.[0-9]+' + pull_request: ~ + +jobs: + cs-fix: + name: Run code style check + runs-on: "ubuntu-20.04" + strategy: + matrix: + php: + - '8.0' + 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" + + - name: Run code style check + run: composer run-script check-cs -- --format=checkstyle | cs2pr + + tests: + name: Unit tests + runs-on: "ubuntu-20.04" + timeout-minutes: 15 + + strategy: + fail-fast: false + matrix: + php: + - '7.4' + - '8.0' + composer-options: [ "" ] + include: + - php: '8.1' + composer-options: "--ignore-platform-req php" + + 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 unit test suite + run: composer test diff --git a/.github/workflows/cross-merge.yaml b/.github/workflows/cross-merge.yaml new file mode 100644 index 0000000..41c5df1 --- /dev/null +++ b/.github/workflows/cross-merge.yaml @@ -0,0 +1,12 @@ +name: Ibexa Reusable / Cross Org PR + +on: + push: + branches-ignore: + - "temp_*" + +jobs: + call: + uses: ibexa/gh-workflows/.github/workflows/cross-merge.yml@main + secrets: + robot-token: ${{ secrets.EZROBOT_PAT }} diff --git a/.php-cs-fixer-spec.php b/.php-cs-fixer-spec.php deleted file mode 100644 index 5c28229..0000000 --- a/.php-cs-fixer-spec.php +++ /dev/null @@ -1,29 +0,0 @@ -withRules([ - 'declare_strict_types' => false, - 'visibility_required' => false, -]); - -return $configFactory - ->buildConfig() - ->setFinder( - PhpCsFixer\Finder::create() - ->in( - array_filter([ - __DIR__ . '/spec', - ], 'is_dir') - ) - ->files()->name('*.php') - ); - -return $config; diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index da33ee0..75f6977 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -21,6 +21,7 @@ array_filter([ __DIR__ . '/src', __DIR__ . '/tests', + __DIR__ . '/spec', ], 'is_dir') ) ->files()->name('*.php') diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 976c5b3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,52 +0,0 @@ -language: php -php: - - 7.3 - -branches: - only: - - master - - dev - - /^\d.\d+$/ - -cache: - directories: - - $HOME/.composer/cache/files - - -matrix: - include: - - name: "Code Style Check" - env: TARGET="codestyle" - - name: "phpspec on PHP7.3" - php: 7.3 - env: TARGET="phpspec" - - name: "phpspec on PHP7.4" - php: 7.4 - env: TARGET="phpspec" - - name: "Browser tests using Query fieldtype" - php: 7.3 - env: - - TARGET="behat" - - EZPLATFORM_REPO="https://github.com/ezsystems/ezplatform.git" - - COMPOSE_FILE="doc/docker/base-dev.yml:doc/docker/selenium.yml" - - APP_ENV=behat - - APP_DEBUG=1 - - BEHAT_OPTS="--profile=adminui --suite=adminui --tags=@queryFieldType" - -install: - # Disable XDebug for performance - - phpenv config-rm xdebug.ini - - if [ "$TARGET" == "phpspec" ] || [ "$TARGET" == "codestyle" ] ; then COMPOSER_MEMORY_LIMIT=-1 composer install; fi - - if [ "$TARGET" == "behat" ] ; then ./.travis/prepare_ezplatform.sh; fi - -script: - - if [ "$TARGET" == "phpspec" ] ; then ./vendor/bin/phpspec run --format=pretty; fi - - if [ "$TARGET" == "codestyle" ] ; then ./vendor/bin/php-cs-fixer fix --dry-run -v --show-progress=estimating && ./vendor/bin/php-cs-fixer fix --config=.php_cs.spec --dry-run -v --show-progress=estimating; fi - -notifications: - slack: - rooms: - - secure: hviD7OAoMq5ZH9/4SPwBFoUsx8sO5KuZi3sPz5chpAhz0sHnBLyxvLzSvudKRtqNoMcS/+f/EaNvW2r3yLfQyd+QH9DUAqHoflQrMQnOQWf4CfXfjszTfKMSfU8zBclV+4/Zgs2fs1iDsKzEXF8FY21sElwahB0/ktVHjBiVaLZz6XwetiWYpxwjkKi+bsL80ytstmD8U5BXyywLZsTq+E5Gh5HtxOMtbfh4AITE4nOnWNLikwRMfxl44mAK8D7GOFe/tvxFaysojvggDoS+5LJyDbnKv74/yc2RzWz6cPuEzGn/8xArhfoWx/UwPbedlP8wPZfnOpSEF8+g4Kt3V0/bpNMPU7TrOOrLnIg5os0gsW2HJhFDLIR4qXMq3LLWURNmlgsXWlGm75mHDpusdRBrCHfDbORf+5TMPoop20YEqHPCxhl941pjAX2JGj3PzBb6eWmzEJO9Vh+861MhDv0Lz/rRw9Kq/bMQc0mLZ2O8L74iXrHeTloUDH2yStUf1eE+0aonIEqF/mxAKl8wBrk/E2OE25Udkj8qExI67c1ldn1QWBa8Q3AhrsThwCOpXD6VDjB3dP6A98JedR94dpbe2w0f8HaXqPFMZe/YovGptfg6CrPMwgKYf++yTHiWBd0khh0CEd1FT1wqeT+VlZZmmTH+nqsIi2CXmnk6cVE= - on_success: change - on_failure: always - on_pull_requests: false diff --git a/.travis/prepare_ezplatform.sh b/.travis/prepare_ezplatform.sh deleted file mode 100755 index 18c6bcc..0000000 --- a/.travis/prepare_ezplatform.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -EZPLATFORM_BRANCH=`php -r 'echo json_decode(file_get_contents("./composer.json"))->extra->_ezplatform_branch_for_behat_tests;'` -EZPLATFORM_BRANCH="${EZPLATFORM_BRANCH:-master}" -PACKAGE_BUILD_DIR=$PWD -EZPLATFORM_BUILD_DIR=${HOME}/build/ezplatform - -echo "> Cloning ezsystems/ezplatform:${EZPLATFORM_BRANCH}" -git clone --depth 1 --single-branch --branch "${EZPLATFORM_BRANCH}" ${EZPLATFORM_REPO} ${EZPLATFORM_BUILD_DIR} -cd ${EZPLATFORM_BUILD_DIR} - -/bin/bash ./bin/.travis/trusty/setup_ezplatform.sh "${COMPOSE_FILE}" '' "${PACKAGE_BUILD_DIR}" diff --git a/composer.json b/composer.json index fa80eab..26e7725 100644 --- a/composer.json +++ b/composer.json @@ -54,19 +54,23 @@ "ibexa/search": "^4.0@dev", "ibexa/user": "^4.0@dev", "ibexa/http-cache": "^4.0@dev", - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^7.1", "ibexa/code-style": "^1.0", "friendsofphp/php-cs-fixer": "^3.0" }, "scripts": { - "fix-cs": [ - "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots", - "php-cs-fixer --ansi fix --config=.php-cs-fixer-spec.php -v --show-progress=dots" - ] + "fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots", + "check-cs": "@fix-cs --dry-run", + "test": "phpspec run --format=pretty" }, "extra": { "branch-alias": { "dev-main": "4.0.x-dev" } + }, + "config": { + "allow-plugins": { + "composer/package-versions-deprecated": true + } } }