From f799eca6ded0d7f99fe4d1dadae03feb9b933b70 Mon Sep 17 00:00:00 2001 From: Ne-Lexa Date: Mon, 22 Feb 2021 20:24:13 +0300 Subject: [PATCH] update github actions build --- .github/workflows/build.yml | 26 +++++++++++-- .scrutinizer.yml | 76 ++++++++++++++++++------------------- 2 files changed, 61 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc406be..be8b354 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,8 +9,9 @@ jobs: name: PHP ${{ matrix.php }} Test on ${{ matrix.os }} env: - extensions: bz2, dom, iconv, fileinfo, openssl, xml, zlib - key: cache-v1 + extensions: bz2, dom, iconv, fileinfo, openssl, xml, zlib + key: cache-v1 + PHPUNIT_COVERAGE: 0 strategy: matrix: @@ -48,6 +49,11 @@ jobs: if: matrix.os == 'ubuntu-latest' run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV + - + name: Set coverage args + if: matrix.os == 'ubuntu-latest' && matrix.php == '8.0' + run: echo "PHPUNIT_COVERAGE=1" >> $GITHUB_ENV + - name: Determine composer cache directory on Windows if: matrix.os == 'windows-latest' @@ -83,4 +89,18 @@ jobs: - name: Run tests with phpunit - run: vendor/bin/phpunit --colors=always + if: env.PHPUNIT_COVERAGE == 0 + run: vendor/bin/phpunit -v + + - + name: Run tests with phpunit and coverage + if: env.PHPUNIT_COVERAGE == 1 + run: vendor/bin/phpunit -v --coverage-clover=coverage.clover + + - + name: Upload code coverage scrutinizer + if: env.PHPUNIT_COVERAGE == 1 + run: | + wget https://scrutinizer-ci.com/ocular.phar + php ocular.phar code-coverage:upload --format=php-clover coverage.clover + diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 4ed7e67..0aa5464 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,43 +1,43 @@ -filter: - paths: ["src/*"] - excluded_paths: ["vendor/*", "tests/*"] - checks: - php: - code_rating: true - duplication: true + php: true + +filter: + paths: [ "src/*" ] + excluded_paths: [ "vendor/*", "tests/*" ] tools: - external_code_coverage: false + external_code_coverage: false build: - environment: - php: - version: 7.4 - pecl_extensions: - - zip - mysql: false - node: false - postgresql: false - mongodb: false - elasticsearch: false - redis: false - memcached: false - neo4j: false - rabbitmq: false - nodes: - analysis: - tests: - override: - - php-scrutinizer-run - dependencies: - before: - - composer self-update - - composer update --no-interaction --prefer-dist --no-progress - tests: - before: - - - command: composer test:coverage - coverage: - file: 'build/logs/clover.xml' - format: 'clover' + environment: + php: + version: 8.0 + pecl_extensions: + - zip + mysql: false + node: false + postgresql: false + mongodb: false + elasticsearch: false + redis: false + memcached: false + neo4j: false + rabbitmq: false + nodes: + analysis: + environment: + php: 8.0 + tests: + override: + - php-scrutinizer-run + dependencies: + before: + - composer self-update + - composer update --no-interaction --prefer-dist --no-progress + tests: + before: + - + command: composer test:coverage + coverage: + file: 'build/logs/clover.xml' + format: 'clover'