-
Notifications
You must be signed in to change notification settings - Fork 15
/
bitbucket-pipelines.yml
70 lines (67 loc) · 3.29 KB
/
bitbucket-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.3.24
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
services:
docker:
memory: 2048
steps:
- step:
name: Deploy Staging
caches:
- composer
artifacts:
- vendor/**
script:
- php -v
- step: &analyze-sonarcloud
name: Analyze on SonarCloud
caches:
- sonar
- docker
script:
- pipe: sonarsource/sonarcloud-scan:1.2.1
variables:
SONAR_TOKEN: ${SONAR_TOKEN}
# EXTRA_ARGS: '-Dsonar.sources=src -Dsonar.tests=src -Dsonar.test.inclusions="**/testing/**,**/*.spec.ts" -Dsonar.typescript.lcov.reportPaths=coverage/lcov.info'
- step: &magento-code-check
name: Magento Code Check
caches:
- composer
artifacts:
- vendor/**
script:
- apt-get update && apt-get install -y git unzip libfreetype6-dev libjpeg-dev libpng-dev libzip-dev libonig-dev libicu-dev libsodium-dev
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
- docker-php-ext-configure intl
- docker-php-ext-install -j$(nproc) gd intl
- docker-php-ext-install bcmath zip sodium
- echo 'memory_limit = 2G' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini
- rm -rf ./composer.json
- composer require squizlabs/php_codesniffer
- composer require magento/magento-coding-standard
- composer require phpmd/phpmd
- composer require sebastian/phpcpd
#- php vendor/bin/phpcpd ./
#- php vendor/bin/phpmd ./ text cleancode,codesize,controversial,design,naming,unusedcode --exclude vendor/
#- php vendor/bin/phpcs --standard=PSR1 ./ --ignore=./vendor/*
- php vendor/bin/phpcs --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 --standard=PSR2 ./ --ignore=./vendor/*
- php vendor/bin/phpcs --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 --standard=vendor/magento/magento-coding-standard/Magento2/ruleset.xml --extensions=php,phtml ./ --ignore=./vendor/*
# Currently we run it for all branches and pull requests.
# Later we would split it up by "branches", where we would have image and script for "master" and same for "develop" and "feature/*" branches.
pipelines:
default:
- step: *analyze-sonarcloud
- step: *magento-code-check
pull-requests:
'develop/*':
- step: *analyze-sonarcloud
- step: *magento-code-check