From d006bb5fcd36c81be8936b58eb21f3f69effa2c8 Mon Sep 17 00:00:00 2001 From: Aidan Casey Date: Mon, 25 Nov 2024 23:29:32 -0500 Subject: [PATCH 1/2] ci: cleanup unit test coverage --- .github/workflows/integration-tests.yml | 16 ++++++------ .github/workflows/isolated-tests.yml | 34 ++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index d67bf2c90..74ae842a9 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -64,12 +64,12 @@ jobs: run: php ./tempest discovery:status - name: Execute tests - run: vendor/bin/phpunit --coverage-clover build/reports/clover.xml + run: vendor/bin/phpunit - # Only upload coverage once. - - if: matrix.php == '8.3' && matrix.database == 'sqlite' && matrix.os == 'ubuntu-latest' && matrix.stability == 'prefer-stable' - name: Coveralls - uses: coverallsapp/github-action@v2 - with: - github-token: '${{ secrets.GITHUB_TOKEN }}' - file: build/reports/clover.xml \ No newline at end of file +# # Only upload coverage once. +# - if: matrix.php == '8.3' && matrix.database == 'sqlite' && matrix.os == 'ubuntu-latest' && matrix.stability == 'prefer-stable' +# name: Coveralls +# uses: coverallsapp/github-action@v2 +# with: +# github-token: '${{ secrets.GITHUB_TOKEN }}' +# file: build/reports/clover.xml \ No newline at end of file diff --git a/.github/workflows/isolated-tests.yml b/.github/workflows/isolated-tests.yml index 7df9e008b..173a878d5 100644 --- a/.github/workflows/isolated-tests.yml +++ b/.github/workflows/isolated-tests.yml @@ -73,4 +73,36 @@ jobs: composer update --${{ matrix.stability }} --prefer-dist --no-interaction - name: Execute tests - run: phpunit -c "src/Tempest/${{ matrix.package.basename }}/phpunit.xml" \ No newline at end of file + run: phpunit -c "src/Tempest/${{ matrix.package.basename }}/phpunit.xml" --coverage-clover build/reports/clover.xml + + # Only upload coverage once + - if: matrix.php == '8.4' && matrix.os == 'ubuntu-latest' && matrix.stability == 'prefer-stable' + name: Upload coverage results to Coveralls + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + file: build/reports/clover.xml + flag-name: "Unit-${{ matrix.package.name }}" + + finish: + needs: + - get_packages + - phpunit + runs-on: ubuntu-latest + steps: + - name: Get Package Flags + id: get-package-flags + run: | + packages=$(echo '${{ needs.get_packages.outputs.matrix }}' | jq -r '.[].name') + + # Prepend "Unit-" to each .name value and join with commas + result=$(for package in $packages; do echo -n "Unit-$package,"; done | sed 's/,$//') + + echo "Result: $result" + + echo "packages=$result" >> $GITHUB_OUTPUT + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true + carryforward: ${{ steps.get-package-flags.outputs.packages }} \ No newline at end of file From ad472a6a16487d8ebc4985818b7d40414b74687f Mon Sep 17 00:00:00 2001 From: Aidan Casey Date: Mon, 25 Nov 2024 23:46:14 -0500 Subject: [PATCH 2/2] ci: cleanup unit test coverage --- .github/workflows/isolated-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/isolated-tests.yml b/.github/workflows/isolated-tests.yml index 173a878d5..85cb62e30 100644 --- a/.github/workflows/isolated-tests.yml +++ b/.github/workflows/isolated-tests.yml @@ -76,7 +76,7 @@ jobs: run: phpunit -c "src/Tempest/${{ matrix.package.basename }}/phpunit.xml" --coverage-clover build/reports/clover.xml # Only upload coverage once - - if: matrix.php == '8.4' && matrix.os == 'ubuntu-latest' && matrix.stability == 'prefer-stable' + - if: matrix.php == '8.3' && matrix.os == 'ubuntu-latest' && matrix.stability == 'prefer-stable' name: Upload coverage results to Coveralls uses: coverallsapp/github-action@v2 with: