Skip to content

Commit b2e58bd

Browse files
authored
Update ci.yml
1 parent 0b6035b commit b2e58bd

File tree

1 file changed

+96
-98
lines changed

1 file changed

+96
-98
lines changed

.github/workflows/ci.yml

+96-98
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# CI workflow adapted from https://github.com/cakephp/cakephp/blob/master/.github/workflows/ci.yml
21
name: CI
32

43
on:
54
push:
6-
5+
76
pull_request:
87
branches:
98
- '*'
@@ -15,108 +14,107 @@ jobs:
1514
fail-fast: false
1615
matrix:
1716
php-version: ['8.1', '8.2', '8.3']
18-
db-type: ['sqlite', 'mysql', 'pgsql']
17+
db-type: [sqlite, mysql, pgsql]
1918
prefer-lowest: ['']
2019

2120
steps:
22-
- name: Setup MySQL latest
23-
if: matrix.db-type == 'mysql'
24-
run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql --default-authentication-plugin=mysql_native_password --disable-log-bin
25-
26-
- name: Setup PostgreSQL latest
27-
if: matrix.db-type == 'pgsql'
28-
run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres
29-
30-
- uses: actions/checkout@v2
31-
32-
- name: Setup PHP
33-
uses: shivammathur/setup-php@v2
34-
with:
35-
php-version: ${{ matrix.php-version }}
36-
extensions: mbstring, intl, apcu, memcached, redis, sqlite, pdo_sqlite, pdo_${{ matrix.db-type }}
37-
ini-values: apc.enable_cli = 1
38-
coverage: pcov
39-
40-
- name: Get composer cache directory
41-
id: composer-cache
42-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
43-
44-
- name: Get date part for cache key
45-
id: key-date
46-
run: echo "::set-output name=date::$(date +'%Y-%m')"
47-
48-
- name: Cache composer dependencies
49-
uses: actions/cache@v1
50-
with:
51-
path: ${{ steps.composer-cache.outputs.dir }}
52-
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
53-
54-
- name: Composer install
55-
run: |
56-
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
57-
composer update --prefer-lowest --prefer-stable
58-
else
59-
composer update
60-
fi
61-
62-
- name: Setup problem matchers for PHPUnit
63-
if: matrix.php-version == '8.1' && matrix.db-type == 'mysql'
64-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
65-
66-
- name: Run PHPUnit
67-
run: |
68-
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
69-
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:[email protected]/cakephp?encoding=utf8'; fi
70-
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:[email protected]/postgres'; fi
71-
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
72-
export CODECOVERAGE=1 && vendor/bin/phpunit --display-deprecations --display-incomplete --display-skipped --coverage-clover=coverage.xml
73-
else
74-
vendor/bin/phpunit
75-
fi
76-
77-
- name: Submit code coverage
78-
if: matrix.php-version == '8.1'
79-
uses: codecov/codecov-action@v1
21+
- name: Setup MySQL latest
22+
if: matrix.db-type == 'mysql'
23+
run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql --default-authentication-plugin=mysql_native_password --disable-log-bin
24+
25+
- name: Setup PostgreSQL latest
26+
if: matrix.db-type == 'pgsql'
27+
run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres
28+
29+
- uses: actions/checkout@v2
30+
31+
- name: Setup PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: ${{ matrix.php-version }}
35+
extensions: mbstring, intl, apcu, sqlite, pdo_sqlite, pdo_${{ matrix.db-type }}, ${{ matrix.db-type }}
36+
ini-values: apc.enable_cli = 1
37+
coverage: pcov
38+
39+
- name: Get composer cache directory
40+
id: composer-cache
41+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
42+
43+
- name: Get date part for cache key
44+
id: key-date
45+
run: echo "::set-output name=date::$(date +'%Y-%m')"
46+
47+
- name: Cache composer dependencies
48+
uses: actions/cache@v1
49+
with:
50+
path: ${{ steps.composer-cache.outputs.dir }}
51+
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
52+
53+
- name: composer install
54+
run: |
55+
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
56+
composer update --prefer-lowest --prefer-stable
57+
else
58+
composer update
59+
fi
60+
61+
- name: Setup problem matchers for PHPUnit
62+
if: matrix.php-version == '8.1' && matrix.db-type == 'mysql'
63+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
64+
65+
- name: Run PHPUnit
66+
run: |
67+
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
68+
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:[email protected]/cakephp?encoding=utf8'; fi
69+
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:[email protected]/postgres'; fi
70+
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
71+
export CODECOVERAGE=1 && vendor/bin/phpunit --display-deprecations --display-incomplete --display-skipped --coverage-clover=coverage.xml
72+
else
73+
vendor/bin/phpunit
74+
fi
75+
76+
- name: Submit code coverage
77+
if: matrix.php-version == '8.1'
78+
uses: codecov/codecov-action@v1
8079

8180
cs-stan:
8281
name: Coding Standard & Static Analysis
8382
runs-on: ubuntu-22.04
8483

8584
steps:
86-
- uses: actions/checkout@v2
87-
88-
- name: Setup PHP
89-
uses: shivammathur/setup-php@v2
90-
with:
91-
php-version: '8.1'
92-
extensions: mbstring, intl, apcu, memcached, redis
93-
tools: cs2pr
94-
coverage: none
95-
96-
- name: Get composer cache directory
97-
id: composer-cache
98-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
99-
100-
- name: Get date part for cache key
101-
id: key-date
102-
run: echo "::set-output name=date::$(date +'%Y-%m')"
103-
104-
- name: Cache composer dependencies
105-
uses: actions/cache@v1
106-
with:
107-
path: ${{ steps.composer-cache.outputs.dir }}
108-
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
109-
110-
- name: composer install
111-
run: composer stan-setup
112-
113-
- name: Run PHP CodeSniffer
114-
run: composer cs-check
115-
116-
- name: Run psalm
117-
if: success() || failure()
118-
run: composer psalm
119-
120-
- name: Run phpstan
121-
if: success() || failure()
122-
run: composer stan
85+
- uses: actions/checkout@v2
86+
87+
- name: Setup PHP
88+
uses: shivammathur/setup-php@v2
89+
with:
90+
php-version: '8.1'
91+
extensions: mbstring, intl, apcu
92+
coverage: none
93+
94+
- name: Get composer cache directory
95+
id: composer-cache
96+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
97+
98+
- name: Get date part for cache key
99+
id: key-date
100+
run: echo "::set-output name=date::$(date +'%Y-%m')"
101+
102+
- name: Cache composer dependencies
103+
uses: actions/cache@v1
104+
with:
105+
path: ${{ steps.composer-cache.outputs.dir }}
106+
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
107+
108+
- name: composer install
109+
run: composer stan-setup
110+
111+
- name: Run PHP CodeSniffer
112+
run: composer cs-check
113+
114+
# - name: Run psalm
115+
# if: success() || failure()
116+
# run: vendor/bin/psalm.phar --output-format=github
117+
118+
- name: Run phpstan
119+
if: success() || failure()
120+
run: composer stan

0 commit comments

Comments
 (0)