-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.yml
147 lines (130 loc) · 5.08 KB
/
config.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# This CircleCI configuration is for testing the-build itself. For the configuration
# installed in projects, see defaults/install/.circleci/config.yml
version: 2.1
jobs:
build:
working_directory: ~/project
docker:
- image: cimg/php:8.3-browsers
- image: cimg/mysql:5.7
command: --max_allowed_packet=16M
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD: ''
MYSQL_DATABASE: circle_test
environment:
- PALANTIR_ENVIRONMENT: circleci
- DRUPAL_ROOT: docroot
steps:
- run:
name: Install packages
command: |
sudo apt-get update && sudo apt-get install -y libpng-dev default-mysql-client
- run:
name: Configure PHP
command: |
echo "sendmail_path=/bin/true" | sudo tee -a "/etc/php.d/circleci.ini"
- run:
name: Update Composer
command: |
sudo composer self-update
# Run code quality checks
- checkout
- run:
name: Run code reviews
command: |
composer install
echo "phpcs for modules"
vendor/bin/phpcs defaults/standard/modules --standard="Drupal,DrupalPractice" -n --extensions="php,module,inc,install,test,profile,theme"
echo "phpmd for modules"
vendor/bin/phpmd defaults/standard/modules text defaults/standard/phpmd.xml --suffixes php,inc,module,theme,profile,install,test
echo "phpstan for modules"
vendor/bin/phpstan analyse defaults/standard/modules --level=2
echo "phpcs for tasks"
vendor/bin/phpcs src --standard="Drupal,DrupalPractice" -n --extensions="php,module,inc,install,test,profile,theme"
echo "phpmd for tasks"
vendor/bin/phpmd src text defaults/standard/phpmd.xml --suffixes php,inc,module,theme,profile,install,test
echo "phpstan for tasks"
vendor/bin/phpstan analyse -c phpstan.neon
# Install a drupal test project.
- run:
name: Create artifacts directory
command: mkdir /tmp/artifacts
- run:
name: Configure URL in /etc/hosts
command: echo 127.0.0.1 example.ddev.site | sudo tee -a /etc/hosts
# Composer package cache
- restore_cache:
keys:
- composer-v1-
# Source cache
- restore_cache:
keys:
- source-v1-{{ .Branch }}
- source-v1-
# Create a new project using the drupal-skeleton project
- run:
name: Create a new Drupal project
command: composer create-project palantirnet/drupal-skeleton example dev-develop --no-interaction
working_directory: ~/
# Use this copy of the-build
- run:
name: Replace the default version of the-build with this one
command: composer require --dev --with-all-dependencies palantirnet/the-build:dev-${CIRCLE_BRANCH}
working_directory: ~/example
# Source cache - update when branch changes
- save_cache:
key: source-v1-{{ .Branch }}
paths:
- ".git"
# Install the-build
- run:
name: Install the-build in the project
command: printf '\n\n\nn' | vendor/bin/the-build-installer
working_directory: ~/example
- run:
name: Wait for DB
# Dockerize is preinstalled in circleci/* docker image
command: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
working_directory: ~/example
# Install Drupal (separately, so that we can see it fail separately)
- run:
name: Install Drupal
command: printf 'y' | vendor/bin/phing install -Ddrupal.validate_clean_config.bypass=yes
working_directory: ~/example
# Composer package cache - update when the contents of the Composer cache directory
# change. This cache is saved after installing Drupal, as the install process uses
# composer to add a few modules.
- run: ls -1R ~/.cache/composer/ > /tmp/composer-cache.txt
- save_cache:
key: composer-v1-{{ checksum "/tmp/composer-cache.txt" }}
paths:
- ~/.cache/composer
# Add a multisite
- run:
name: Add a multisite to the project
command: printf 'intranet\nintranet.example.ddev.site' | vendor/bin/phing drupal-add-multisite
working_directory: ~/example
- run:
name: Run Behat tests
command: |
cd ${DRUPAL_ROOT}
nohup php -S example.ddev.site:8000 .ht.router.php > /tmp/artifacts/phpd.log 2>&1 &
google-chrome --headless --remote-debugging-port=9222 &>/dev/null &
cd ..
vendor/bin/phing test -Dbuild.env=circleci
working_directory: ~/example
- store_artifacts:
path: /tmp/artifacts
- store_test_results:
path: /tmp/artifacts
workflows:
version: 2
build:
jobs:
- build:
filters:
branches:
ignore:
- gh-pages
- /.*(readme|documentation).*/