Skip to content

Commit 1d24727

Browse files
authored
ci: test with PHP 8.2 and simplify workflow (#411)
1 parent 43e3059 commit 1d24727

File tree

1 file changed

+22
-31
lines changed

1 file changed

+22
-31
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ concurrency:
88
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
99
cancel-in-progress: true
1010

11-
env:
12-
COVERAGE: '0'
13-
1411
jobs:
1512
build:
1613
name: Build and Test
@@ -21,13 +18,21 @@ jobs:
2118
- '7.4'
2219
- '8.0'
2320
- '8.1'
21+
- '8.2'
2422
include:
25-
- php: '8.1'
26-
coverage: true
27-
phpstan: true
23+
- php: '8.2'
24+
latest: true
2825
steps:
2926
- uses: actions/checkout@v3
3027

28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php }}
32+
ini-values: memory_limit=-1
33+
coverage: pcov
34+
tools: composer, cs2pr, php-cs-fixer
35+
3136
- name: Get Composer Cache Directory
3237
id: composer-cache
3338
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
@@ -38,55 +43,41 @@ jobs:
3843
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
3944
restore-keys: ${{ runner.os }}-composer-
4045

41-
- name: Setup PHP with extensions
42-
uses: shivammathur/setup-php@v2
43-
with:
44-
php-version: ${{ matrix.php }}
45-
extensions: json
46-
ini-values: memory_limit=-1
47-
coverage: pcov
48-
tools: composer, cs2pr, php-cs-fixer
49-
5046
- name: Install prerequisites
5147
run: |
5248
wget -O box.phar https://github.com/humbug/box/releases/download/4.3.8/box.phar
5349
echo "BOX_BIN=$(pwd)/box.phar" >> $GITHUB_ENV
5450
sudo chown -R $(whoami):$(whoami) .
5551
5652
- name: Install dependencies
57-
if: startsWith(matrix.php, '8.1')
53+
if: matrix.latest
5854
run: composer install --prefer-dist --no-interaction --no-progress --ansi
5955

6056
- name: Update dependencies
61-
if: "!startsWith(matrix.php, '8.1')"
57+
if: "!matrix.latest"
6258
run: composer update --no-interaction --no-progress --ansi
6359

6460
- name: Enable code coverage
65-
if: matrix.coverage
61+
if: matrix.latest
6662
run: echo "COVERAGE=1" >> $GITHUB_ENV
6763

68-
- name: Run phpunit
69-
run: |
70-
mkdir -p build/logs/phpunit
71-
if [ "$COVERAGE" = '1' ]; then
72-
vendor/bin/simple-phpunit --coverage-clover build/logs/phpunit/clover.xml
73-
else
74-
vendor/bin/simple-phpunit
75-
fi
64+
- name: Run PHPUnit
65+
run: vendor/bin/simple-phpunit ${{ matrix.latest && '--coverage-clover build/logs/phpunit/clover.xml' || '' }}
7666

77-
- name: Run php-cs-fixer
67+
- name: Run PHP CS Fixer
68+
if: matrix.latest
7869
run: php-cs-fixer fix --dry-run --format=checkstyle --ansi | cs2pr
7970

80-
- name: Run phpstan
81-
if: matrix.phpstan
71+
- name: Run PHPStan
72+
if: matrix.latest
8273
run: vendor/bin/phpstan analyse --ansi
8374

8475
- name: Run e2e tests
85-
if: startsWith(matrix.php, '8.1')
76+
if: matrix.latest
8677
run: bin/compile
8778

8879
- name: Upload coverage results to Coveralls
89-
if: matrix.coverage
80+
if: matrix.latest
9081
env:
9182
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9283
run: |

0 commit comments

Comments
 (0)