Skip to content

Commit bcd87fb

Browse files
committed
Clean up CI and remove unneeded composer deps
1 parent 6887005 commit bcd87fb

3 files changed

Lines changed: 40 additions & 86 deletions

File tree

.github/workflows/ci.yml

Lines changed: 39 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,105 +2,62 @@ name: CI
22

33
on:
44
push:
5+
branches: [ main ]
56
pull_request:
6-
workflow_dispatch:
7+
branches: [ main ]
8+
9+
env:
10+
PHP_EXTENSIONS: intl pdo_sqlite
711

812
jobs:
9-
testsuite:
10-
runs-on: ubuntu-24.04
13+
test:
14+
runs-on: ubuntu-latest
1115
strategy:
12-
fail-fast: false
1316
matrix:
14-
php-version: ['8.2', '8.4']
15-
db-type: [sqlite, mysql, pgsql]
16-
17-
services:
18-
postgres:
19-
image: postgres
20-
ports:
21-
- 5432:5432
22-
env:
23-
POSTGRES_PASSWORD: postgres
24-
17+
php-version: [8.2, 8.3, 8.4]
18+
prefer-lowest: ['']
19+
include:
20+
- php-version: '8.2'
21+
db-type: 'sqlite'
22+
prefer-lowest: 'prefer-lowest'
23+
24+
container:
25+
image: thecodingmachine/php:${{ matrix.php-version }}-v5-cli
2526
steps:
26-
- uses: actions/checkout@v4
27-
28-
- name: Setup Service
29-
if: matrix.db-type == 'mysql'
30-
run: |
31-
sudo service mysql start
32-
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp;'
33-
34-
- name: Setup PHP
35-
uses: shivammathur/setup-php@v2
36-
with:
37-
php-version: ${{ matrix.php-version }}
38-
extensions: mbstring, intl, pdo_${{ matrix.db-type }}
39-
coverage: pcov
40-
41-
- name: Get composer cache directory
42-
id: composercache
43-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
44-
45-
- name: Cache dependencies
46-
uses: actions/cache@v4
47-
with:
48-
path: ${{ steps.composercache.outputs.dir }}
49-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
50-
restore-keys: ${{ runner.os }}-composer-
27+
- name: Checkout code
28+
uses: actions/checkout@v4
5129

52-
- name: Composer install
30+
- name: Install dependencies
5331
run: |
54-
composer install --no-progress --prefer-dist --optimize-autoloader
55-
32+
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
33+
composer update --prefer-lowest --prefer-stable
34+
composer require --dev dereuromark/composer-prefer-lowest:dev-master
35+
else
36+
composer install --prefer-dist --no-interaction --no-progress
37+
fi
5638
5739
- name: Run PHPUnit
5840
run: |
59-
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
60-
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp'; fi
61-
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:postgres@127.0.0.1/postgres'; fi
62-
if [[ ${{ matrix.php-version }} == '8.2' ]]; then
41+
if [[ ${{ matrix.php-version }} == '8.4' ]]; then
6342
vendor/bin/phpunit --coverage-clover=coverage.xml
6443
else
6544
vendor/bin/phpunit
6645
fi
6746
68-
- name: Upload coverage reports to Codecov
69-
if: success() && matrix.php-version == '8.2'
70-
uses: codecov/codecov-action@v4
71-
with:
72-
token: ${{ secrets.CODECOV_TOKEN }}
73-
74-
validation:
75-
name: Coding Standard & Static Analysis
76-
runs-on: ubuntu-24.04
77-
47+
static-analysis:
48+
runs-on: ubuntu-latest
49+
if: github.event_name == 'push' || github.event_name == 'pull_request'
50+
container:
51+
image: thecodingmachine/php:8.4-v5-cli
7852
steps:
79-
- uses: actions/checkout@v4
80-
81-
- name: Setup PHP
82-
uses: shivammathur/setup-php@v2
83-
with:
84-
php-version: '8.2'
85-
extensions: mbstring, intl
86-
coverage: none
87-
88-
- name: Get composer cache directory
89-
id: composercache
90-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
91-
92-
- name: Cache dependencies
93-
uses: actions/cache@v4
94-
with:
95-
path: ${{ steps.composercache.outputs.dir }}
96-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
97-
restore-keys: ${{ runner.os }}-composer-
53+
- name: Checkout code
54+
uses: actions/checkout@v4
9855

99-
- name: Composer Setup
100-
run: composer stan-setup
56+
- name: Install dependencies
57+
run: composer install --prefer-dist --no-interaction --no-progress
10158

102-
- name: Run phpstan
103-
run: vendor/bin/phpstan analyse --error-format=github
59+
- name: Run PHPStan
60+
run: vendor/bin/phpstan analyse --no-progress --error-format=github
10461

105-
- name: Run phpcs
106-
run: composer cs-check
62+
- name: Run PHPCS
63+
run: vendor/bin/phpcs src/ tests/

composer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"symfony/uid": "^7.3"
1616
},
1717
"require-dev": {
18-
"cakephp/migrations": "^4.5",
1918
"cakephp/plugin-installer": "^2",
2019
"phpunit/phpunit": "^10.5 || ^11.1 || ^12.0",
2120
"phpstan/phpstan": "^2.1",
@@ -36,8 +35,7 @@
3635
},
3736
"authors": [
3837
{
39-
"name": "Jasper Smet",
40-
"email": "josbeir@gmail.com"
38+
"name": "Jasper Smet"
4139
}
4240
],
4341
"config": {

phpcs.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99

1010
<file>src/</file>
1111
<file>tests/</file>
12-
<file>plugins/</file>
1312
</ruleset>

0 commit comments

Comments
 (0)