From 96137d20b2b4c8606a9b8b9145d2d59b4c7a5fdd Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Thu, 2 Dec 2021 14:34:21 +0800 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9?= =?UTF-8?q?=D0=BA=D0=B0=20gh-actions=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20codecov.io?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++++++++++++++ .github/workflows/dev.yml | 25 ------------------ .github/workflows/master.yml | 25 ------------------ .gitignore | 1 + README.md | 12 ++++++--- composer.json | 2 +- 6 files changed, 59 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/dev.yml delete mode 100644 .github/workflows/master.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..766c2fe --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +# https://github.com/shivammathur/setup-php/blob/master/README.md + +name: CI + +on: + push: + branches: [ master, dev ] + pull_request: + branches: [ master, dev ] + +jobs: + Tests: + + runs-on: ubuntu-latest + + strategy: + matrix: + php-version: + - 8.0 + - 8.1 + + steps: + - uses: actions/checkout@v2 + + - name: Cache Composer dependencies + uses: actions/cache@v2 + with: + path: ~/.composer/cache + key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} + restore-keys: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- + + - name: Setup PHP v ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: json, curl, tokenizer, mbstring, xdebug + coverage: xdebug + tools: composer, phpunit + + - name: Install dependencies with composer + run: composer install --no-ansi --no-interaction --no-progress + + - name: Run tests with phpunit/phpunit + run: vendor/bin/phpunit --coverage-clover=coverage.xml --configuration=phpunit.xml + + - name: Send code coverage report to Codecov.io + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: bash <(curl -s https://codecov.io/bash) || true diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml deleted file mode 100644 index 7c70f41..0000000 --- a/.github/workflows/dev.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Dev build - -on: - push: - branches: [ dev ] - pull_request: - branches: [ dev ] - -jobs: - Tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Validate composer.json and composer.lock - uses: php-actions/composer@40-env - with: - version: 2 - php_version: 8.0 - only_args: --prefer-dist --no-progress - - - name: Run phpunit tests - uses: php-actions/phpunit@v9 - with: - configuration: ./phpunit.xml diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml deleted file mode 100644 index 0e0fd58..0000000 --- a/.github/workflows/master.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Master build - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - Tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Validate composer.json and composer.lock - uses: php-actions/composer@40-env - with: - version: 2 - php_version: 7.4 - only_args: --prefer-dist --no-progress - - - name: Run phpunit tests - uses: php-actions/phpunit@v8 - with: - configuration: ./phpunit.xml diff --git a/.gitignore b/.gitignore index 5bc0a5c..6ccbbdc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /config.php *cache* /test.php +/.coverage-report diff --git a/README.md b/README.md index be5999e..e218791 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,10 @@ [![Master build](https://github.com/anthonyaxenov/atol-online/actions/workflows/master.yml/badge.svg)](https://github.com/anthonyaxenov/atol-online/actions/workflows/master.yml) [![Dev build](https://github.com/anthonyaxenov/atol-online/actions/workflows/dev.yml/badge.svg)](https://github.com/anthonyaxenov/atol-online/actions/workflows/dev.yml) [![Latest Stable Version](http://poser.pugx.org/axenov/atol-online/v)](https://packagist.org/packages/axenov/atol-online) -[![Latest Unstable Version](http://poser.pugx.org/axenov/atol-online/v/unstable)](https://packagist.org/packages/axenov/atol-online) -[![Total Downloads](http://poser.pugx.org/axenov/atol-online/downloads)](https://packagist.org/packages/axenov/atol-online) +[![codecov](https://codecov.io/gh/anthonyaxenov/atol-online/branch/master/graph/badge.svg?token=WR2IV7FTF0)](https://codecov.io/gh/anthonyaxenov/atol-online) [![License](http://poser.pugx.org/axenov/atol-online/license)](https://packagist.org/packages/axenov/atol-online) + + Библиотека для фискализации чеков по 54-ФЗ через [облачную ККТ АТОЛ](https://online.atol.ru/). @@ -63,12 +64,15 @@ Файлы тестов находятся в директории `/tests` корня репозитория. -Для запуска тестов необходимо перейти в корень вашего проекта и выполнить команду: +Для запуска тестов необходимо перейти в корень репозитория и выполнить одну из команд: ```bash -composer test +composer test # обычное тестирование +composer test-cov # тестирование с покрытием ``` +После тестирования с покрытием создаётся отчёт в директории `.coverage-report` в корне репозитория. + ## Использование библиотеки Весь исходный код находится в директории [`/src`](/src). diff --git a/composer.json b/composer.json index ca6be48..c78cdf8 100644 --- a/composer.json +++ b/composer.json @@ -73,6 +73,6 @@ }, "scripts": { "test": "vendor/bin/phpunit --colors=always", - "test-cov": "vendor/bin/phpunit --coverage-html coverage" + "test-cov": "php -dxdebug.mode=coverage vendor/bin/phpunit --coverage-html .coverage-report" } }