Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests, clean workflows, separate tests db, use codecov for code coverage. #19883

Merged
merged 24 commits into from Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3b8bd4e
Fix tests, clean workflows, separate tests db, use codecov for code c…
terabytesoftw Jul 6, 2023
d63d478
Use xdebug for code coverage.
terabytesoftw Jul 6, 2023
7a49081
Add `mssql` to code coverage,
terabytesoftw Jul 6, 2023
2149196
No cancel jobs and `refs/heads/master`.
terabytesoftw Jul 6, 2023
1dafd8c
Update .github/workflows/ci-mssql.yml
terabytesoftw Jul 7, 2023
7c8b61a
Update .github/workflows/ci-mssql.yml
terabytesoftw Jul 7, 2023
bb92abc
Update .github/workflows/ci-mssql.yml
terabytesoftw Jul 7, 2023
2bafd7d
Update .github/workflows/ci-mysql.yml
terabytesoftw Jul 7, 2023
568c6e6
Update .github/workflows/ci-mysql.yml
terabytesoftw Jul 7, 2023
fbe703b
Update .github/workflows/ci-mysql.yml
terabytesoftw Jul 7, 2023
e41c545
Update .github/workflows/ci-node.yml
terabytesoftw Jul 7, 2023
95d2f49
Update .github/workflows/ci-sqlite.yml
terabytesoftw Jul 7, 2023
d5e377e
Update .github/workflows/ci-sqlite.yml
terabytesoftw Jul 7, 2023
eadb430
Update .github/workflows/ci-sqlite.yml
terabytesoftw Jul 7, 2023
6468e9b
Revert `No cancel jobs in refs/heads/master`.
terabytesoftw Jul 7, 2023
4d01dc7
Fix apc tests in PHP `8.0`.
terabytesoftw Jul 7, 2023
dd60387
Remove `continue-on-error: true`.
terabytesoftw Jul 7, 2023
1b57331
Fix minor correction.
terabytesoftw Jul 7, 2023
6f6872d
More corrections.
terabytesoftw Jul 7, 2023
821558d
Return `php 7.4`,
terabytesoftw Jul 7, 2023
3de1d67
Remove install php `ci-node.yml`.
terabytesoftw Jul 7, 2023
63d54e2
Remove `continue-on-error: true` all ci.
terabytesoftw Jul 7, 2023
14f8a3a
Fix error typo.
terabytesoftw Jul 7, 2023
93be39c
Update .github/workflows/ci-node.yml
samdark Jul 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
144 changes: 75 additions & 69 deletions .github/workflows/build.yml
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

env:
DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi"
PHPUNIT_EXCLUDE_GROUP: mssql,oci,wincache,xcache,zenddata,cubrid
PHPUNIT_EXCLUDE_GROUP: db,wincache,xcache,zenddata
XDEBUG_MODE: coverage, develop

concurrency:
Expand All @@ -14,89 +14,95 @@ concurrency:
jobs:
phpunit:
name: PHP ${{ matrix.php }} on ${{ matrix.os }}

runs-on: ${{ matrix.os }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: yiitest
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:9.6
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: yiitest
ports:
- 5432:5432
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2]
include:
- php: 5.4
coverage: none
extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached
os: ubuntu-latest
- php: 5.5
coverage: none
extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached
os: ubuntu-latest
- php: 5.6
coverage: none
extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached
os: ubuntu-latest
- php: 7.0
coverage: none
extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached
os: ubuntu-latest
- php: 7.1
coverage: none
extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached
os: ubuntu-latest
- php: 7.2
coverage: none
extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached
os: ubuntu-latest
- php: 7.3
coverage: none
extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached
os: ubuntu-latest
- php: 7.4
coverage: xdebug
extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached
os: ubuntu-latest
- php: 8.0
coverage: none
extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached
os: ubuntu-latest
- php: 8.1
coverage: none
extensions: apcu, curl, dom, imagick, intl, mbstring, mcrypt, memcached
os: ubuntu-latest
- php: 8.2
extensions: apcu, curl, dom, imagick, intl, mbstring, mcrypt, memcached
coverage: none
os: ubuntu-latest

steps:
- name: Generate french locale
- name: Generate french locale.
run: sudo locale-gen fr_FR.UTF-8
- name: Checkout

- name: Checkout.
uses: actions/checkout@v3
- name: Install PHP

- name: Install PHP.
uses: shivammathur/setup-php@v2
with:
coverage: ${{ matrix.coverage }}
extensions: ${{ matrix.extensions }}
ini-values: apc.enabled=1,apc.shm_size=32M,apc.enable_cli=1, date.timezone='UTC', session.save_path="${{ runner.temp }}"
php-version: ${{ matrix.php }}
tools: pecl
extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached, mysql, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, sqlite
ini-values: date.timezone='UTC', session.save_path="${{ runner.temp }}"
- name: Install Memcached

- name: Install Memcached.
uses: niden/actions-memcached@v7
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies

- name: Install dependencies.
run: composer update $DEFAULT_COMPOSER_FLAGS
- name: PHP Unit tests

- name: Run tests with phpunit.
if: matrix.php < '7.4' || matrix.php >= '8.1'
run: vendor/bin/phpunit --verbose --exclude-group $PHPUNIT_EXCLUDE_GROUP --colors=always

npm:
name: NPM 6 on ubuntu-latest
runs-on: ubuntu-latest
- name: Run tests with phpunit.
if: matrix.php == '8.0'
continue-on-error: true
terabytesoftw marked this conversation as resolved.
Show resolved Hide resolved
run: vendor/bin/phpunit --verbose --exclude-group $PHPUNIT_EXCLUDE_GROUP --colors=always

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
ini-values: session.save_path=${{ runner.temp }}
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update $DEFAULT_COMPOSER_FLAGS
- name: Install node.js
uses: actions/setup-node@v1
- name: Run tests with phpunit and generate coverage.
if: matrix.php == '7.4'
run: vendor/bin/phpunit --verbose --exclude-group $PHPUNIT_EXCLUDE_GROUP --coverage-clover=coverage.xml --colors=always

- name: Upload coverage to Codecov.
if: matrix.php == '7.4'
uses: codecov/codecov-action@v3
with:
node-version: 6
- name: Tests
run: |
npm install
npm test
# env:
# CI: true
file: ./coverage.xml
71 changes: 24 additions & 47 deletions .github/workflows/ci-mssql.yml
Expand Up @@ -3,6 +3,7 @@ on:
- push

name: ci-mssql

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -12,37 +13,22 @@ jobs:
name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }}

env:
key: cache
EXTENSIONS: PDO, pdo_sqlsrv
XDEBUG_MODE: coverage, develop

runs-on: ubuntu-latest

strategy:
matrix:
include:
- php: 7.0
extensions: pdo, pdo_sqlsrv-5.8.1
mssql: server:2017-latest
- php: 7.1
extensions: pdo, pdo_sqlsrv-5.8.1
mssql: server:2017-latest
- php: 7.2
extensions: pdo, pdo_sqlsrv-5.8.1
mssql: server:2017-latest
- php: 7.3
extensions: pdo, pdo_sqlsrv-5.8.1
mssql: server:2017-latest
- php: 7.4
extensions: pdo, pdo_sqlsrv
mssql: server:2017-latest
- php: 7.4
extensions: pdo, pdo_sqlsrv
mssql: server:2019-latest
- php: 8.0
extensions: pdo, pdo_sqlsrv
mssql: server:2017-latest
- php: 8.0
extensions: pdo, pdo_sqlsrv
mssql: server:2019-latest
- php: 8.1
mssql: server:2019-latest
- php: 8.2
mssql: server:2022-latest

services:
mssql:
Expand All @@ -65,42 +51,33 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
coverage: xdebug
extensions: ${{ env.EXTENSIONS }}
ini-values: date.timezone='UTC'
php-version: ${{ matrix.php }}
tools: composer:v2, pecl

- name: Determine composer cache directory on Linux
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-

- name: Update composer
run: composer self-update

- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.0
if: matrix.php == '8.0'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: Run Mssql tests with phpunit and generate coverage.
terabytesoftw marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.php == '7.4'
run: vendor/bin/phpunit --group mssql --coverage-clover=coverage.xml --colors=always

- name: PHP Unit tests for PHP 7.1
run: vendor/bin/phpunit --coverage-clover=coverage.clover --group mssql --colors=always
if: matrix.php == '7.1'
- name: Run Mssql tests with phpunit.
terabytesoftw marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.php == '8.0'
continue-on-error: true
terabytesoftw marked this conversation as resolved.
Show resolved Hide resolved
run: vendor/bin/phpunit --group mssql --colors=always

- name: Run tests with phpunit without coverage
- name: Run Mssql tests with phpunit.
terabytesoftw marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.php >= '8.1'
run: vendor/bin/phpunit --group mssql --colors=always

- name: Code coverage
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
if: matrix.php == '7.1'
continue-on-error: true # if is fork
- name: Upload coverage to Codecov.
if: matrix.php == '7.4'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
71 changes: 33 additions & 38 deletions .github/workflows/ci-mysql.yml
Expand Up @@ -3,16 +3,17 @@ on:
- push

name: ci-mysql

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: PHP ${{ matrix.php-version }}-mysql-${{ matrix.mysql-version }}
name: PHP ${{ matrix.php }}-mysql-${{ matrix.mysql }}
env:
extensions: curl, intl, pdo, pdo_mysql
key: cache-v1
XDEBUG_MODE: coverage, develop

runs-on: ${{ matrix.os }}

Expand All @@ -21,15 +22,19 @@ jobs:
os:
- ubuntu-latest

php-version:
php:
- 7.4
- 8.0
- 8.1
- 8.2

mysql-version:
mysql:
- 5.7
- latest

services:
mysql:
image: mysql:${{ matrix.mysql-version }}
image: mysql:${{ matrix.mysql }}
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: yiitest
Expand All @@ -38,46 +43,36 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Checkout
- name: Checkout.
uses: actions/checkout@v3

- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}

- name: Cache extensions
uses: actions/cache@v3
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}

- name: Install PHP with extensions
- name: Install PHP with extensions.
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
coverage: xdebug
extensions: ${{ env.EXTENSIONS }}
ini-values: date.timezone='UTC'
coverage: pcov
php-version: ${{ matrix.php }}
tools: composer:v2, pecl

- name: Determine composer cache directory
if: matrix.os == 'ubuntu-latest'
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
- name: Install dependencies with composer.
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Cache dependencies installed with composer
uses: actions/cache@v1
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
- name: Run Mysql tests with phpunit and generate coverage.
terabytesoftw marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.php == '7.4'
run: vendor/bin/phpunit --group mysql --coverage-clover=coverage.xml --colors=always

- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: Run Mysql tests with phpunit.
terabytesoftw marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.php == '8.0'
continue-on-error: true
run: vendor/bin/phpunit --group mysql --colors=always

- name: Run mysql tests with phpunit
- name: Run Myssql tests with phpunit.
terabytesoftw marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.php >= '8.1'
run: vendor/bin/phpunit --group mysql --colors=always

- name: Upload coverage to Codecov.
if: matrix.php == '7.4'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml