Skip to content

Commit

Permalink
CI: Redis service (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rdex authored Oct 15, 2024
1 parent 214cbfa commit b5a5380
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,25 @@ jobs:

strategy:
matrix:
php-versions:
php-version:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
redis-version:
- 3
- 7

services:
redis:
image: redis:${{ matrix.redis-version }}
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379

steps:
- uses: actions/checkout@v4
Expand All @@ -35,7 +49,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
php-version: ${{ matrix.php-version }}
tools: composer

- name: Get composer cache directory
Expand All @@ -46,14 +60,11 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --prefer-dist

- name: Run Redis
run: docker run -d --rm -p 127.0.0.1:6379:6379 redis:${REDIS_VERSION:=3}

- name: Run test suite
run: composer test
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
},
"scripts": {
"test": "vendor/bin/phpunit tests/",
"test": ["@sca", "vendor/bin/phpunit tests/"],
"fix-cs": "vendor/bin/php-cs-fixer fix --rules=@PSR12:risky,@PHP80Migration:risky,@PHPUnit84Migration:risky --allow-risky=yes .",
"sca": "vendor/bin/phpstan --memory-limit=-1 analyse --level=max src/ tests/"
}
Expand Down

0 comments on commit b5a5380

Please sign in to comment.