-
-
Save Gojeflone/cdb1ef03758ee118bbc66fe7b6e304e1 to your computer and use it in GitHub Desktop.
SonarCloud YAML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: php:7.1.1 | |
clone: | |
depth: full # SonarCloud scanner needs the full history to assign issues properly | |
definitions: | |
caches: | |
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build | |
steps: | |
- step: &install-php-extensions | |
name: Install PHP Extensions | |
script: | |
# Installing first the libraries necessary to configure and install gd | |
- apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev | |
# Now we can configure and install the extension | |
- docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ | |
- docker-php-ext-install -j$(nproc) gd | |
- step: &install-composer | |
name: Install dependencies | |
caches: | |
- composer # See https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html | |
script: | |
- apt-get update && apt-get install -y unzip | |
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
- composer require monolog/monolog | |
- composer require phpunit/phpunit | |
- composer install | |
# - vendor/bin/phpunit | |
services: | |
- docker | |
- step: &build-test-sonarcloud | |
name: Build, test and analyze on SonarCloud | |
caches: | |
- sonar | |
- composer | |
size: 2x # Double Resources available for this step | |
script: # Build your project and run | |
- pipe: sonarsource/sonarcloud-scan:1.0.1 | |
variables: | |
DEBUG: "true" #Optional | |
services: | |
- docker | |
- step: &check-quality-gate-sonarcloud | |
name: Check the Quality Gate on SonarCloud | |
script: | |
- pipe: sonarsource/sonarcloud-quality-gate:0.1.2 | |
services: | |
docker: | |
memory: 7128 | |
options: | |
size: 2x # Allocates twice the amount of memory globally | |
pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html | |
branches: | |
develop: | |
- step: *install-php-extensions | |
- step: *install-composer | |
- step: *build-test-sonarcloud | |
- step: *check-quality-gate-sonarcloud | |
pull-requests: | |
'**': | |
- step: *install-php-extensions | |
- step: *install-composer | |
- step: *build-test-sonarcloud | |
- step: *check-quality-gate-sonarcloud |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment