How can I analyze a PHP project that doesn’t have a “Build” stage? I have the following pipeline:
trigger:
branches:
include:
- '*'
pool:
vmImage: 'ubuntu-latest'
variables:
# Sonar-related variables
SONARQUBE_ENDPOINT: 'myConnection'
PROJECT_KEY: 'myKey'
PROJECT_NAME: MyProject'
PROJECT_VERSION: '1.0'
steps:
- task: SonarQubePrepare@7
displayName: "Prepare SonarQube analysis"
inputs:
SonarQube: $(SONARQUBE_ENDPOINT)
scannerMode: 'Other'
configMode: 'manual'
# Sonar project information
sonarProjectKey: $(PROJECT_KEY)
sonarProjectName: $(PROJECT_NAME)
sonarProjectVersion: $(PROJECT_VERSION)
extraProperties: |
sonar.sources=src
sonar.language=php
# If you have test coverage reports, specify paths
# e.g. from phpunit
sonar.php.coverage.reportPaths=build/coverage/clover.xml
sonar.exclusions=**/*.html,**/*.css,**/*.js
#- script: |
# echo "Install composer dependencies"
# composer install
# echo "Run unit tests with coverage"
# ./vendor/bin/phpunit --coverage-clover build/coverage/clover.xml
# displayName: "Build and Test"
- task: SonarQubeAnalyze@7
displayName: "Run SonarQube Analysis"
- task: SonarQubePublish@7
displayName: "Publish SonarQube Quality Gate Result"
inputs:
pollingTimeoutSec: '600' # Adjust if your project is large
and it doesn’t fail but at the same at the “Publish” stage it says that there’s no analysis to publish