diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4135755..b2f159c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,9 +17,9 @@ on: workflow_dispatch: env: - default-php-version: '8.1' - default-laravel-version: '9.*' - semantic-node-version: 16 + default-php-version: '8.2' + default-laravel-version: '10.*' + semantic-node-version: 18 jobs: tests: @@ -56,6 +56,7 @@ jobs: php-version: ${{ matrix.php-version }} coverage: pcov extensions: sqlite3, gmp + ini-values: pcov.directory=., pcov.exclude="~vendor~" - name: Check PHP Version run: php -v - name: Check Composer Version @@ -114,9 +115,10 @@ jobs: - name: Fix results files run: sed -i -e "s%$GITHUB_WORKSPACE/%%g" *.xml working-directory: results + if: success() || failure() - name: Store results - if: matrix.php-version == env.default-php-version && matrix.laravel-version == env.default-laravel-version + if: matrix.php-version == env.default-php-version && matrix.laravel-version == env.default-laravel-version && (success() || failure()) uses: actions/upload-artifact@v3 with: name: results @@ -129,9 +131,7 @@ jobs: reporting: needs: tests runs-on: ubuntu-latest - strategy: - matrix: - php-version: ['8.2'] + if: success() || failure() steps: - name: Checkout repository @@ -145,6 +145,12 @@ jobs: name: results path: results + - name: Merge junit files + run: | + npm init -y + yarn set version berry + yarn dlx junit-report-merger ./results/results.xml "./results/results*.xml" + - name: Set coverage list id: coverage run: | @@ -159,7 +165,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} with: args: | - -Dsonar.php.tests.reportPath=./results/results_guzzle.xml + -Dsonar.php.tests.reportPath=./results/results.xml -Dsonar.php.coverage.reportPaths=${{ steps.coverage.outputs.list }} diff --git a/phpunit.xml b/phpunit.xml index 3ec5db3..4b2aa04 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,11 +1,15 @@ - - + - + ./tests + diff --git a/sonar-project.properties b/sonar-project.properties index 0afd214..fc1045d 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,8 +6,8 @@ sonar.organization=asbiin-github # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. # This property is optional if sonar.modules is set. -sonar.sources=src -#sonar.exclusions= +sonar.sources=src,config,database,routes +sonar.coverage.exclusions=config/*.php,database/**/*.php,routes/*.php sonar.tests=tests # Encoding of the source code. Default is default system encoding @@ -17,6 +17,3 @@ sonar.sourceEncoding=UTF-8 sonar.links.ci=https://github.com/asbiin/laravel-webauthn/actions sonar.links.scm=https://github.com/asbiin/laravel-webauthn sonar.links.issue=https://github.com/asbiin/laravel-webauthn/issues - -sonar.php.tests.reportPath=./results/results.xml -sonar.php.coverage.reportPaths=./results/coverage.xml