Skip to content

Commit

Permalink
[TASK] Optimize CI and add coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertsoft committed Aug 2, 2022
1 parent 07af7de commit 131abc9
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 67 deletions.
77 changes: 53 additions & 24 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ jobs:
echo "::set-output name=timestamp::$(date +"%s")"
- name: Cache Composer dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache-vars.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.composer-cache-vars.outputs.timestamp }}
key: ${{ runner.os }}-composer-2-latest-${{ steps.composer-cache-vars.outputs.timestamp }}
restore-keys: |
${{ runner.os }}-composer-2-latest-
${{ runner.os }}-composer-2-
${{ runner.os }}-composer-
- name: Install dependencies
Expand Down Expand Up @@ -106,12 +108,13 @@ jobs:
echo "::set-output name=timestamp::$(date +"%s")"
- name: Cache Composer dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache-vars.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ steps.composer-cache-vars.outputs.timestamp }}
key: ${{ runner.os }}-composer-2-${{ matrix.php-version }}-${{ steps.composer-cache-vars.outputs.timestamp }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php-version }}-
${{ runner.os }}-composer-2-${{ matrix.php-version }}-
${{ runner.os }}-composer-2-
${{ runner.os }}-composer-
- name: Set platform.php for nightly
Expand Down Expand Up @@ -150,12 +153,14 @@ jobs:
echo "::set-output name=timestamp::$(date +"%s")"
- name: Cache Composer dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache-vars.outputs.dir }}
key: ${{ runner.os }}-composer-latest-${{ steps.composer-cache-vars.outputs.timestamp }}
key: ${{ runner.os }}-composer-2-latest-${{ steps.composer-cache-vars.outputs.timestamp }}
restore-keys: |
${{ runner.os }}-composer-latest-
${{ runner.os }}-composer-2-latest-
${{ runner.os }}-composer-2-
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }}
Expand All @@ -166,8 +171,7 @@ jobs:
php_stan:
name: PHP Stan
needs:
- validation
- php_coding_standards
- php_lint
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}

Expand Down Expand Up @@ -217,13 +221,14 @@ jobs:
echo "::set-output name=timestamp::$(date +"%s")"
- name: Cache Composer dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache-vars.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.dependencies }}-${{ matrix.php-version }}-${{ steps.composer-cache-vars.outputs.timestamp }}
key: ${{ runner.os }}-composer-2-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ steps.composer-cache-vars.outputs.timestamp }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.dependencies }}-${{ matrix.php-version }}-
${{ runner.os }}-composer-${{ matrix.dependencies }}-
${{ runner.os }}-composer-2-${{ matrix.php-version }}-${{ matrix.dependencies }}-
${{ runner.os }}-composer-2-${{ matrix.php-version }}-
${{ runner.os }}-composer-2-
${{ runner.os }}-composer-
- name: Handle lowest dependencies update
Expand Down Expand Up @@ -259,7 +264,7 @@ jobs:
tests:
name: Tests
needs:
- php_stan
- php_lint
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}

Expand Down Expand Up @@ -318,8 +323,8 @@ jobs:
uses: shivammathur/setup-php@v2
with:
coverage: xdebug
extensions: mbstring
ini-values: memory_limit=-1, error_reporting=E_ALL, display_errors=On
extensions: mbstring, json
ini-values: memory_limit=-1, error_reporting=-1, log_errors_max_len=0, zend.assertions=1, assert.exception=1, xdebug.show_exception_trace=0
php-version: ${{ matrix.php-version }}
tools: composer:${{ matrix.composer-version }}

Expand All @@ -330,13 +335,13 @@ jobs:
echo "::set-output name=timestamp::$(date +"%s")"
- name: Cache Composer dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache-vars.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.composer-version }}-${{ matrix.dependencies }}-${{ matrix.php-version }}-${{ steps.composer-cache-vars.outputs.timestamp }}
key: ${{ runner.os }}-composer-${{ matrix.composer-version }}-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ steps.composer-cache-vars.outputs.timestamp }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.composer-version }}-${{ matrix.dependencies }}-${{ matrix.php-version }}-
${{ runner.os }}-composer-${{ matrix.composer-version }}-${{ matrix.dependencies }}-
${{ runner.os }}-composer-${{ matrix.composer-version }}-${{ matrix.php-version }}-${{ matrix.dependencies }}-
${{ runner.os }}-composer-${{ matrix.composer-version }}-${{ matrix.php-version }}-
${{ runner.os }}-composer-${{ matrix.composer-version }}-
${{ runner.os }}-composer-
Expand All @@ -361,9 +366,33 @@ jobs:
if: always()
run: composer ci:php:unit

- name: Archive Logs
uses: actions/upload-artifact@v2
- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.composer-version }}-${{ matrix.php-version }}-${{ matrix.dependencies }}
run: |
composer exec phpcov -- merge --clover var/log/coverage/clover.xml var/log/coverage
composer global require ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} php-coveralls/php-coveralls
composer global exec php-coveralls -- --coverage_clover=var/log/coverage/clover.xml -vvv --json_path=var/log/coverage/coveralls-upload.json
- name: Upload Logs
uses: actions/upload-artifact@v3
if: always()
with:
name: logs
name: logs-composer-${{ matrix.composer-version }}-${{ matrix.php-version }}-${{ matrix.dependencies }}
path: var/log
retention-days: 7

coveralls-finish:
name: Finish Coveralls
needs:
- tests
runs-on: ubuntu-latest

steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
31 changes: 22 additions & 9 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
Expand All @@ -12,25 +11,39 @@
failOnRisky="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/bootstrap.php"
>
<coverage
cacheDirectory="var/cache/coverage"
>
<include>
<file>typo3-coding-standards</file>
<directory>src</directory>
</include>
<report>
<html outputDirectory="var/log/coverage/report"/>
<php outputFile="var/log/coverage/coverage.cov"/>
</report>
</coverage>
<testsuites>
<testsuite name="Coding Standards Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<!-- Compatibility with phpunit 8.5 -->
<filter>
<whitelist>
<file>./setup.php</file>
<directory>./src/</directory>
<file>typo3-coding-standards</file>
<directory>src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="var/log/report"/>
<log type="coverage-clover" target="var/log/coverage.xml"/>
<log type="coverage-php" target="var/log/coverage.serialized"/>
<!--log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/-->
<log type="junit" target="var/log/logfile.xml"/>
<junit outputFile="var/log/junit.xml"/>
<testdoxHtml outputFile="var/log/testdox.html"/>
<testdoxText outputFile="var/log/testdox.txt"/>
<!-- Compatibility with phpunit 8.5 -->
<log type="coverage-html" target="var/log/coverage/report"/>
<log type="coverage-php" target="var/log/coverage/coverage.cov"/>
<log type="junit" target="var/log/junit.xml"/>
<log type="testdox-html" target="var/log/testdox.html"/>
<log type="testdox-text" target="var/log/testdox.txt"/>
</logging>
Expand Down
34 changes: 0 additions & 34 deletions tests/bootstrap.php

This file was deleted.

0 comments on commit 131abc9

Please sign in to comment.