Skip to content

Commit 59f70bd

Browse files
committed
switch to new github workflow
1 parent 3138eb9 commit 59f70bd

File tree

1 file changed

+53
-43
lines changed

1 file changed

+53
-43
lines changed

.github/workflows/php.yml

Lines changed: 53 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,80 @@
1-
name: "PHP"
1+
# Controls when the action will run.
22
on:
3+
# Triggers the workflow on push or pull request events but only for the main branch
34
push:
4-
branches:
5-
- "main"
65
pull_request:
7-
branches:
8-
- "main"
6+
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
910
permissions:
1011
contents: "read"
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1114
jobs:
12-
# PHP lint for different PHP versions
13-
build:
15+
# composer validation
16+
composer:
17+
name: "composer config validation"
18+
runs-on: "ubuntu-latest"
19+
steps:
20+
- uses: "actions/checkout@v3"
21+
- name: "Validate composer.json"
22+
run: "composer validate --strict"
23+
# PHP lint and PHPStan for different PHP versions
24+
php:
1425
runs-on: "ubuntu-latest"
1526
strategy:
1627
matrix:
1728
php-version:
18-
- "7.4"
1929
- "8.1"
20-
env:
21-
CC_TEST_REPORTER_ID: "b55ff60ba178ed6d17d568f49e8c6034e54aee0cfaf765c317a8545aeafe1215"
30+
- "8.2"
31+
- "8.3"
2232
name: "PHP ${{ matrix.php-version }}"
2333
steps:
24-
- # git checkout
25-
name: "git checkout"
34+
- name: "git checkout"
2635
uses: "actions/checkout@v3"
27-
- # Setup PHP
28-
name: "Setup PHP"
36+
- name: "setup PHP"
2937
uses: "shivammathur/setup-php@v2"
3038
with:
3139
php-version: "${{ matrix.php-version }}"
3240
coverage: "xdebug"
33-
- # Check PHP version
34-
name: "Check PHP version"
41+
- name: "check PHP version"
3542
run: "php -v"
36-
- # Lint PHP files
37-
name: "Lint PHP files"
38-
run: |
39-
for file in $(find ./ -type f -name '*.php'); do
40-
echo -n "==> ${file}: ";
41-
php -l "${file}";
42-
done
43-
- # Validate composer.json and composer.lock
44-
name: "Validate composer.json and composer.lock"
45-
run: "composer validate --strict"
46-
- # Cache Composer packages
47-
name: "Cache Composer packages"
48-
id: "composer-cache"
49-
uses: "actions/cache@v3"
43+
- name: "lint PHP files"
44+
run: "php -l src/ tests/"
45+
# - name: "install composer dependencies"
46+
# run: "composer install --prefer-dist --no-progress"
47+
# # PHPStan
48+
# - name: "PHPStan static analysis"
49+
# uses: "php-actions/phpstan@v3"
50+
# with:
51+
# php_version: "${{ matrix.php-version }}"
52+
# configuration: "phpstan.neon"
53+
# path: "src/ tests/"
54+
# run unit tests
55+
phpunit:
56+
runs-on: "ubuntu-latest"
57+
env:
58+
CC_TEST_REPORTER_ID: "b55ff60ba178ed6d17d568f49e8c6034e54aee0cfaf765c317a8545aeafe1215"
59+
name: "PHPUnit"
60+
steps:
61+
- name: "git checkout"
62+
uses: "actions/checkout@v3"
63+
- name: "setup PHP"
64+
uses: "shivammathur/setup-php@v2"
5065
with:
51-
path: "vendor"
52-
key: "${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}"
53-
restore-keys: "${{ runner.os }}-php-"
54-
- # Install dependencies
55-
name: "Install composer dependencies"
56-
run: "composer install --prefer-dist --no-progress --ignore-platform-req=ext-sapnwrfc"
57-
- # PHP_CodeSniffer
58-
name: "PHP_CodeSniffer"
59-
run: "php vendor/bin/phpcs"
60-
- # CodeClimate Reporter Setup
61-
name: "CodeClimate Reporter Setup"
66+
php-version: "8.1"
67+
coverage: "xdebug"
68+
- name: "check PHP version"
69+
run: "php -v"
70+
- name: "install composer dependencies"
71+
run: "composer install --prefer-dist --no-progress"
72+
- name: "CodeClimate reporter setup"
6273
run: |
6374
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
6475
chmod +x ./cc-test-reporter
6576
./cc-test-reporter before-build
66-
- # Run phpunit
67-
name: "Run phpunit"
77+
- name: "run PHPUnit"
6878
run: |
6979
php vendor/bin/phpunit --coverage-clover clover.xml --coverage-text
7080
./cc-test-reporter after-build -t clover --exit-code $?

0 commit comments

Comments
 (0)