From 6cd5d5f48c26bdffaa972e947499d3ef01e4d0f6 Mon Sep 17 00:00:00 2001 From: Andrey Postal Date: Mon, 31 Mar 2025 13:29:48 -0300 Subject: [PATCH] Add test coverage action --- .github/workflows/tests.yml | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..3c9cd11 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,48 @@ +name: "Tests" + +on: + push: + branches: + - 'main' + pull_request: + +permissions: + contents: read + +jobs: + tests: + name: "Package Tests" + runs-on: ubuntu-22.04 + continue-on-error: false + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + with: + ref: ${{ github.event.pull_request.head.ref }} + fetch-depth: 100 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + ini-values: "memory_limit=-1,display_errors=1" + php-version: "8.3" + coverage: "pcov" + + - name: "Install Dependencies" + run: "composer install" + + - name: "Run Tests" + run: "vendor/bin/phpunit --coverage-clover /tmp/${{ github.sha }}_coverage.xml" + + - uses: "actions/upload-artifact@v4" + with: + name: "tests_coverage" + path: "/tmp/${{ github.sha }}_coverage.xml" + retention-days: 1 + + - name: "Coveralls" + uses: "coverallsapp/github-action@v2" + with: + github-token: ${{ secrets.COVERALLS_REPO_TOKEN }} + file: "/tmp/${{ github.sha }}_coverage.xml"