Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
9b7dcd3
Refactor CI workflow for improved clarity and flexibility
koriym Jan 21, 2025
dd473b0
Update Codecov Action to v4 in CI workflow
koriym Jun 18, 2025
07c20f4
Replace `sprintf` with `vsprintf` for improved parameter handling
koriym Jun 18, 2025
34b3488
Revamp CI workflow for expanded PHP version and OS coverage
koriym Jun 18, 2025
4bffa22
Refactor CI workflow for improved coverage and efficiency
koriym Jun 18, 2025
5917cda
Install `redis-tools` for Redis connection verification on Linux in C…
koriym Jun 18, 2025
e3db7bb
Add Redis support to CI workflow across all platforms
koriym Jun 18, 2025
3c44237
Refactor CI workflow: switch to manual Redis setup for consistent mul…
koriym Jun 18, 2025
504bad0
Simplify `str_replace` in `UriTag::buildKey` by removing unnecessary …
koriym Jun 18, 2025
0446f86
Add Memcached support to CI workflow for macOS setup
koriym Jun 18, 2025
e204ef3
Add Memcached support to CI workflow for macOS setup
koriym Jun 18, 2025
fbecc37
Simplify surrogate key generation by refactoring `str_replace` usage …
koriym Jun 18, 2025
7c62169
Update `__invoke` method signature in `FakeMobileEtagSetter` to use P…
koriym Jun 18, 2025
9a9b952
Normalize line endings for cross-platform test compatibility and remo…
koriym Jun 18, 2025
3d77014
Add Memcached support to CI workflow across all platforms
koriym Jun 18, 2025
0353897
Fix Memcached setup in CI workflow for Windows
koriym Jun 18, 2025
443d321
Update Memcached setup in CI workflow for Windows and Ubuntu
koriym Jun 18, 2025
79261c8
Refine Memcached Windows setup in CI workflow
koriym Jun 18, 2025
af29520
Overhaul Memcached Windows setup in CI workflow
koriym Jun 18, 2025
5f78afa
Improve Memcached Windows setup in CI workflow
koriym Jun 18, 2025
22fe4fb
Streamline Memcached Windows setup in CI workflow
koriym Jun 18, 2025
9559f69
Correct parameters for Memcached release downloader in CI workflow
koriym Jun 18, 2025
7964338
Refine Memcached Windows setup in CI workflow
koriym Jun 18, 2025
e4e39cd
Update Memcached setup in CI workflow to use latest Windows release
koriym Jun 18, 2025
d1bdbb1
Pin Memcached release in CI workflow and refine Windows setup steps
koriym Jun 18, 2025
acff3a6
Simplify Windows Memcached setup in CI workflow
koriym Jun 18, 2025
6a0376a
Remove redundant comments in CI workflow setup
koriym Jun 18, 2025
5df6c4e
Add error handling to Memcached Windows setup in CI workflow
koriym Jun 18, 2025
2e6ed1b
Add debugging steps to Memcached Windows setup in CI workflow
koriym Jun 18, 2025
e3b989c
Update Windows Memcached setup in CI workflow
koriym Jun 18, 2025
24497e7
Refine Windows Memcached setup in CI workflow
koriym Jun 18, 2025
fe5d8c3
Add debug logs for extracted directory contents in Memcached setup
koriym Jun 18, 2025
8d4fdd8
Refine Memcached setup in CI workflow
koriym Jun 18, 2025
da832a8
Refine Memcached service setup in CI workflow
koriym Jun 18, 2025
854d695
Hardcode Memcached executable path in CI workflow
koriym Jun 18, 2025
f98f131
Improve executable path construction in Memcached CI setup
koriym Jun 18, 2025
096ed4e
Hardcode Memcached service installation and startup path in CI workflow
koriym Jun 18, 2025
85bf133
Add validation and improve robustness in Memcached CI setup
koriym Jun 18, 2025
c461781
Simplify Memcached setup in CI workflow by removing redundant steps, …
koriym Jun 18, 2025
18d8365
Run Memcached as a background process on Windows CI to avoid admin ri…
koriym Jun 18, 2025
de23d12
Add Redis setup for Linux and Memcached setup across all platforms in…
koriym Jun 18, 2025
3f386f8
Handle both forward slashes and backslashes in surrogate key generati…
koriym Jun 18, 2025
70a6ee1
Sanitize etags to replace reserved characters and suppress PHPStan ov…
koriym Jun 18, 2025
063292d
Windows Compatibility: Simplify ETag generation by modifying path san…
koriym Jun 18, 2025
18ff06f
Replace symlink with actual file for cross-platform compatibility
koriym Jun 19, 2025
2c066e9
Update composer dependencies (`madapaja/twig-module`, `phpunit/phpuni…
koriym Jun 19, 2025
bb6c637
Add #[Override] PHP attribute across all applicable methods and class…
koriym Jun 19, 2025
70c2afe
Mark exception classes as `final` to prevent inheritance.
koriym Jun 19, 2025
3bfbdc9
Add support for `RelayCluster` in `RedisDsnProvider`.
koriym Jun 19, 2025
ade4703
Update `symfony/polyfill-php83` dependency to `^v1.32.0` in `composer…
koriym Jun 19, 2025
1fbfe6b
Update PHP version to 8.4 in static analysis and coding standards wor…
koriym Jun 19, 2025
d9eab28
Remove redundant PHPStan override comment in `RedisDsnProvider::get()…
koriym Jun 19, 2025
c6472d6
Simplify ETag and surrogate key generation by removing redundant path…
koriym Jun 19, 2025
be57af6
Improve `UriTag` test coverage for consistent key generation across p…
koriym Jun 19, 2025
c715702
Add `rector/rector` and `rector/swiss-knife` dependencies to `vendor-…
koriym Jun 19, 2025
4d43abf
fixup! Improve `UriTag` test coverage for consistent key generation a…
koriym Jun 19, 2025
30b4fca
Remove trailing newline from CI workflow configuration.
koriym Jun 19, 2025
65d6995
Remove redundant comments from CI workflow configuration by AI.
koriym Jun 20, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
cs:
uses: ray-di/.github/.github/workflows/coding-standards.yml@v1
with:
php_version: 8.3
php_version: 8.4
217 changes: 149 additions & 68 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,105 +3,186 @@ name: Continuous Integration
on:
push:
paths-ignore:
- '**.md'
- '**/*.md'
- '**/*.txt'
- 'LICENSE'
pull_request:
paths-ignore:
- '**/*.md'
- '**/*.txt'
- 'LICENSE'
workflow_dispatch:

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist --no-plugins"
COMPOSER_UPDATE_FLAGS: ""
script: demo/run.php
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
SCRIPT: "demo/run.php"

jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
name: PHPUnit (${{ matrix.os }} - PHP ${{ matrix.php-version }} - ${{ matrix.dependencies }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
php-version: [8.2, 8.3, 8.4]
dependencies: [highest, lowest]
os: [ubuntu-latest]
include:
- php-version: 8.1
os: windows-latest
- php-version: 8.1
os: macos-latest
- php-version: 8.2
# Ubuntu: Test all PHP versions
- os: ubuntu-latest
php-version: "8.1"
dependencies: highest
- os: ubuntu-latest
php-version: "8.2"
dependencies: lowest
os: ubuntu-latest
- php-version: 8.2
- os: ubuntu-latest
php-version: "8.2"
dependencies: highest
os: ubuntu-latest
- php-version: 8.3
- os: ubuntu-latest
php-version: "8.3"
dependencies: lowest
- os: ubuntu-latest
php-version: "8.3"
dependencies: highest
- os: ubuntu-latest
php-version: "8.4"
dependencies: lowest
- os: ubuntu-latest
php-version: "8.4"
dependencies: highest
os: ubuntu-latest
- php-version: 8.3
# Windows: Latest PHP only for CI speed
- os: windows-latest
php-version: "8.4"
dependencies: lowest
os: ubuntu-latest
- php-version: 8.4
- os: windows-latest
php-version: "8.4"
dependencies: highest
os: ubuntu-latest
- php-version: 8.4
# macOS: Latest PHP only for CI speed
- os: macos-latest
php-version: "8.4"
dependencies: lowest
os: ubuntu-latest
- os: macos-latest
php-version: "8.4"
dependencies: highest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4

# --- Redis Setup (All Platforms) ---
- name: Setup Redis (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq
sudo apt-get install -y redis-server redis-tools
sudo systemctl start redis-server
redis-cli ping

- name: Setup Redis (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest -Uri "https://github.com/microsoftarchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.zip" -OutFile "redis.zip"
Expand-Archive "redis.zip" -DestinationPath "redis"
Start-Process -FilePath "redis/redis-server.exe" -WindowStyle Hidden
Start-Sleep -Seconds 10
redis/redis-cli.exe ping

- name: Setup Redis (macOS)
if: runner.os == 'macOS'
run: |
brew install redis
brew services start redis
sleep 8
redis-cli ping

# --- Memcached Setup (All Platforms) ---
- name: Install Memcached (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y memcached
sudo systemctl start memcached

- name: Install Memcached (macOS)
if: runner.os == 'macOS'
run: |
brew install memcached
brew services start memcached
sleep 5

- name: Install Memcached (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
# 1. Download the community-provided binary using curl to handle redirects.
$url = "https://github.com/jefyt/memcached-windows/releases/download/1.6.8_mingw/memcached-1.6.8-win64-mingw.zip"
$zipFile = "memcached.zip"
Write-Host "Downloading Memcached from $url..."
curl.exe -L -o $zipFile $url

# 2. Extract the archive.
$extractDir = "memcached_files"
Write-Host "Extracting $zipFile to $extractDir..."
Expand-Archive -Path $zipFile -DestinationPath $extractDir

# 3. Start Memcached as a background process.
# The service installation method (-d install) is not suitable for CI environments
# as it requires administrative privileges, which are not available by default.
$execPath = Join-Path -Path $extractDir -ChildPath "memcached-1.6.8-win64-mingw\bin\memcached.exe"
Write-Host "Starting Memcached directly as a background process from $execPath"
Start-Process -FilePath $execPath -ArgumentList "-m 64" -WindowStyle Hidden

# 4. Verify that the process started and is listening on the port.
Start-Sleep -Seconds 5
Write-Host "Verifying process and port..."
$process = Get-Process -Name "memcached" -ErrorAction SilentlyContinue
if ($null -eq $process) {
Write-Error "FATAL: Memcached process did not start!"
exit 1
}
$portCheck = netstat -an | findstr "11211"
if (-not $portCheck) {
Write-Error "FATAL: Port 11211 is not listening!"
exit 1
}
Write-Host "SUCCESS: Memcached is running as a process and listening on port 11211."

# --- PHP and Dependencies Setup ---
- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
ini-values: zend.assertions=1
tools: composer
extensions: redis, memcached

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Handle lowest dependencies update
if: contains(matrix.dependencies, 'lowest')
run: echo COMPOSER_UPDATE_FLAGS=$COMPOSER_UPDATE_FLAGS --prefer-lowest >> $GITHUB_ENV

- name: Handle ignore-platform-reqs dependencies update
if: contains(matrix.dependencies, 'ignore')
run: echo COMPOSER_FLAGS=$COMPOSER_FLAGS --ignore-platform-req=php >> $GITHUB_ENV

- name: Remove platform config to get latest dependencies for current PHP version
if: contains(matrix.dependencies, 'highest') || contains(matrix.dependencies, 'lowest')
run: composer config platform --unset

- name: Allow alpha releases for latest-deps builds to catch problems earlier
if: contains(matrix.dependencies, 'ignore')
run: composer config minimum-stability alpha
path: ~/.composer/cache
key: ${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-version }}-composer-

- name: Update dependencies
run: composer update ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_FLAGS }}
- name: Install dependencies
run: |
composer config platform --unset
composer update ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }} ${{ env.COMPOSER_FLAGS }}

- name: Run test suite
- name: Run PHPUnit tests
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload coverage report
uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest' && matrix.php-version == '8.4' && matrix.dependencies == 'highest'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
files: coverage.xml
fail_ci_if_error: false

- name: Update dependencies for demo
run: composer require doctrine/cache ^1 ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_FLAGS }}
- name: Run demo script
if: env.SCRIPT != '' && matrix.os == 'ubuntu-latest' && matrix.php-version == '8.4' && matrix.dependencies == 'highest'
run: |
composer require doctrine/cache:"^1.12" --no-update
composer update ${{ env.COMPOSER_FLAGS }}
php ${{ env.SCRIPT }}

- name: Run additional script
if: ${{ env.script }}
run: php ${{ env.script }}
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jobs:
sa:
uses: ray-di/.github/.github/workflows/static-analysis.yml@v1
with:
php_version: 8.3
php_version: 8.4
has_crc_config: true
15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,20 @@
"ray/di": "^2.17.2",
"ray/psr-cache-module": "^1.3.4",
"symfony/cache": "^5.3 || ^6.0 || ^7.3",
"symfony/cache-contracts": "^2.4 || ^3.0"
"symfony/cache-contracts": "^2.4 || ^3.0",
"symfony/polyfill-php83": "^v1.32.0"
},
"require-dev": {
"ext-redis": "*",
"bear/fastly-module": "^1.0",
"bamarni/composer-bin-plugin": "^1.8",
"bear/fastly-module": "^1.0",
"koriym/attributes": "^1.0.1",
"madapaja/twig-module": "^2.3",
"madapaja/twig-module": "^2.6",
"mobiledetect/mobiledetectlib": "^3.74 || ^4.8",
"phpunit/phpunit": "^9.5.28",
"predis/predis": "^2.2",
"symfony/process": "^4.3 || ^5.4 || ^6.1 || ^7.1",
"twig/twig": "^2.15.3 || ^3.4.3"
"phpunit/phpunit": "^9.6.23",
"predis/predis": "^2.4",
"symfony/process": "^6.1 || ^7.1",
"twig/twig": "^3.4.3"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/AbstractDonutCacheInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use BEAR\Resource\Code;
use BEAR\Resource\ResourceObject;
use Override;
use Ray\Aop\MethodInterceptor;
use Ray\Aop\MethodInvocation;
use Throwable;
Expand All @@ -30,6 +31,7 @@ public function __construct(
/**
* {@inheritDoc}
*/
#[Override]
final public function invoke(MethodInvocation $invocation)
{
$ro = $invocation->getThis();
Expand Down
2 changes: 2 additions & 0 deletions src/CacheDependency.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace BEAR\QueryRepository;

use BEAR\Resource\ResourceObject;
use Override;

use function assert;
use function sprintf;
Expand All @@ -16,6 +17,7 @@ public function __construct(
) {
}

#[Override]
public function depends(ResourceObject $from, ResourceObject $to): void
{
assert(! isset($from->headers[Header::SURROGATE_KEY]));
Expand Down
2 changes: 2 additions & 0 deletions src/CacheInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use BEAR\QueryRepository\Exception\LogicException;
use BEAR\Resource\ResourceObject;
use Override;
use Ray\Aop\MethodInterceptor;
use Ray\Aop\MethodInvocation;
use Throwable;
Expand All @@ -26,6 +27,7 @@ public function __construct(
/**
* {@inheritDoc}
*/
#[Override]
public function invoke(MethodInvocation $invocation)
{
$ro = $invocation->getThis();
Expand Down
2 changes: 2 additions & 0 deletions src/CacheVersionModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace BEAR\QueryRepository;

use Override;
use Ray\Di\AbstractModule;
use Ray\PsrCacheModule\CacheNamespaceModule;

Expand All @@ -26,6 +27,7 @@ public function __construct(
/**
* {@inheritDoc}
*/
#[Override]
protected function configure(): void
{
$this->install(new CacheNamespaceModule($this->version));
Expand Down
2 changes: 2 additions & 0 deletions src/CacheableModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use BEAR\RepositoryModule\Annotation\Purge;
use BEAR\RepositoryModule\Annotation\Refresh;
use BEAR\Sunday\Extension\Transfer\HttpCacheInterface;
use Override;
use Ray\Di\AbstractModule;

/**
Expand All @@ -27,6 +28,7 @@ final class CacheableModule extends AbstractModule
/**
* {@inheritDoc}
*/
#[Override]
protected function configure(): void
{
$this->bind(HttpCacheInterface::class)->to(HttpCache::class);
Expand Down
2 changes: 2 additions & 0 deletions src/Cdn/AkamaiCacheControlHeaderSetter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use BEAR\QueryRepository\CdnCacheControlHeaderSetterInterface;
use BEAR\QueryRepository\Header;
use BEAR\Resource\ResourceObject;
use Override;

use function sprintf;

Expand All @@ -15,6 +16,7 @@ final class AkamaiCacheControlHeaderSetter implements CdnCacheControlHeaderSette
public const CDN_CACHE_CONTROL_HEADER = 'Akamai-Cache-Control';
private const PURGE_KEYS = 'Edge-Cache-Tag';

#[Override]
public function __invoke(ResourceObject $ro, int|null $sMaxAge): void
{
$sMaxAge ??= 31_536_000;
Expand Down
Loading
Loading