diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0691b6896..6a2f998b3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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 }} diff --git a/Test/phpunit.xml b/Test/phpunit.xml index 15e8cb216..590d23719 100644 --- a/Test/phpunit.xml +++ b/Test/phpunit.xml @@ -10,12 +10,32 @@ --> + + + + + + + + + + . + + + + ../. + + + ../vendor + + diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..b7ff9ca0b --- /dev/null +++ b/sonar-project.properties @@ -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