Skip to content

Commit 0bb650e

Browse files
committed
Add GitHub action for tests
1 parent 3e0743e commit 0bb650e

File tree

2 files changed

+73
-4
lines changed

2 files changed

+73
-4
lines changed

.github/workflows/pr-check.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: PR checks and tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
run:
10+
name: PHP ${{ matrix.php-versions }} (Redis ${{ matrix.redis-versions }})
11+
runs-on: ubuntu-latest
12+
container: shivammathur/node
13+
services:
14+
redis:
15+
image: redis:${{ matrix.redis-versions }}-alpine
16+
# Set health checks to wait until redis has started
17+
options: >-
18+
--health-cmd "redis-cli ping"
19+
--health-interval 10s
20+
--health-timeout 5s
21+
--health-retries 5
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
26+
redis-versions: ['5', '6', '7']
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Setup PHP
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
php-version: ${{ matrix.php-versions }}
36+
37+
- name: Get composer cache directory
38+
id: composercache
39+
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
40+
41+
- name: Cache dependencies
42+
uses: actions/cache@v4
43+
with:
44+
path: ${{ steps.composercache.outputs.dir }}
45+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
46+
restore-keys: ${{ runner.os }}-composer-
47+
48+
- name: Install dependencies
49+
run: |
50+
composer install --no-interaction --no-ansi --no-progress
51+
52+
- name: Run phpcs
53+
run: |
54+
./vendor/bin/phpcs
55+
56+
- name: Run phpstan
57+
run: |
58+
./vendor/bin/phpstan analyse src
59+
60+
- name: Run phpunit tests
61+
env:
62+
REDIS_HOST: redis
63+
REDIS_PORT: 6379
64+
REDIS_TIMEOUT: 0.0
65+
run: |
66+
./vendor/bin/phpunit --disallow-test-output --no-coverage

composer.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
],
1717
"require": {
1818
"ext-json": "*",
19-
"pdffiller/qless-php": "^3.13"
19+
"pdffiller/qless-php": "dev-upgrade-php-version"
2020
},
2121
"require-dev": {
2222
"illuminate/events": "5.6.*|5.7.*|^6.20",
23-
"infection/infection": "^0.12.0",
23+
"infection/infection": "^0.20.0",
2424
"orchestra/testbench": "~3.0",
25-
"phpstan/phpstan": "^0.11.1",
25+
"phpstan/phpstan": "^1.0",
2626
"phpunit/phpunit": ">=5.3 <8.0 | ^8.2",
2727
"squizlabs/php_codesniffer": "^3.4"
2828
},
@@ -40,6 +40,9 @@
4040
"config": {
4141
"optimize-autoloader": true,
4242
"preferred-install": "dist",
43-
"sort-packages": true
43+
"sort-packages": true,
44+
"allow-plugins": {
45+
"infection/extension-installer": true
46+
}
4447
}
4548
}

0 commit comments

Comments
 (0)