From 9b7d7511ab4915e930c73d80843dfcb68e924316 Mon Sep 17 00:00:00 2001 From: soyuka Date: Mon, 2 Nov 2020 20:32:13 +0100 Subject: [PATCH] Use setup-php --- .github/workflows/ci.yml | 2272 +++++++------------------------------- composer.json | 6 +- 2 files changed, 393 insertions(+), 1885 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3116f52b712..5c31645d802 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,131 +5,68 @@ on: pull_request: env: - COMPOSER_ALLOW_SUPERUSER: '1' # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser - COMPOSER_INSTALLER_COMMIT: fb22b78362d31c0d2bf516d1f8cdfd2745caa431 - COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERAGE: '0' - EXT_MONGODB_VERSION: '1.7.5' - EXT_PCOV_VERSION: '1.0.6' jobs: php-cs-fixer: - name: PHP-CS-Fixer (PHP ${{ matrix.php }}) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec - strategy: - matrix: - php: - - '7.4' - fail-fast: false - timeout-minutes: 5 env: PHP_CS_FIXER_FUTURE_MODE: '1' - PHP_CS_FIXER_VERSION: '^2.14' steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - unzip \ - git openssh - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: ~/.composer/cache - key: composer-php${{ matrix.php }}-php-cs-fixer-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}-php-cs-fixer- - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex - - name: Install PHP-CS-Fixer - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - friendsofphp/php-cs-fixer:"${PHP_CS_FIXER_VERSION}" - - name: Cache PHP-CS-Fixer results + php-version: '7.4' + extensions: intl, openssl, mbstring + ini-values: memory_limit=-1 + tools: pecl, composer, flex, php-cs-fixer + coverage: none + - 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: /var/cache/php-cs-fixer - key: php-cs-fixer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - php-cs-fixer-php${{ matrix.php }}- - php-cs-fixer- - continue-on-error: true + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Run PHP-CS-Fixer fix - run: | - export PATH="$PATH:$HOME/.composer/vendor/bin" - mkdir -p /var/cache/php-cs-fixer - php-cs-fixer fix --dry-run --diff --cache-file=/var/cache/php-cs-fixer/.php_cs.cache --ansi + run: php-cs-fixer fix --dry-run --diff --ansi phpstan: - name: PHPStan (PHP ${{ matrix.php }}) + name: PHPStan runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec - strategy: - matrix: - php: - - '7.4' - fail-fast: false - timeout-minutes: 5 env: APP_DEBUG: '1' # https://github.com/phpstan/phpstan-symfony/issues/37 steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - unzip \ - git openssh - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + tools: pecl, composer, flex, phpstan + extensions: intl, openssl, mbstring + coverage: none + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi - name: Install PHPUnit env: - SYMFONY_PHPUNIT_VERSION: '9.2' + SYMFONY_PHPUNIT_VERSION: '9.4' run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - name: Cache PHPStan results uses: actions/cache@v2 with: @@ -139,19 +76,17 @@ jobs: phpstan-php${{ matrix.php }}- phpstan- continue-on-error: true + - name: Clear test app cache + run: | + tests/Fixtures/app/console cache:clear --ansi - name: Run PHPStan analysis env: - SYMFONY_PHPUNIT_VERSION: '9.2' - run: vendor/bin/phpstan analyse --no-progress --no-interaction --ansi + SYMFONY_PHPUNIT_VERSION: '9.4' + run: phpstan analyse --no-progress --no-interaction --ansi phpunit: name: PHPUnit (PHP ${{ matrix.php }}) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec strategy: matrix: php: @@ -164,76 +99,29 @@ jobs: - php: '7.4' coverage: true fail-fast: false - timeout-minutes: 20 steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - bash \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - if: (!startsWith(matrix.php, '7.1') && !startsWith(matrix.php, 'rc')) - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - if: (!startsWith(matrix.php, '7.1') && !startsWith(matrix.php, 'rc')) - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Install pcov PHP extension - if: matrix.coverage - env: - BUILD_DIR: /var/tmp/build/ext-pcov-${{ env.EXT_PCOV_VERSION }} - SRC_DIR: /usr/src/php/ext/pcov - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/pcov-$EXT_PCOV_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable pcov - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: ${{ matrix.php }} + tools: pecl, composer, flex + extensions: intl, 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + - name: Enable code coverage + if: matrix.coverage + run: echo '::set-env name=COVERAGE::1' - name: Remove Doctrine MongoDB ODM if: (startsWith(matrix.php, '7.1') || startsWith(matrix.php, 'rc')) run: | @@ -244,27 +132,16 @@ jobs: if: (startsWith(matrix.php, 'rc')) run: composer config platform.php 7.4.99 - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - - name: Enable code coverage - if: matrix.coverage - run: echo '::set-env name=COVERAGE::1' - name: Run PHPUnit tests run: | mkdir -p build/logs/phpunit if [ "$COVERAGE" = '1' ]; then - vendor/bin/simple-phpunit --coverage-clover build/logs/phpunit/clover.xml --log-junit build/logs/phpunit/junit.xml --colors=always + vendor/bin/simple-phpunit --coverage-clover build/logs/phpunit/clover.xml --log-junit build/logs/phpunit/junit.xml else - vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --colors=always + vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml fi - name: Upload test artifacts if: always() @@ -294,11 +171,6 @@ jobs: behat: name: Behat (PHP ${{ matrix.php }}) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec strategy: matrix: php: @@ -310,76 +182,29 @@ jobs: - php: '7.4' coverage: true fail-fast: false - timeout-minutes: 20 steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - bash \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - if: (!startsWith(matrix.php, '7.1')) - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - if: (!startsWith(matrix.php, '7.1')) - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Install pcov PHP extension - if: matrix.coverage - env: - BUILD_DIR: /var/tmp/build/ext-pcov-${{ env.EXT_PCOV_VERSION }} - SRC_DIR: /usr/src/php/ext/pcov - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/pcov-$EXT_PCOV_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable pcov - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: ${{ matrix.php }} + tools: pecl, composer, flex + extensions: intl, openssl, mbstring, pdo_sqlite + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + - name: Enable code coverage + if: matrix.coverage + run: echo '::set-env name=COVERAGE::1' - name: Remove Doctrine MongoDB ODM if: startsWith(matrix.php, '7.1') run: | @@ -387,29 +212,16 @@ jobs: doctrine/mongodb-odm \ doctrine/mongodb-odm-bundle \ - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi - - name: Install PHPUnit - run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - - name: Enable code coverage - if: matrix.coverage - run: echo '::set-env name=COVERAGE::1' + run: composer update --no-progress --no-suggest --ansi - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - name: Run Behat tests run: | mkdir -p build/logs/behat if [ "$COVERAGE" = '1' ]; then - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=default-coverage --no-interaction --colors + vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=default-coverage --no-interaction else - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=default --no-interaction --colors + vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=default --no-interaction fi - name: Merge code coverage reports if: matrix.coverage @@ -450,15 +262,11 @@ jobs: tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml - name: Validate OpenAPI documents - uses: docker://node:12-alpine - with: - args: | - sh -c -e " - npx swagger-cli validate build/out/openapi/swagger_v2.json - npx swagger-cli validate build/out/openapi/swagger_v2.yaml - npx swagger-cli validate build/out/openapi/openapi_v3.json - npx swagger-cli validate build/out/openapi/openapi_v3.yaml - " + run: | + npx swagger-cli validate build/out/openapi/swagger_v2.json + npx swagger-cli validate build/out/openapi/swagger_v2.yaml + npx swagger-cli validate build/out/openapi/openapi_v3.json + npx swagger-cli validate build/out/openapi/openapi_v3.yaml - name: Upload OpenAPI artifacts if: always() uses: actions/upload-artifact@v1 @@ -467,571 +275,121 @@ jobs: path: build/out/openapi continue-on-error: true - phpunit-lowest-deps: - name: PHPUnit (PHP ${{ matrix.php }}) (lowest dependencies) + phpunit_lowest: + name: PHPUnit (PHP 7.4 lowest) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec strategy: - matrix: - php: - - '7.4' fail-fast: false - timeout-minutes: 20 steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring + coverage: none + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-lowest-deps-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}-lowest-deps- - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi + run: composer update --no-progress --no-suggest --ansi --prefer-lowest - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - name: Run PHPUnit tests - run: | - mkdir -p build/logs/phpunit - vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --colors=always - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: phpunit-logs-php${{ matrix.php }}-lowest-deps - path: build/logs/phpunit - continue-on-error: true + run: vendor/bin/simple-phpunit - behat-lowest-deps: - name: Behat (PHP ${{ matrix.php }}) (lowest dependencies) + behat_lowest: + name: Behat (PHP 7.4 lowest) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec strategy: - matrix: - php: - - '7.4' fail-fast: false - timeout-minutes: 20 steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring, pdo_sqlite + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-lowest-deps-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}-lowest-deps- - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi + run: composer update --no-progress --no-suggest --ansi --prefer-lowest - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - name: Run Behat tests - run: | - mkdir -p build/logs/behat - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=default --no-interaction --colors - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: behat-logs-php${{ matrix.php }}-lowest-deps - path: build/logs/behat - continue-on-error: true - - name: Export OpenAPI documents - run: | - mkdir -p build/out/openapi - tests/Fixtures/app/console api:openapi:export --spec-version=2 -o build/out/openapi/swagger_v2.json - tests/Fixtures/app/console api:openapi:export --spec-version=2 --yaml -o build/out/openapi/swagger_v2.yaml - tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json - tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml - - name: Validate OpenAPI documents - uses: docker://node:12-alpine - with: - args: | - sh -c -e " - npx swagger-cli validate build/out/openapi/swagger_v2.json - npx swagger-cli validate build/out/openapi/swagger_v2.yaml - npx swagger-cli validate build/out/openapi/openapi_v3.json - npx swagger-cli validate build/out/openapi/openapi_v3.yaml - " - - name: Upload OpenAPI artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: openapi-docs-php${{ matrix.php }}-lowest-deps - path: build/out/openapi - continue-on-error: true + run: vendor/bin/behat --format=progress --out=std --profile=default --no-interaction - behat-legacy: - name: Behat (PHP ${{ matrix.php }}) (legacy) + phpunit-postgresql: + name: PHPUnit (PHP 7.4) (PostgreSQL) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec + services: + postgres: + image: postgres:10-alpine + env: + POSTGRES_DB: api_platform_test + POSTGRES_PASSWORD: hk7dFAByeQVVxpLtmZ6GVUzP + POSTGRES_USER: api-platform + options: >- + --mount type=tmpfs,destination=/var/lib/postgresql/data + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 strategy: - matrix: - php: - - '7.1' - - '7.2' - - '7.3' - include: - - php: '7.3' - coverage: true fail-fast: false - timeout-minutes: 20 env: - LEGACY: '1' - SYMFONY_REQUIRE: '^3.4 || ^4.0' + APP_ENV: postgres + DATABASE_URL: postgres://api-platform:hk7dFAByeQVVxpLtmZ6GVUzP@postgres/api_platform_test steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - bash \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - if: (!startsWith(matrix.php, '7.1')) - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - if: (!startsWith(matrix.php, '7.1')) - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Install pcov PHP extension - if: matrix.coverage - env: - BUILD_DIR: /var/tmp/build/ext-pcov-${{ env.EXT_PCOV_VERSION }} - SRC_DIR: /usr/src/php/ext/pcov - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/pcov-$EXT_PCOV_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable pcov - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring, pdo_pgsql + coverage: none + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-legacy-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}-legacy- - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex - - name: Remove Doctrine MongoDB ODM - if: startsWith(matrix.php, '7.1') - run: | - composer remove --dev --no-progress --no-update --ansi \ - doctrine/mongodb-odm \ - doctrine/mongodb-odm-bundle \ + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi --prefer-lowest - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - - name: Enable code coverage - if: matrix.coverage - run: echo '::set-env name=COVERAGE::1' - - name: Run Behat tests - run: | - mkdir -p build/logs/behat - if [ "$COVERAGE" = '1' ]; then - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=default-legacy-coverage --no-interaction --colors - else - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=default-legacy --no-interaction --colors - fi - - name: Merge code coverage reports - if: matrix.coverage - run: | - wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov.phar - chmod +x /usr/local/bin/phpcov - phpcov merge --clover build/logs/behat/clover.xml build/coverage - continue-on-error: true - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: behat-logs-php${{ matrix.php }}-legacy - path: build/logs/behat - continue-on-error: true - - name: Upload coverage results to Codecov - if: matrix.coverage - uses: codecov/codecov-action@v1 - with: - name: behat-php${{ matrix.php }}-legacy - flags: behat_legacy - fail_ci_if_error: true - continue-on-error: true - - name: Upload coverage results to Coveralls - if: matrix.coverage - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi cedx/coveralls - export PATH="$PATH:$HOME/.composer/vendor/bin" - coveralls build/logs/behat/clover.xml - continue-on-error: true - - behat-lowest-deps-legacy: - name: Behat (PHP ${{ matrix.php }}) (lowest dependencies) (legacy) - runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec - strategy: - matrix: - php: - - '7.3' - fail-fast: false - timeout-minutes: 20 - env: - LEGACY: '1' - SYMFONY_REQUIRE: '^3.4 || ^4.0' - steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 - with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages - uses: actions/cache@v2 - with: - path: ~/.composer/cache - key: composer-php${{ matrix.php }}-lowest-deps-legacy-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}-lowest-deps-legacy- - composer-php${{ matrix.php }}-lowest-deps- - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex - - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi - - name: Install PHPUnit - run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - - name: Run Behat tests - run: | - mkdir -p build/logs/behat - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=default-legacy --no-interaction --colors - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: behat-logs-php${{ matrix.php }}-lowest-deps-legacy - path: build/logs/behat - continue-on-error: true - - phpunit-postgresql: - name: PHPUnit (PHP ${{ matrix.php }}) (PostgreSQL) - runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec - services: - postgres: - image: postgres:10-alpine - env: - POSTGRES_DB: api_platform_test - POSTGRES_PASSWORD: hk7dFAByeQVVxpLtmZ6GVUzP - POSTGRES_USER: api-platform - options: >- - --mount type=tmpfs,destination=/var/lib/postgresql/data - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - strategy: - matrix: - php: - - '7.4' - fail-fast: false - timeout-minutes: 20 - env: - APP_ENV: postgres - DATABASE_URL: postgres://api-platform:hk7dFAByeQVVxpLtmZ6GVUzP@postgres/api_platform_test - steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - unzip \ - git openssh - - name: Install PHP extensions - run: | - apk add \ - $PHPIZE_DEPS \ - postgresql-dev \ - ; - docker-php-ext-install -j$(nproc) \ - pdo_pgsql \ - ; - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 - with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages - uses: actions/cache@v2 - with: - path: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex - - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi - - name: Install PHPUnit - run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - name: Run PHPUnit tests - run: | - mkdir -p build/logs/phpunit - vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --colors=always - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: phpunit-logs-php${{ matrix.php }}-postgresql - path: build/logs/phpunit - continue-on-error: true + run: vendor/bin/simple-phpunit behat-postgresql: - name: Behat (PHP ${{ matrix.php }}) (PostgreSQL) + name: Behat (PHP 7.4) (PostgreSQL) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec services: postgres: image: postgres:10-alpine @@ -1046,128 +404,42 @@ jobs: --health-timeout 5s --health-retries 5 strategy: - matrix: - php: - - '7.4' fail-fast: false - timeout-minutes: 20 env: APP_ENV: postgres DATABASE_URL: postgres://api-platform:hk7dFAByeQVVxpLtmZ6GVUzP@postgres/api_platform_test steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - unzip \ - git openssh - - name: Install PHP extensions - run: | - apk add \ - $PHPIZE_DEPS \ - postgresql-dev \ - ; - docker-php-ext-install -j$(nproc) \ - pdo_pgsql \ - ; - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring, pdo_pgsql + coverage: none + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi --prefer-lowest - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi + - name: Run PHPUnit tests + run: vendor/bin/simple-phpunit - name: Run Behat tests - run: | - mkdir -p build/logs/behat - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=postgres --no-interaction --colors - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: behat-logs-php${{ matrix.php }}-postgresql - path: build/logs/behat - continue-on-error: true - - name: Export OpenAPI documents - run: | - mkdir -p build/out/openapi - tests/Fixtures/app/console api:openapi:export --spec-version=2 -o build/out/openapi/swagger_v2.json - tests/Fixtures/app/console api:openapi:export --spec-version=2 --yaml -o build/out/openapi/swagger_v2.yaml - tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json - tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml - - name: Validate OpenAPI documents - uses: docker://node:12-alpine - with: - args: | - sh -c -e " - npx swagger-cli validate build/out/openapi/swagger_v2.json - npx swagger-cli validate build/out/openapi/swagger_v2.yaml - npx swagger-cli validate build/out/openapi/openapi_v3.json - npx swagger-cli validate build/out/openapi/openapi_v3.yaml - " - - name: Upload OpenAPI artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: openapi-docs-php${{ matrix.php }}-postgresql - path: build/out/openapi - continue-on-error: true + run: vendor/bin/behat --format=progress --out=std --profile=postgres --no-interaction phpunit-mysql: - name: PHPUnit (PHP ${{ matrix.php }}) (MySQL) + name: PHPUnit (PHP 7.4) (MySQL) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec services: mysql: image: mysql:5.7 @@ -1183,103 +455,41 @@ jobs: --health-timeout 5s --health-retries 5 strategy: - matrix: - php: - - '7.4' fail-fast: false - timeout-minutes: 20 env: APP_ENV: mysql DATABASE_URL: mysql://api-platform:LUhGR5tJ7WA2gbGumknCYBcB@mysql/api_platform_test steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - unzip \ - git openssh - - name: Install PHP extensions - run: | - apk add \ - $PHPIZE_DEPS \ - ; - docker-php-ext-install -j$(nproc) \ - pdo_mysql \ - ; - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring, pdo_mysql + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - name: Run PHPUnit tests run: | - mkdir -p build/logs/phpunit - vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --colors=always - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: phpunit-logs-php${{ matrix.php }}-mysql - path: build/logs/phpunit - continue-on-error: true + vendor/bin/simple-phpunit behat-mysql: - name: Behat (PHP ${{ matrix.php }}) (MySQL) + name: Behat (PHP 7.4) (MySQL) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec services: mysql: image: mysql:5.7 @@ -1295,127 +505,42 @@ jobs: --health-timeout 5s --health-retries 5 strategy: - matrix: - php: - - '7.4' fail-fast: false - timeout-minutes: 20 env: APP_ENV: mysql DATABASE_URL: mysql://api-platform:LUhGR5tJ7WA2gbGumknCYBcB@mysql/api_platform_test steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - unzip \ - git openssh - - name: Install PHP extensions - run: | - apk add \ - $PHPIZE_DEPS \ - ; - docker-php-ext-install -j$(nproc) \ - pdo_mysql \ - ; - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring, pdo_mysql + coverage: none + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi --prefer-lowest - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi + - name: Run PHPUnit tests + run: vendor/bin/simple-phpunit - name: Run Behat tests - run: | - mkdir -p build/logs/behat - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=default --no-interaction --colors - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: behat-logs-php${{ matrix.php }}-mysql - path: build/logs/behat - continue-on-error: true - - name: Export OpenAPI documents - run: | - mkdir -p build/out/openapi - tests/Fixtures/app/console api:openapi:export --spec-version=2 -o build/out/openapi/swagger_v2.json - tests/Fixtures/app/console api:openapi:export --spec-version=2 --yaml -o build/out/openapi/swagger_v2.yaml - tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json - tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml - - name: Validate OpenAPI documents - uses: docker://node:12-alpine - with: - args: | - sh -c -e " - npx swagger-cli validate build/out/openapi/swagger_v2.json - npx swagger-cli validate build/out/openapi/swagger_v2.yaml - npx swagger-cli validate build/out/openapi/openapi_v3.json - npx swagger-cli validate build/out/openapi/openapi_v3.yaml - " - - name: Upload OpenAPI artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: openapi-docs-php${{ matrix.php }}-mysql - path: build/out/openapi - continue-on-error: true + run: vendor/bin/behat --format=progress --out=std --profile=default --no-interaction phpunit-mongodb: - name: PHPUnit (PHP ${{ matrix.php }}) (MongoDB) + name: PHPUnit (PHP 7.4) (MongoDB) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec services: mongo: image: mongo:4 @@ -1426,315 +551,87 @@ jobs: --health-timeout 5s --health-retries 5 strategy: - matrix: - php: - - '7.4' - include: - - php: '7.4' - coverage: true fail-fast: false - timeout-minutes: 20 env: APP_ENV: mongodb MONGODB_URL: mongodb://mongo:27017 steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - bash \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Install pcov PHP extension - if: matrix.coverage - env: - BUILD_DIR: /var/tmp/build/ext-pcov-${{ env.EXT_PCOV_VERSION }} - SRC_DIR: /usr/src/php/ext/pcov - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/pcov-$EXT_PCOV_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable pcov - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring, mongodb + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - - name: Enable code coverage - if: matrix.coverage - run: echo '::set-env name=COVERAGE::1' - name: Run PHPUnit tests run: | - mkdir -p build/logs/phpunit - if [ "$COVERAGE" = '1' ]; then - vendor/bin/simple-phpunit --coverage-clover build/logs/phpunit/clover.xml --log-junit build/logs/phpunit/junit.xml --colors=always --configuration phpunit_mongodb.xml - else - vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --colors=always --configuration phpunit_mongodb.xml - fi - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: phpunit-logs-php${{ matrix.php }}-mongodb - path: build/logs/phpunit - continue-on-error: true - - name: Upload coverage results to Codecov - if: matrix.coverage - uses: codecov/codecov-action@v1 - with: - name: phpunit-php${{ matrix.php }}-mongodb - flags: phpunit_mongodb - fail_ci_if_error: true - continue-on-error: true - - name: Upload coverage results to Coveralls - if: matrix.coverage - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi cedx/coveralls - export PATH="$PATH:$HOME/.composer/vendor/bin" - coveralls build/logs/phpunit/clover.xml - continue-on-error: true + vendor/bin/simple-phpunit behat-mongodb: - name: Behat (PHP ${{ matrix.php }}) (MongoDB) + name: Behat (PHP 7.4) (MongoDB) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec services: - mongo: - image: mongo:4 - options: >- - --mount type=tmpfs,destination=/data/db - --health-cmd "mongo --quiet --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - strategy: - matrix: - php: - - '7.4' - include: - - php: '7.4' - coverage: true - fail-fast: false - timeout-minutes: 20 - env: - APP_ENV: mongodb - MONGODB_URL: mongodb://mongo:27017 - steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - bash \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 - with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Install pcov PHP extension - if: matrix.coverage - env: - BUILD_DIR: /var/tmp/build/ext-pcov-${{ env.EXT_PCOV_VERSION }} - SRC_DIR: /usr/src/php/ext/pcov - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/pcov-$EXT_PCOV_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable pcov - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages - uses: actions/cache@v2 - with: - path: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex - - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi - - name: Install PHPUnit - run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - - name: Enable code coverage - if: matrix.coverage - run: echo '::set-env name=COVERAGE::1' - - name: Run Behat tests - run: | - mkdir -p build/logs/behat - if [ "$COVERAGE" = '1' ]; then - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=mongodb-coverage --no-interaction --colors - else - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=mongodb --no-interaction --colors - fi - - name: Merge code coverage reports - if: matrix.coverage - run: | - wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov.phar - chmod +x /usr/local/bin/phpcov - phpcov merge --clover build/logs/behat/clover.xml build/coverage - continue-on-error: true - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: behat-logs-php${{ matrix.php }}-mongodb - path: build/logs/behat - continue-on-error: true - - name: Upload coverage results to Codecov - if: matrix.coverage - uses: codecov/codecov-action@v1 - with: - name: behat-php${{ matrix.php }}-mongodb - flags: behat_mongodb - fail_ci_if_error: true - continue-on-error: true - - name: Upload coverage results to Coveralls - if: matrix.coverage - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi cedx/coveralls - export PATH="$PATH:$HOME/.composer/vendor/bin" - coveralls build/logs/behat/clover.xml - continue-on-error: true - - name: Export OpenAPI documents - run: | - mkdir -p build/out/openapi - tests/Fixtures/app/console api:openapi:export --spec-version=2 -o build/out/openapi/swagger_v2.json - tests/Fixtures/app/console api:openapi:export --spec-version=2 --yaml -o build/out/openapi/swagger_v2.yaml - tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json - tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml - - name: Validate OpenAPI documents - uses: docker://node:12-alpine + mongo: + image: mongo:4 + options: >- + --mount type=tmpfs,destination=/data/db + --health-cmd "mongo --quiet --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + strategy: + fail-fast: false + env: + APP_ENV: mongodb + MONGODB_URL: mongodb://mongo:27017 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - args: | - sh -c -e " - npx swagger-cli validate build/out/openapi/swagger_v2.json - npx swagger-cli validate build/out/openapi/swagger_v2.yaml - npx swagger-cli validate build/out/openapi/openapi_v3.json - npx swagger-cli validate build/out/openapi/openapi_v3.yaml - " - - name: Upload OpenAPI artifacts - if: always() - uses: actions/upload-artifact@v1 + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring + coverage: none + 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: - name: openapi-docs-php${{ matrix.php }}-mongodb - path: build/out/openapi - continue-on-error: true + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + - name: Update project dependencies + run: composer update --no-progress --no-suggest --ansi --prefer-lowest + - name: Install PHPUnit + run: vendor/bin/simple-phpunit --version + - name: Run PHPUnit tests + run: vendor/bin/simple-phpunit + - name: Run Behat tests + run: vendor/bin/behat --format=progress --out=std --profile=mongodb --no-interaction phpunit-elasticsearch: - name: PHPUnit (PHP ${{ matrix.php }}) (Elasticsearch) + name: PHPUnit (PHP 7.4) (Elasticsearch) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec services: elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:6.8.3 # https://github.com/elastic/elasticsearch/issues/43627 @@ -1747,140 +644,41 @@ jobs: --health-timeout 5s --health-retries 5 strategy: - matrix: - php: - - '7.4' - include: - - php: '7.4' - coverage: true fail-fast: false - timeout-minutes: 20 env: APP_ENV: elasticsearch ELASTICSEARCH_URL: http://elasticsearch:9200 steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - bash \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Install pcov PHP extension - if: matrix.coverage - env: - BUILD_DIR: /var/tmp/build/ext-pcov-${{ env.EXT_PCOV_VERSION }} - SRC_DIR: /usr/src/php/ext/pcov - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/pcov-$EXT_PCOV_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable pcov - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - - name: Enable code coverage - if: matrix.coverage - run: echo '::set-env name=COVERAGE::1' - name: Run PHPUnit tests run: | - mkdir -p build/logs/phpunit - if [ "$COVERAGE" = '1' ]; then - vendor/bin/simple-phpunit --coverage-clover build/logs/phpunit/clover.xml --log-junit build/logs/phpunit/junit.xml --colors=always - else - vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --colors=always - fi - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: phpunit-logs-php${{ matrix.php }}-elasticsearch - path: build/logs/phpunit - continue-on-error: true - - name: Upload coverage results to Codecov - if: matrix.coverage - uses: codecov/codecov-action@v1 - with: - name: phpunit-php${{ matrix.php }}-elasticsearch - flags: phpunit_elasticsearch - fail_ci_if_error: true - continue-on-error: true - - name: Upload coverage results to Coveralls - if: matrix.coverage - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi cedx/coveralls - export PATH="$PATH:$HOME/.composer/vendor/bin" - coveralls build/logs/phpunit/clover.xml - continue-on-error: true + vendor/bin/simple-phpunit behat-elasticsearch: - name: Behat (PHP ${{ matrix.php }}) (Elasticsearch) + name: Behat (PHP 7.4) (Elasticsearch) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec services: elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:6.8.3 # https://github.com/elastic/elasticsearch/issues/43627 @@ -1893,251 +691,72 @@ jobs: --health-timeout 5s --health-retries 5 strategy: - matrix: - php: - - '7.4' - include: - - php: '7.4' - coverage: true fail-fast: false - timeout-minutes: 20 env: APP_ENV: elasticsearch ELASTICSEARCH_URL: http://elasticsearch:9200 steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - bash \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Install pcov PHP extension - if: matrix.coverage - env: - BUILD_DIR: /var/tmp/build/ext-pcov-${{ env.EXT_PCOV_VERSION }} - SRC_DIR: /usr/src/php/ext/pcov - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/pcov-$EXT_PCOV_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable pcov - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring, mongodb + coverage: none + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi --prefer-lowest - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - - name: Enable code coverage - if: matrix.coverage - run: echo '::set-env name=COVERAGE::1' + - name: Run PHPUnit tests + run: vendor/bin/simple-phpunit - name: Run Behat tests - run: | - mkdir -p build/logs/behat - if [ "$COVERAGE" = '1' ]; then - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=elasticsearch-coverage --no-interaction --colors - else - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=elasticsearch --no-interaction --colors - fi - - name: Merge code coverage reports - if: matrix.coverage - run: | - wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov.phar - chmod +x /usr/local/bin/phpcov - phpcov merge --clover build/logs/behat/clover.xml build/coverage - continue-on-error: true - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: behat-logs-php${{ matrix.php }}-elasticsearch - path: build/logs/behat - continue-on-error: true - - name: Upload coverage results to Codecov - if: matrix.coverage - uses: codecov/codecov-action@v1 - with: - name: behat-php${{ matrix.php }}-elasticsearch - flags: behat_elasticsearch - fail_ci_if_error: true - continue-on-error: true - - name: Upload coverage results to Coveralls - if: matrix.coverage - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi cedx/coveralls - export PATH="$PATH:$HOME/.composer/vendor/bin" - coveralls build/logs/behat/clover.xml - continue-on-error: true - - name: Export OpenAPI documents - run: | - mkdir -p build/out/openapi - tests/Fixtures/app/console api:openapi:export --spec-version=2 -o build/out/openapi/swagger_v2.json - tests/Fixtures/app/console api:openapi:export --spec-version=2 --yaml -o build/out/openapi/swagger_v2.yaml - tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json - tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml - - name: Validate OpenAPI documents - uses: docker://node:12-alpine - with: - args: | - sh -c -e " - npx swagger-cli validate build/out/openapi/swagger_v2.json - npx swagger-cli validate build/out/openapi/swagger_v2.yaml - npx swagger-cli validate build/out/openapi/openapi_v3.json - npx swagger-cli validate build/out/openapi/openapi_v3.yaml - " - - name: Upload OpenAPI artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: openapi-docs-php${{ matrix.php }}-elasticsearch - path: build/out/openapi - continue-on-error: true + run: vendor/bin/behat --format=progress --out=std --profile=elasticsearch --no-interaction phpunit-no-deprecations: - name: PHPUnit (PHP ${{ matrix.php }}) (no deprecations) + name: PHPUnit (PHP 7.4) (no deprecations) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec strategy: - matrix: - php: - - '7.4' fail-fast: false - timeout-minutes: 20 env: SYMFONY_DEPRECATIONS_HELPER: max[total]=7 steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - name: Run PHPUnit tests - run: | - mkdir -p build/logs/phpunit - vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --colors=always - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: phpunit-logs-php${{ matrix.php }}-no-deprecations - path: build/logs/phpunit - continue-on-error: true + run: vendor/bin/simple-phpunit phpunit-symfony-next: name: PHPUnit (PHP ${{ matrix.php }}) (Symfony ${{ matrix.symfony }}) @@ -2154,67 +773,31 @@ jobs: symfony: - '5.2' fail-fast: false - timeout-minutes: 20 steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - jq \ - moreutils \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring + coverage: none + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-symfony${{ matrix.symfony }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}-symfony${{ matrix.symfony }}- - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Allow unstable project dependencies run: | jq '. + {"minimum-stability": "dev"}' composer.json | sponge composer.json - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi --prefer-lowest - name: Flag held back Symfony packages env: symfony_version: ${{ matrix.symfony }} @@ -2231,31 +814,12 @@ jobs: continue-on-error: true - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - name: Run PHPUnit tests - run: | - mkdir -p build/logs/phpunit - vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --colors=always - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: phpunit-logs-php${{ matrix.php }}-symfony${{ matrix.symfony }} - path: build/logs/phpunit - continue-on-error: true + run: vendor/bin/simple-phpunit behat-symfony-next: name: Behat (PHP ${{ matrix.php }}) (Symfony ${{ matrix.symfony }}) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }}-alpine - options: >- - --tmpfs /tmp:exec - --tmpfs /var/tmp:exec strategy: matrix: php: @@ -2263,67 +827,31 @@ jobs: symfony: - '5.2' fail-fast: false - timeout-minutes: 20 steps: - name: Checkout - uses: actions/checkout@v1 - - name: Install system packages - run: | - apk add \ - jq \ - moreutils \ - unzip \ - git openssh - - name: Cache mongodb PHP extension build - uses: actions/cache@v2 + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - key: ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - ext-mongodb-${{ env.EXT_MONGODB_VERSION }}-php${{ matrix.php }}- - continue-on-error: true - - name: Install mongodb PHP extension - env: - BUILD_DIR: /var/tmp/build/ext-mongodb-${{ env.EXT_MONGODB_VERSION }} - SRC_DIR: /usr/src/php/ext/mongodb - run: | - apk add \ - $PHPIZE_DEPS - mkdir -p "$SRC_DIR" "$BUILD_DIR" - cd "$SRC_DIR" - curl -fsSL "https://pecl.php.net/get/mongodb-$EXT_MONGODB_VERSION.tgz" | tar -zx --strip-components 1 - phpize - cd "$BUILD_DIR" - "$SRC_DIR"/configure --config-cache - make -j"$(nproc)" - make -j"$(nproc)" install - docker-php-ext-enable mongodb - - name: Disable PHP memory limit - run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini - - name: Install Composer - run: wget -qO - https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_INSTALLER_COMMIT/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring + coverage: none + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-symfony${{ matrix.symfony }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}-symfony${{ matrix.symfony }}- - composer-php${{ matrix.php }}- - composer- - continue-on-error: true - - name: Install Symfony Flex - run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi \ - symfony/flex + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Allow unstable project dependencies run: | jq '. + {"minimum-stability": "dev"}' composer.json | sponge composer.json - name: Update project dependencies - run: | - mkdir -p /tmp/api-platform/core/vendor - ln -s /tmp/api-platform/core/vendor vendor - composer update --no-progress --no-suggest --ansi + run: composer update --no-progress --no-suggest --ansi --prefer-lowest - name: Flag held back Symfony packages env: symfony_version: ${{ matrix.symfony }} @@ -2340,27 +868,12 @@ jobs: continue-on-error: true - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - - name: Clear test app cache - run: | - mkdir -p /tmp/api-platform/core/var - ln -s /tmp/api-platform/core/var tests/Fixtures/app/var - tests/Fixtures/app/console cache:clear --ansi - name: Run Behat tests - run: | - mkdir -p build/logs/behat - vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/junit --profile=default --no-interaction --colors - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v1 - with: - name: behat-logs-php${{ matrix.php }}-symfony${{ matrix.symfony }} - path: build/logs/behat - continue-on-error: true + run: vendor/bin/behat --format=progress --out=std --profile=default --no-interaction windows-phpunit: name: Windows PHPUnit (PHP 7.4) (SQLite) runs-on: windows-latest - timeout-minutes: 10 env: APP_ENV: sqlite DATABASE_URL: sqlite:///%kernel.project_dir%/var/data.db @@ -2370,20 +883,20 @@ jobs: - name: Setup PHP with pre-release PECL extension uses: shivammathur/setup-php@v2 with: - php-version: '7.4' - tools: pecl, composer, flex - extensions: intl, openssl, mbstring, pdo_sqlite - coverage: none - ini-values: memory_limit=-1 - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring, pdo_sqlite + coverage: none + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies run: | composer update --no-progress --no-suggest --ansi @@ -2392,12 +905,11 @@ jobs: tests/Fixtures/app/console cache:clear --ansi - name: Run PHPUnit tests run: | - vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --colors=always + vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml windows-behat: name: Windows Behat (PHP 7.4) (SQLite) runs-on: windows-latest - timeout-minutes: 15 env: APP_ENV: sqlite DATABASE_URL: sqlite:///%kernel.project_dir%/var/data.db @@ -2407,20 +919,20 @@ jobs: - name: Setup PHP with pre-release PECL extension uses: shivammathur/setup-php@v2 with: - php-version: '7.4' - tools: pecl, composer, flex - extensions: intl, openssl, mbstring, pdo_sqlite - coverage: none - ini-values: memory_limit=-1 - - name: Cache Composer packages + php-version: '7.4' + tools: pecl, composer, flex + extensions: intl, openssl, mbstring, pdo_sqlite + coverage: none + 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: ~/.composer/cache - key: composer-php${{ matrix.php }}-${{ github.sha }} - restore-keys: | - composer-php${{ matrix.php }}- - composer- - continue-on-error: true + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Update project dependencies run: | composer update --no-progress --no-suggest --ansi @@ -2430,4 +942,4 @@ jobs: tests/Fixtures/app/console cache:clear --ansi - name: Run Behat tests run: | - vendor/bin/behat --format=progress --profile=default --no-interaction --colors + vendor/bin/behat --format=progress --profile=default --no-interaction diff --git a/composer.json b/composer.json index c459bf72afa..704b176ef71 100644 --- a/composer.json +++ b/composer.json @@ -83,7 +83,7 @@ "symfony/validator": "^3.4 || ^4.0 || ^5.0", "symfony/web-profiler-bundle": "^4.2 || ^5.0", "symfony/yaml": "^3.4 || ^4.0 || ^5.0", - "teohhanhui/stubs-mongodb": "@dev", + "soyuka/stubs-mongodb": "^1.0", "twig/twig": "^1.42.3 || ^2.12", "webonyx/graphql-php": "^14.0" }, @@ -118,10 +118,6 @@ } }, "repositories": [ - { - "type": "vcs", - "url": "https://github.com/teohhanhui/stubs-mongodb" - }, { "type": "vcs", "url": "https://github.com/dunglas/contexts"