Skip to content

Commit b5a5380

Browse files
authored
CI: Redis service (#10)
1 parent 214cbfa commit b5a5380

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,25 @@ jobs:
2020

2121
strategy:
2222
matrix:
23-
php-versions:
23+
php-version:
2424
- '8.0'
2525
- '8.1'
2626
- '8.2'
2727
- '8.3'
28+
redis-version:
29+
- 3
30+
- 7
31+
32+
services:
33+
redis:
34+
image: redis:${{ matrix.redis-version }}
35+
options: >-
36+
--health-cmd "redis-cli ping"
37+
--health-interval 10s
38+
--health-timeout 5s
39+
--health-retries 5
40+
ports:
41+
- 6379:6379
2842

2943
steps:
3044
- uses: actions/checkout@v4
@@ -35,7 +49,7 @@ jobs:
3549
- name: Setup PHP
3650
uses: shivammathur/setup-php@v2
3751
with:
38-
php-version: ${{ matrix.php-versions }}
52+
php-version: ${{ matrix.php-version }}
3953
tools: composer
4054

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

5266
- name: Install dependencies
5367
run: composer install --prefer-dist
5468

55-
- name: Run Redis
56-
run: docker run -d --rm -p 127.0.0.1:6379:6379 redis:${REDIS_VERSION:=3}
57-
5869
- name: Run test suite
5970
run: composer test

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131
},
3232
"scripts": {
33-
"test": "vendor/bin/phpunit tests/",
33+
"test": ["@sca", "vendor/bin/phpunit tests/"],
3434
"fix-cs": "vendor/bin/php-cs-fixer fix --rules=@PSR12:risky,@PHP80Migration:risky,@PHPUnit84Migration:risky --allow-risky=yes .",
3535
"sca": "vendor/bin/phpstan --memory-limit=-1 analyse --level=max src/ tests/"
3636
}

0 commit comments

Comments
 (0)