Skip to content

Commit 87a3d49

Browse files
committed
Enable CI
1 parent 29c98e1 commit 87a3d49

File tree

3 files changed

+109
-46
lines changed

3 files changed

+109
-46
lines changed

.github/workflows/ci.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- 4.x
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
jobs:
12+
testsuite:
13+
runs-on: ubuntu-22.04
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
php-version: ['7.3', '8.2']
18+
prefer-lowest: ['']
19+
include:
20+
- php-version: '7.3'
21+
prefer-lowest: 'prefer-lowest'
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php-version }}
30+
extensions: mbstring, intl
31+
coverage: pcov
32+
33+
- name: Get composer cache directory
34+
id: composer-cache
35+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
36+
37+
- name: Get date part for cache key
38+
id: key-date
39+
run: echo "::set-output name=date::$(date +'%Y-%m')"
40+
41+
- name: Cache composer dependencies
42+
uses: actions/cache@v3
43+
with:
44+
path: ${{ steps.composer-cache.outputs.dir }}
45+
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
46+
47+
- name: Composer Install
48+
run: |
49+
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
50+
composer update --prefer-lowest --prefer-stable
51+
else
52+
composer update
53+
fi
54+
55+
- name: Configure PHPUnit matcher
56+
if: matrix.php-version == '7.3'
57+
uses: mheap/phpunit-matcher-action@main
58+
59+
- name: Run PHPUnit
60+
run: |
61+
if [[ ${{ matrix.php-version }} == '7.3' ]]; then
62+
export CODECOVERAGE=1 && vendor/bin/phpunit --verbose --coverage-clover=coverage.xml
63+
else
64+
vendor/bin/phpunit
65+
fi
66+
67+
- name: Submit code coverage
68+
if: success() && matrix.php-version == '7.3'
69+
uses: codecov/codecov-action@v3
70+
71+
cs-stan:
72+
name: Coding Standard & Static Analysis
73+
runs-on: ubuntu-22.04
74+
75+
steps:
76+
- uses: actions/checkout@v3
77+
78+
- name: Setup PHP
79+
uses: shivammathur/setup-php@v2
80+
with:
81+
php-version: '7.3'
82+
extensions: mbstring, intl
83+
tools: cs2pr
84+
coverage: none
85+
86+
- name: Get composer cache directory
87+
id: composer-cache
88+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
89+
90+
- name: Get date part for cache key
91+
id: key-date
92+
run: echo "::set-output name=date::$(date +'%Y-%m')"
93+
94+
- name: Cache composer dependencies
95+
uses: actions/cache@v3
96+
with:
97+
path: ${{ steps.composer-cache.outputs.dir }}
98+
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
99+
100+
- name: Composer install
101+
run: composer stan-setup
102+
103+
- name: Run PHP CodeSniffer
104+
run: vendor/bin/phpcs --report=checkstyle src/ tests/ | cs2pr
105+
106+
- name: Run phpstan
107+
if: success() || failure()
108+
run: vendor/bin/phpstan.phar analyse --error-format=github

.travis.yml

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

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
}
4545
],
4646
"require":{
47+
"php": ">=7.3",
4748
"cakephp/cakephp": "^4.2"
4849
},
4950
"require-dev": {

0 commit comments

Comments
 (0)