release new version #212
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build" | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
run-standards-with-tests: | |
name: Check code meets standards and tests pass (by localhost config) | |
runs-on: ubuntu-latest | |
env: | |
PHP_VERSION: '7.2' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup PHP ${{ env.PHP_VERSION }} and composer | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
coverage: none # disable xdebug, pcov | |
tools: composer:v2 | |
- name: Set composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: job-standards-with-tests-${{ env.PHP_VERSION }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: job-standards-with-tests-${{ env.PHP_VERSION }}-composer- | |
- name: Install dependencies | |
run: composer install | |
- name: Run standarts and tests | |
run: vendor/bin/phing build-ci | |
run-only-tests: | |
name: Run only tests on PHP ${{ matrix.php }} on ${{ matrix.os }} with ${{ matrix.deps-level }} ${{ matrix.symfony }} dependency level | |
runs-on: ${{ matrix.os }} | |
env: | |
COMPOSER_ALL_DEV_DEPENDENCIES_WITHOUT_PHPUNIT: phing/phing php-parallel-lint/php-parallel-lint phpstan/phpstan phpstan/phpstan-phpunit shopsys/coding-standards symfony/var-dumper | |
strategy: | |
matrix: | |
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] | |
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] | |
deps-level: [ 'lowest', 'highest' ] | |
symfony: [ '^4.2.0', '^5.0', '^6.0', '^7.0' ] | |
exclude: | |
# symfony/console fails on "YamlStandards\Command\YamlCommandTest::testCorrectRunCommandForFix -> Trying to access array offset on value of type int" and I think it's not necessary fix it, so I skip it | |
- php: '7.4' | |
deps-level: 'lowest' | |
# symfony/config fails on "vendor/symfony/config/Definition/BaseNode.php:502 -> strpos(): Non-string needles will be interpreted as strings in the future. | |
# Use an explicit chr() call to preserve the current behavior" but PHP 7.3 for MacOS was already skipped with Travis CI | |
- php: '7.3' | |
os: 'macos-latest' | |
# don't run check symfony versions without supported php | |
- php: '7.2' | |
symfony: '^6.0' | |
- php: '7.3' | |
symfony: '^6.0' | |
- php: '7.4' | |
symfony: '^6.0' | |
- php: '7.2' | |
symfony: '^7.0' | |
- php: '7.3' | |
symfony: '^7.0' | |
- php: '7.4' | |
symfony: '^7.0' | |
- php: '8.0' | |
symfony: '^7.0' | |
- php: '8.1' | |
symfony: '^7.0' | |
steps: | |
- name: Configure git to avoid issues with line endings | |
if: matrix.os == 'windows-latest' | |
run: git config --global core.autocrlf false | |
- uses: actions/checkout@v2 | |
- name: Setup PHP ${{ matrix.php }} and composer | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: none # disable xdebug, pcov | |
tools: composer:v2 | |
- name: Require Symfony at version ${{ matrix.symfony }} | |
run: composer require --no-update "symfony/console:${{ matrix.symfony }}" "symfony/config:${{ matrix.symfony }}" "symfony/yaml:${{ matrix.symfony }}" | |
- name: Add caret to composer.json for symfony libraries for windows build | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: pwsh | |
run: | | |
$symfonyVersionWithoutCaret = "${{ matrix.symfony }}".substring(1) | |
(Get-Content composer.json) | ForEach-Object { $_.replace('"symfony/console": "' + $symfonyVersionWithoutCaret + '"', '"symfony/console": "${{ matrix.symfony }}"') } | Set-Content composer.json | |
(Get-Content composer.json) | ForEach-Object { $_.replace('"symfony/config": "' + $symfonyVersionWithoutCaret + '"', '"symfony/config": "${{ matrix.symfony }}"') } | Set-Content composer.json | |
(Get-Content composer.json) | ForEach-Object { $_.replace('"symfony/yaml": "' + $symfonyVersionWithoutCaret + '"', '"symfony/yaml": "${{ matrix.symfony }}"') } | Set-Content composer.json | |
- name: Set composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: job-only-tests-${{ runner.os }}-${{ matrix.php }}-${{ matrix.deps-level }}-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: job-only-tests-${{ runner.os }}-${{ matrix.php }}-${{ matrix.deps-level }}-${{ matrix.symfony }}-composer- | |
# composer check with "--no-dev" option require-dev dependency too | |
- name: Remove all dev-dependencies except for phpunit | |
run: composer remove --no-update --dev ${{ env.COMPOSER_ALL_DEV_DEPENDENCIES_WITHOUT_PHPUNIT }} | |
- name: Install lowest dependencies | |
if: ${{ matrix.deps-level == 'lowest' }} | |
run: composer update --prefer-lowest | |
- name: Install highest dependencies | |
if: ${{ matrix.deps-level == 'highest' }} | |
run: composer update | |
- name: Run tests | |
run: vendor/bin/phpunit --colors=always --testsuite Unit |