Skip to content

Commit 53c0557

Browse files
committed
refactor github workflow config
1 parent 48dfc96 commit 53c0557

File tree

2 files changed

+81
-70
lines changed

2 files changed

+81
-70
lines changed

.github/workflows/main.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: "CI"
2+
# Controls when the action will run.
3+
on:
4+
# Triggers the workflow on push or pull request events but only for the main branch
5+
push:
6+
pull_request:
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: "read"
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
# composer validation
17+
composer:
18+
name: "composer config validation"
19+
runs-on: "ubuntu-latest"
20+
steps:
21+
- uses: "actions/checkout@v3"
22+
- name: "Validate composer.json"
23+
run: "composer validate --strict"
24+
# PHP lint and PHPStan for different PHP versions
25+
php:
26+
runs-on: "ubuntu-latest"
27+
strategy:
28+
matrix:
29+
php-version:
30+
- "8.1"
31+
- "8.2"
32+
- "8.3"
33+
name: "PHP ${{ matrix.php-version }}"
34+
steps:
35+
- name: "git checkout"
36+
uses: "actions/checkout@v3"
37+
- name: "setup PHP"
38+
uses: "shivammathur/setup-php@v2"
39+
with:
40+
php-version: "${{ matrix.php-version }}"
41+
coverage: "xdebug"
42+
- name: "check PHP version"
43+
run: "php -v"
44+
- name: "lint PHP files"
45+
run: "php -l src/ tests/"
46+
- name: "install composer dependencies"
47+
run: "composer install --prefer-dist --no-progress"
48+
# PHPStan
49+
- name: "PHPStan static analysis"
50+
uses: "php-actions/phpstan@v3"
51+
with:
52+
php_version: "${{ matrix.php-version }}"
53+
configuration: "phpstan.neon"
54+
path: "src/ tests/"
55+
# run unit tests
56+
phpunit:
57+
runs-on: "ubuntu-latest"
58+
env:
59+
CC_TEST_REPORTER_ID: "a8cbf54ef2884175dc3bb747b33c826351d3a2d758f9145a5eeac97e48b36a34"
60+
name: "PHPUnit"
61+
steps:
62+
- name: "git checkout"
63+
uses: "actions/checkout@v3"
64+
- name: "setup PHP"
65+
uses: "shivammathur/setup-php@v2"
66+
with:
67+
php-version: "8.1"
68+
coverage: "xdebug"
69+
- name: "check PHP version"
70+
run: "php -v"
71+
- name: "install composer dependencies"
72+
run: "composer install --prefer-dist --no-progress"
73+
- name: "CodeClimate reporter setup"
74+
run: |
75+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
76+
chmod +x ./cc-test-reporter
77+
./cc-test-reporter before-build
78+
- name: "run PHPUnit"
79+
run: |
80+
php vendor/bin/phpunit --coverage-clover clover.xml --coverage-text
81+
./cc-test-reporter after-build -t clover --exit-code $?

.github/workflows/php.yml

-70
This file was deleted.

0 commit comments

Comments
 (0)