Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: replace Codecov with SonarCloud scan #129

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
/.gitignore
/.stylelintrc.json
/.travis.yml
/clover.xml
/composer.json
/package.json
/package-lock.json
/composer.lock
/phpcs.xml
/phpunit.xml

/sonar-project.properties
/tests-clover.xml
/tests-junit.xml
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
/package-lock.json export-ignore
/phpcs.xml export-ignore
/phpunit.xml export-ignore
/sonar-project.properties export-ignore
16 changes: 12 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Test
on: push
on: [ push, pull_request ]
jobs:
unit:
runs-on: ubuntu-latest
Expand All @@ -9,6 +9,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -17,10 +19,16 @@ jobs:
- name: Install
run: composer install --no-interaction
- name: Unit tests
run: composer test
- name: Coverage Report
run: |
composer test
sed -i 's#'$GITHUB_WORKSPACE'#/github/workspace#g' tests-*.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
if: matrix.php == '8.1'
uses: codecov/codecov-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

quality:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ js/*.min.js
vendor/
node_modules/
.phpunit.result.cache
clover.xml
tests-*.xml
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"minifyjs js/script.js > js/script.min.js"
],
"test": [
"phpunit --coverage-clover clover.xml"
"phpunit"
]
},
"config": {
Expand Down
7 changes: 7 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@
<file>./antivirus.php</file>
<directory suffix=".php">./inc/</directory>
</include>
<report>
<clover outputFile="tests-clover.xml"/>
</report>
</coverage>

<logging>
<junit outputFile="tests-junit.xml"/>
</logging>

<testsuites>
<testsuite name="AntiVirus TestSuite">
<directory prefix="test-" suffix=".php">tests/</directory>
Expand Down
9 changes: 9 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sonar.organization=pluginkollektiv
sonar.projectKey=pluginkollektiv_antivirus

sonar.sources=inc,js,css,antivirus.php

sonar.tests=tests

sonar.php.tests.reportPath=tests-junit.xml
sonar.php.coverage.reportPaths=tests-clover.xml
Loading