CodeIgniter4/.github/workflows/test-phpunit.yml

197 lines
5.8 KiB
YAML
Raw Normal View History

2020-09-30 13:46:56 +02:00
name: PHPUnit
2020-09-27 20:04:25 +02:00
on:
2020-10-09 08:53:18 +02:00
push:
branches:
- develop
2022-06-08 06:31:57 +09:00
- '4.*'
2020-10-09 17:19:43 +02:00
paths:
- 'app/**.php'
- 'system/**.php'
- 'tests/**.php'
- 'spark'
2020-10-09 17:19:43 +02:00
- composer.json
2020-10-30 18:42:59 +00:00
- phpunit.xml.dist
2020-10-09 17:19:43 +02:00
- .github/workflows/test-phpunit.yml
- .github/workflows/reusable-phpunit-test.yml
2020-09-27 20:04:25 +02:00
pull_request:
branches:
- develop
2022-06-08 06:31:57 +09:00
- '4.*'
2020-10-07 17:13:15 +08:00
paths:
- 'app/**.php'
- 'system/**.php'
- 'tests/**.php'
- 'spark'
2020-10-07 23:45:29 +08:00
- composer.json
2020-10-30 18:42:59 +00:00
- phpunit.xml.dist
2020-10-07 23:45:29 +08:00
- .github/workflows/test-phpunit.yml
- .github/workflows/reusable-phpunit-test.yml
2020-09-27 20:04:25 +02:00
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
2022-12-26 21:41:12 +07:00
permissions:
contents: read
2020-09-27 20:04:25 +02:00
jobs:
2022-11-13 20:15:23 +08:00
# Any environment variables set in an env context defined at the workflow level
# in the caller workflow are not propagated to the called workflow.
coverage-php-version:
name: Setup PHP Version for Code Coverage
2022-10-23 23:34:46 +08:00
runs-on: ubuntu-22.04
2022-11-13 20:15:23 +08:00
outputs:
version: ${{ steps.coverage-php-version.outputs.version }}
steps:
- id: coverage-php-version
run: |
echo "version=8.1" >> $GITHUB_OUTPUT
sanity-tests:
name: Others
2022-11-13 20:15:23 +08:00
needs: coverage-php-version
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
2023-08-31 18:45:13 +09:00
- '8.3'
include:
- php-version: '8.3'
composer-option: '--ignore-platform-req=php'
2022-11-13 20:15:23 +08:00
uses: ./.github/workflows/reusable-phpunit-test.yml # @TODO Extract to codeigniter4/.github repo
with:
job-name: Sanity Tests
php-version: ${{ matrix.php-version }}
job-id: sanity-tests
group-name: Others
enable-artifact-upload: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
enable-coverage: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
enable-profiling: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
extra-extensions: imagick, redis, memcached
2023-08-31 18:45:13 +09:00
extra-composer-options: ${{ matrix.composer-option }}
2022-11-13 20:15:23 +08:00
database-live-tests:
name: DatabaseLive
2022-11-13 20:15:23 +08:00
needs:
- coverage-php-version
- sanity-tests
2020-09-27 20:04:25 +02:00
strategy:
2020-09-27 21:42:37 +02:00
fail-fast: false
2020-09-27 20:04:25 +02:00
matrix:
2022-11-13 20:15:23 +08:00
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
2023-08-31 18:45:13 +09:00
- '8.3'
2022-11-13 20:15:23 +08:00
db-platform:
- MySQLi
- OCI8
- Postgre
- SQLSRV
- SQLite3
mysql-version:
2023-11-15 10:09:43 +09:00
- '8.0'
2021-05-22 18:35:07 +02:00
include:
2022-11-13 20:15:23 +08:00
- php-version: '7.4'
db-platform: MySQLi
2023-11-15 10:09:43 +09:00
mysql-version: '5.7'
2023-08-31 18:45:13 +09:00
- php-version: '8.3'
composer-option: '--ignore-platform-req=php'
2020-09-27 20:04:25 +02:00
2022-11-13 20:15:23 +08:00
uses: ./.github/workflows/reusable-phpunit-test.yml # @TODO Extract to codeigniter4/.github repo
with:
job-name: ''
2022-11-13 20:15:23 +08:00
php-version: ${{ matrix.php-version }}
job-id: database-live-tests
db-platform: ${{ matrix.db-platform }}
mysql-version: ${{ matrix.mysql-version }}
group-name: DatabaseLive
enable-artifact-upload: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
enable-coverage: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
enable-profiling: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
extra-extensions: mysqli, oci8, pgsql, sqlsrv-5.10.1, sqlite3
2023-08-31 18:45:13 +09:00
extra-composer-options: ${{ matrix.composer-option }}
2022-11-13 20:15:23 +08:00
separate-process-tests:
name: SeparateProcess
2022-11-13 20:15:23 +08:00
needs:
- coverage-php-version
- sanity-tests
2020-09-27 20:04:25 +02:00
2022-11-13 20:15:23 +08:00
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
2023-08-31 18:45:13 +09:00
- '8.3'
include:
- php-version: '8.3'
composer-option: '--ignore-platform-req=php'
2022-11-13 20:15:23 +08:00
uses: ./.github/workflows/reusable-phpunit-test.yml # @TODO Extract to codeigniter4/.github repo
with:
job-name: ''
2022-11-13 20:15:23 +08:00
php-version: ${{ matrix.php-version }}
job-id: separate-process-tests
group-name: SeparateProcess
enable-artifact-upload: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
enable-coverage: true # needs xdebug for assertHeaderEmitted() tests
enable-profiling: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
extra-extensions: mysqli, oci8, pgsql, sqlsrv-5.10.1, sqlite3
2023-08-31 18:45:13 +09:00
extra-composer-options: ${{ matrix.composer-option }}
2022-11-13 20:15:23 +08:00
cache-live-tests:
name: CacheLive
2022-11-13 20:15:23 +08:00
needs:
- coverage-php-version
- sanity-tests
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
2023-08-31 18:45:13 +09:00
- '8.3'
include:
- php-version: '8.3'
composer-option: '--ignore-platform-req=php'
2022-11-13 20:15:23 +08:00
uses: ./.github/workflows/reusable-phpunit-test.yml # @TODO Extract to codeigniter4/.github repo
with:
job-name: Cache Live Tests
php-version: ${{ matrix.php-version }}
job-id: cache-live-tests
group-name: CacheLive
enable-artifact-upload: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
enable-coverage: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
enable-profiling: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }}
extra-extensions: redis, memcached
2023-08-31 18:45:13 +09:00
extra-composer-options: ${{ matrix.composer-option }}
2020-10-15 20:43:44 +07:00
2022-10-20 21:31:21 +08:00
coveralls:
2022-11-13 20:15:23 +08:00
name: Upload coverage results to Coveralls
if: github.repository_owner == 'codeigniter4'
2022-11-13 20:15:23 +08:00
needs:
- coverage-php-version
- sanity-tests
- cache-live-tests
- database-live-tests
- separate-process-tests
uses: ./.github/workflows/reusable-coveralls.yml # @TODO Extract to codeigniter4/.github repo
with:
php-version: ${{ needs.coverage-php-version.outputs.version }}