Skip to content

Commit 4c8852a

Browse files
committed
change to new github workflow
1 parent 9e5d176 commit 4c8852a

File tree

2 files changed

+80
-70
lines changed

2 files changed

+80
-70
lines changed

.github/workflows/main.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Controls when the action will run.
2+
on:
3+
# Triggers the workflow on push or pull request events but only for the main branch
4+
push:
5+
pull_request:
6+
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: "read"
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
14+
jobs:
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:
25+
runs-on: "ubuntu-latest"
26+
strategy:
27+
matrix:
28+
php-version:
29+
- "8.1"
30+
- "8.2"
31+
- "8.3"
32+
name: "PHP ${{ matrix.php-version }}"
33+
steps:
34+
- name: "git checkout"
35+
uses: "actions/checkout@v3"
36+
- name: "setup PHP"
37+
uses: "shivammathur/setup-php@v2"
38+
with:
39+
php-version: "${{ matrix.php-version }}"
40+
coverage: "xdebug"
41+
- name: "check PHP version"
42+
run: "php -v"
43+
- name: "lint PHP files"
44+
run: "php -l exceptions/ 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: "exceptions/ src/ tests/"
54+
# run unit tests
55+
phpunit:
56+
runs-on: "ubuntu-latest"
57+
env:
58+
CC_TEST_REPORTER_ID: "b6d85f5dc7af90e89653c56b04866b27d98b35e84c2ff9a5d9499bbb53469cbf"
59+
name: "PHPUnit"
60+
steps:
61+
- name: "git checkout"
62+
uses: "actions/checkout@v3"
63+
- name: "setup PHP"
64+
uses: "shivammathur/setup-php@v2"
65+
with:
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"
73+
run: |
74+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
75+
chmod +x ./cc-test-reporter
76+
./cc-test-reporter before-build
77+
- name: "run PHPUnit"
78+
run: |
79+
php vendor/bin/phpunit --coverage-clover clover.xml --coverage-text
80+
./cc-test-reporter after-build -t clover --exit-code $?

.github/workflows/php.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)