From 11605f68134c8fbbb65a5300224790c73bc3c283 Mon Sep 17 00:00:00 2001 From: PedroTroller Date: Tue, 28 Nov 2023 17:20:02 +0100 Subject: [PATCH] test: migrate to Github Actions --- .circleci/config.yml | 89 ------------------------------------- .github/workflows/test.yaml | 46 +++++++++++++++++++ 2 files changed, 46 insertions(+), 89 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/test.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index b7b91e51..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,89 +0,0 @@ ---- -version: 2.1 - -executorType: machine - -orbs: - php: circleci/php@1.1.0 - -jobs: - test: - docker: - - image: php:<< parameters.php >> - parameters: - php: - type: string - symfony: - type: string - composer-options: - type: string - minimum-stability: - type: enum - default: "stable" - enum: ["stable", "dev"] - steps: - - checkout - - run: | - apt-get update - apt-get -y install git zip jq - - run: | - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php composer-setup.php - php -r "unlink('composer-setup.php');" - mv composer.phar /usr/local/bin/composer - - run: | - curl -s https://raw.githubusercontent.com/symfony/symfony/<< parameters.symfony >>/composer.json | jq '.replace | to_entries | map({key: .key, value: ("< " + "<< parameters.symfony >>" + ".0 || >= " + ("<< parameters.symfony >>" | (((.|tonumber + 0.1) * 10)|round / 10)|tostring) + ".0")}) | from_entries' > conflict.json - jq -s '.[0] + {conflict: .[1]}' composer.json conflict.json > composer.new.json - mv composer.new.json composer.json - rm conflict.json - cat composer.json - - run: | - jq -s '.[0] + {"minimum-stability": "<< parameters.minimum-stability >>"}' composer.json > composer.new.json - mv composer.new.json composer.json - cat composer.json - - run: composer update << parameters.composer-options >> --ignore-platform-req=ext-intl - - run: vendor/bin/phpstan analyse --no-progress --memory-limit=-1 - - run: vendor/bin/phpspec run -v --config=phpspec.no-coverage.yml - - run: bin/lint-twig src/ - - run: PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --diff --dry-run -vvv - -workflows: - version: 2 - workflow: - jobs: - - test: - name: php8.0 - php: "8.0" - matrix: - parameters: - symfony: - - "5.4" - composer-options: - - "--prefer-stable --prefer-lowest" - - "--prefer-stable" - - test: - name: php8.1 - php: "8.1" - minimum-stability: 'dev' # Remove on Symfony 6.4 release - matrix: - parameters: - symfony: - - "5.4" - - "6.2" - - "6.3" - composer-options: - - "--prefer-stable --prefer-lowest" - - "--prefer-stable" - - test: - name: php8.2 - php: "8.2" - minimum-stability: 'dev' # Remove on Symfony 6.4 release - matrix: - parameters: - symfony: - - "5.4" - - "6.2" - - "6.3" - composer-options: - - "--prefer-stable --prefer-lowest" - - "--prefer-stable" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..778f1f25 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,46 @@ +--- +on: push + +jobs: + test: + name: "php${{ matrix.php }} symfony${{ matrix.symfony }} ${{matrix.minimumStability}} ${{ matrix.composerOptions }}" + runs-on: ubuntu-latest + strategy: + matrix: + php: + - '8.1' + - '8.2' + - '8.3' + symfony: + - '5.4' + - '6.2' + - '6.3' + # - '6.4' + # - '7.0' + minimumStability: + - 'stable' + composerOptions: + - '--prefer-stable --prefer-lowest' + - '--prefer-stable' + steps: + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: intl + tools: composer + - uses: actions/checkout@v4 + - run: | + curl -s https://raw.githubusercontent.com/symfony/symfony/${{ matrix.symfony }}/composer.json | jq '.replace | to_entries | map({key: .key, value: ("< " + "${{ matrix.symfony }}" + ".0 || >= " + ("${{ matrix.symfony }}" | (((.|tonumber + 0.1) * 10)|round / 10)|tostring) + ".0")}) | from_entries' > conflict.json + jq -s '.[0] + {conflict: .[1]}' composer.json conflict.json > composer.new.json + mv composer.new.json composer.json + rm conflict.json + cat composer.json + - run: | + jq -s '.[0] + {"minimum-stability": "${{ matrix.minimumStability }}"}' composer.json > composer.new.json + mv composer.new.json composer.json + cat composer.json + - run: composer update ${{ matrix.composerOptions }} + - run: vendor/bin/phpstan analyse --no-progress --memory-limit=-1 + - run: vendor/bin/phpspec run -v --config=phpspec.no-coverage.yml + - run: bin/lint-twig src/ + - run: PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --diff --dry-run -vvv