Skip to content

Commit

Permalink
[PW-6785] - Coverage report for SonarCloud (#1665)
Browse files Browse the repository at this point in the history
* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Refactor phpunit.xml for configuration and main.yml for pipeline

* [PW-6785] - Add sonar-project.properties file

* [PW-6785] - Remove sonar analysis from CI

* [PW-6785] - Remove unnecessary dependencies

* [PW-6785] - Coverage test function

* [PW-6785] - Enable CI based sonar analysis

* [PW-6785] - Code formatting

* [PW-6785] - Temporarily disable PHP8.1 matrix

* [PW-6785] - Change allowed list for scan

* [PW-6785] - Change allowed list for scan

* [PW-6785] - Exclude vendor directory from sonar analysis

* [PW-6785] - Remove the filter for sonar analysis and include all the project files

* [PW-6785] - Revert commits 6f6ca5d and bd74dd3
  • Loading branch information
candemiralp authored and Morerice committed Aug 22, 2022
1 parent fcbd4f8 commit dbd8acd
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v1,
tools: composer:v1

- name: Test plugin installation
run: |
echo "{\"http-basic\":{\"repo.magento.com\":{\"username\":\"${MAGENTO_USERNAME}\",\"password\":\"${MAGENTO_PASSWORD}\"}}}" > auth.json
Expand All @@ -25,7 +26,19 @@ jobs:
CI: true
MAGENTO_USERNAME: ${{ secrets.MAGENTO_USERNAME }}
MAGENTO_PASSWORD: ${{ secrets.MAGENTO_PASSWORD }}

- name: Code Sniffer
run: vendor/bin/phpcs --extensions=php,phtml --error-severity=10 --ignore-annotations

- name: Run PHPUnit
run: vendor/bin/phpunit Test/Unit
run: vendor/bin/phpunit --coverage-clover=build/clover.xml --log-junit=build/tests-log.xml -c Test/phpunit.xml Test/Unit

- name: Fix code coverage paths
run: sed -i "s;`pwd`/;;g" build/*.xml

- name: SonarCloud Scan
if: ${{ env.SONAR_TOKEN }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
22 changes: 21 additions & 1 deletion Test/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,32 @@
-->
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="./bootstrap.php"
colors="true"
>
<php>
<ini name="display_errors" value="On"/>
<ini name="memory_limit" value="-1"/>
<ini name="max_execution_time" value="0"/>
<ini name="display_startup_errors" value="On"/>
<ini name="error_reporting" value="E_ALL"/>
<ini name="date.timezone" value="UTC"/>
<server name="SHELL_VERBOSITY" value="-1"/>
</php>

<testsuites>
<testsuite name="default">
<directory>.</directory>
</testsuite>
</testsuites>

<coverage processUncoveredFiles="false">
<include>
<directory suffix=".php">../.</directory>
</include>
<exclude>
<directory>../vendor</directory>
</exclude>
</coverage>
</phpunit>
6 changes: 6 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sonar.organization=adyen
sonar.projectKey=Adyen_adyen-magento2
sonar.sources=.
sonar.exclusions=vendor/**/*
sonar.php.coverage.reportPaths=build/clover.xml
sonar.php.tests.reportPath=build/tests-log.xml

0 comments on commit dbd8acd

Please sign in to comment.