From 57142ad7e4c2525e26cd0ca52ff14642354a11c4 Mon Sep 17 00:00:00 2001 From: Peter Elmered Date: Thu, 26 Sep 2024 18:06:33 +0200 Subject: [PATCH] Add type coverage tests + report to otterwise --- .github/workflows/report-metrics.yml | 31 ++++++++++++++++++++++++++++ .github/workflows/run-tests.yml | 4 ++++ composer.json | 6 +++++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/report-metrics.yml diff --git a/.github/workflows/report-metrics.yml b/.github/workflows/report-metrics.yml new file mode 100644 index 0000000..4950ed0 --- /dev/null +++ b/.github/workflows/report-metrics.yml @@ -0,0 +1,31 @@ +name: report-metrics + +on: + workflow_dispatch: + push: + +jobs: + test: + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo + coverage: pcov + - name: Install dependencies + run: composer update --prefer-stable --prefer-dist --no-interaction + - name: Execute tests + run: vendor/bin/pest --coverage-clover=coverage.xml + - name: Execute type coverage tests + run: vendor/bin/pest --type-coverage --type-coverage-json=pest-coverage.json + + - name: Upload coverage results + run: | + bash <(curl -s https://raw.githubusercontent.com/getOtterWise/bash-uploader/main/uploader.sh) --repo-token ${{ secrets.OTTERWISE_TOKEN }} + bash <(curl -s https://raw.githubusercontent.com/getOtterWise/bash-uploader/main/uploader.sh) --type-coverage-file pest-coverage.json diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 647860a..44d7d64 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -34,3 +34,7 @@ jobs: run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction - name: Execute tests run: vendor/bin/pest --coverage-clover=coverage.xml + + - name: Upload coverage results + run: bash <(curl -s https://raw.githubusercontent.com/getOtterWise/bash-uploader/main/uploader.sh) --repo-token ${{ secrets.OTTERWISE_TOKEN }} + bash <(curl -s https://raw.githubusercontent.com/getOtterWise/bash-uploader/main/uploader.sh) --type-coverage-file pest-coverage.json diff --git a/composer.json b/composer.json index cdbf623..c57895d 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,8 @@ "pestphp/pest": "^3.0", "pestphp/pest-plugin-drift": "3.x-dev", "phpstan/phpstan": "^1.12", - "laravel/pint": "^1.18" + "laravel/pint": "^1.18", + "pestphp/pest-plugin-type-coverage": "^3.0" }, "autoload": { "psr-4": { @@ -50,6 +51,9 @@ "test-coverage": [ "./vendor/bin/pest --coverage-text" ], + "types": [ + "./vendor/bin/pest --type-coverage" + ], "all": [ "composer run test && composer run test-coverage && composer run phpmd && composer run codemetrics" ]