Skip to content

Commit 284cd17

Browse files
committed
Add CI tooling
1 parent e734223 commit 284cd17

File tree

6 files changed

+124
-0
lines changed

6 files changed

+124
-0
lines changed

.github/codecov.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
codecov:
2+
disable_default_path_fixes: no
3+
4+
fixes:
5+
- "/home/runner/work/cakephp-feature-flags/cakephp-feature-flags/::"

.github/workflows/ci.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
jobs:
12+
phpunit:
13+
runs-on: ubuntu-22.04
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
php-version: ['8.1', '8.3']
18+
19+
steps:
20+
- uses: actions/checkout@v1
21+
with:
22+
fetch-depth: 1
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php-version }}
28+
extensions: curl, mbstring, intl, pdo_sqlite
29+
coverage: pcov
30+
31+
- name: composer install
32+
run: |
33+
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
34+
composer install --no-progress --prefer-lowest --prefer-stable --ignore-platform-req=php
35+
else
36+
composer install --no-progress --ignore-platform-req=php
37+
fi
38+
39+
- name: Run PHPUnit
40+
run: |
41+
if [[ ${{ matrix.php-version }} == '8.3' ]]; then
42+
export CODECOVERAGE=1 && vendor/bin/phpunit --coverage-clover=coverage.xml
43+
else
44+
vendor/bin/phpunit
45+
fi
46+
47+
- name: Submit code coverage
48+
if: matrix.php-version == '8.3'
49+
uses: codecov/codecov-action@v4
50+
with:
51+
flags: phpunit
52+
token: ${{ secrets.CODECOV_TOKEN }}
53+
54+
cs-stan:
55+
name: Coding Standard & Static Analysis
56+
runs-on: ubuntu-22.04
57+
steps:
58+
- uses: actions/checkout@v1
59+
with:
60+
fetch-depth: 1
61+
62+
- name: Setup PHP
63+
uses: shivammathur/setup-php@v2
64+
with:
65+
php-version: '8.3'
66+
extensions: mbstring, intl
67+
coverage: none
68+
tools: phive
69+
70+
- name: composer install
71+
run: composer install --no-progress --ignore-platform-req=php
72+
73+
- name: Install PHP tools with phive.
74+
run: phive install --trust-gpg-keys '12CE0F1D262429A5'
75+
76+
- name: Run PHP CodeSniffer
77+
run: vendor/bin/phpcs src/ tests/
78+
79+
- name: Run psalm
80+
if: success() || failure()
81+
run: tools/psalm --output-format=github

.phive/phars.xml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phive xmlns="https://phar.io/phive">
3+
<phar name="psalm" version="5.24.0" installed="5.24.0" location="./tools/psalm" copy="false"/>
4+
</phive>

composer.json

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
2222
}
2323
},
24+
"scripts": {
25+
"check": [
26+
"@test",
27+
"@cs-check"
28+
],
29+
"cs-check": "phpcs --colors -p",
30+
"cs-fix": "phpcbf --colors -p",
31+
"stan": "phpstan analyse",
32+
"test": "phpunit --colors=always"
33+
},
2434
"config": {
2535
"allow-plugins": {
2636
"dealerdirect/phpcodesniffer-composer-installer": true,

phpcs.xml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="App">
3+
<config name="installed_paths" value="../../cakephp/cakephp-codesniffer"/>
4+
5+
<rule ref="CakePHP"/>
6+
7+
<file>src/</file>
8+
<file>tests/</file>
9+
</ruleset>

psalm.xml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="2"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
>
9+
<projectFiles>
10+
<directory name="src" />
11+
<ignoreFiles>
12+
<directory name="vendor" />
13+
</ignoreFiles>
14+
</projectFiles>
15+
</psalm>

0 commit comments

Comments
 (0)