Skip to content

Commit

Permalink
Add type coverage tests + report to otterwise
Browse files Browse the repository at this point in the history
  • Loading branch information
pelmered committed Sep 26, 2024
1 parent 3d7093b commit 57142ad
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .github/workflows/report-metrics.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
]
Expand Down

0 comments on commit 57142ad

Please sign in to comment.