Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI; drop EOL PHP and Symfony versions #127

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI
on:
pull_request:
push:
branches:
- master

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3']
symfony_version: ['5.4.*', '6.3.*', '6.4.*', '7.0.*']
dependencies: ['--prefer-lowest', '--prefer-dist']

name: PHP ${{ matrix.php }} tests on Sf ${{ matrix.symfony_version }}, deps=${{ matrix.dependencies }}

steps:
- uses: actions/checkout@v2

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ matrix.php }}-${{ matrix.symfony_version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
composer-${{ matrix.php }}-${{ matrix.symfony_version }}-${{ matrix.dependencies }}-

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: :xdebug

- run: php ./Tests/bin/pin-symfony-version.php "${{ matrix.symfony_version }}"

- run: composer update --no-progress ${{ matrix.dependencies }}

- run: ./vendor/bin/phpunit
15 changes: 15 additions & 0 deletions Tests/bin/pin-symfony-version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env php
<?php

if (empty($argv[1])) {
throw new \LogicException('Provide a Symfony version in Composer requirement format (e.g. "^7.0")');
}

$newVersion = $argv[1];

$composer = file_get_contents(__DIR__.'/../composer.json');

$updatedComposer = preg_replace('/"symfony\/(.*)": ".*"/', '"symfony/$1": "'.$newVersion.'"', $composer).PHP_EOL;
echo $updatedComposer.PHP_EOL;

file_put_contents(__DIR__.'/../composer.json', $updatedComposer);
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
],
"require": {
"enqueue/enqueue-bundle": "^0.10",
"symfony/messenger": "^4.3 || ^5.0 || ^6.0 || ^7.0",
"symfony/options-resolver": "^3.4 || ^4.2 || ^5.0 || ^6.0 || ^7.0",
"symfony/messenger": "^5.4 || ^6.3 || ^7.0",
"symfony/options-resolver": "^5.4 || ^6.3 || ^7.0",
"enqueue/amqp-tools": "^0.10"
},
"replace": {
Expand All @@ -38,7 +38,7 @@
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"symfony/yaml": "^3.4|^4.1|^5|^6",
"symfony/yaml": "^5.4 || ^6.3 || ^7.0",
"enqueue/snsqs": "^0.10.11",
"phpspec/prophecy-phpunit": "^2.0",
"phpspec/prophecy": "^1.15"
Expand Down