We have our projects in Bitbucket Repositories and we are using Bitbucket Pipelines to run our PHPUnit tests and allow SonarCloud scanning and validating our code for all Pull Requests.
Here’s my bitbucket-pipelines.yml file:
image: williamyeh/ansible:ubuntu18.04 pipelines: custom: ... pull-requests: '**': - step: name: Run tests and Generate coverage reports image: epcallan/php7-testing-phpunit:7.2-phpunit7 caches: - composer script: - composer install --no-progress --no-suggest - vendor/bin/phpunit - step: name: Sonar check quality code script: - pipe: sonarsource/sonarcloud-scan:1.0.0 variables: EXTRA_ARGS: -Dsonar.projectDescription=\"Project with sonarcloud-scan pipe\" -Dsonar.eslint.reportPaths=\"report.json\" -Dsonar.php.coverage.reportPaths=\"codeCoverage/coverage.xml\" -Dsonar.php.tests.reportPath=\"codeCoverage/test.xml\" SONAR_SCANNER_OPTS: -Xmx512m DEBUG: "false"
As you can see, I’m loading an image that has phpunit and Xdebug (because with other images was throwing an Error: No code coverage driver is available while doing the
With this image the Bitbucket Pipeline did run
vendor/bin/phpunit but with really different results as in my Localhost and did not run the last step.
We have written our tests and generating reports correctly on Localhost but no chance to make it work with Bitbucket Pipelines and Sonarcloud.
Here are the results on both places:
In SonarCloud Dashboard we are having 0.0% Coverage.
Anyone know how to make this work?
...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events