Skip to content

Commit a10a5e1

Browse files
author
David Ferlay
authored
Merge pull request #255 from skilld-labs/d8_dev
Replace drupal-check by Upgrade Status + Drupal Rector
2 parents 287f5c0 + 87e506a commit a10a5e1

File tree

8 files changed

+103
-11
lines changed

8 files changed

+103
-11
lines changed

.gitlab-ci.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ test:cinsp:
284284
<<: *ra_tags
285285
<<: *ra_only
286286

287-
test:drupalcheck:
287+
test:drupalrector:
288288
stage: tests
289289
environment:
290290
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
@@ -293,7 +293,22 @@ test:drupalcheck:
293293
script:
294294
- echo "Starting job script in ${BUILD_DIR}"
295295
- cd ${BUILD_DIR}
296-
- make drupalcheckval
296+
- make drupalrectorval
297+
dependencies:
298+
- deploy:review
299+
<<: *ra_tags
300+
<<: *ra_only
301+
302+
test:upgradestatus:
303+
stage: tests
304+
environment:
305+
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
306+
name: review/$CI_COMMIT_REF_NAME
307+
on_stop: stop_review
308+
script:
309+
- echo "Starting job script in ${BUILD_DIR}"
310+
- cd ${BUILD_DIR}
311+
- make upgradestatusval
297312
dependencies:
298313
- deploy:review
299314
<<: *ra_tags

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Add utility functions and scripts to the container
22
include scripts/makefile/*.mk
33

4-
.PHONY: all fast allfast provision si exec exec0 down clean dev drush info phpcs phpcbf hooksymlink clang cinsp compval watchdogval drupalcheckval behat sniffers tests front front-install front-build clear-front lintval lint storybook back behatdl behatdi browser_driver browser_driver_stop statusreportval contentgen newlineeof localize
4+
.PHONY: all fast allfast provision si exec exec0 down clean dev drush info phpcs phpcbf hooksymlink clang cinsp compval watchdogval drupalrectorval upgradestatusval behat sniffers tests front front-install front-build clear-front lintval lint storybook back behatdl behatdi browser_driver browser_driver_stop statusreportval contentgen newlineeof localize
55
.DEFAULT_GOAL := help
66

77
# https://stackoverflow.com/a/6273809/1826109

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@
5555
"drupal/config_inspector": "^1",
5656
"drupal/devel": "3.x-dev",
5757
"drupal/drupal-extension": "^3.4",
58+
"drupal/upgrade_status": "^2.6",
5859
"espend/behat-placeholder-extension": "^1.1",
5960
"genesis/behat-fail-aid": "^2.1",
60-
"mglaman/drupal-check": "^1.1"
61+
"palantirnet/drupal-rector": "^0.5.4"
6162
},
6263
"conflict": {
6364
"drupal/drupal": "*"
@@ -103,6 +104,9 @@
103104
}
104105
},
105106
"composer-exit-on-patch-failure": true,
107+
"patchLevel": {
108+
"drupal/core": "-p2"
109+
},
106110
"patches": {
107111
"drupal/core": {
108112
"Setting required on radios marks all options required": "https://www.drupal.org/files/issues/2019-07-30/2731991-42.patch",

rector.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
imports:
2+
- { resource: "vendor/palantirnet/drupal-rector/config/drupal-8/drupal-8-all-deprecations.yml" }
3+
# includes:
4+
# - { resource: "vendor/palantirnet/drupal-rector/config/drupal-8/drupal-8.0-deprecations.yml" }
5+
# - { resource: "vendor/palantirnet/drupal-rector/config/drupal-8/drupal-8.4-deprecations.yml" }
6+
# - { resource: "vendor/palantirnet/drupal-rector/config/drupal-8/drupal-8.5-deprecations.yml" }
7+
# - { resource: "vendor/palantirnet/drupal-rector/config/drupal-8/drupal-8.6-deprecations.yml" }
8+
# - { resource: "vendor/palantirnet/drupal-rector/config/drupal-8/drupal-8.7-deprecations.yml" }
9+
10+
parameters:
11+
autoload_paths:
12+
- 'web/core'
13+
- 'web/core/modules'
14+
- 'web/modules'
15+
- 'web/profiles'
16+
- 'web/themes'
17+
18+
exclude_paths:
19+
# If you would like to skip test directories, uncomment the following lines:
20+
# Upgrade status contains intentionally invalid code for their own tests.
21+
- 'web/modules/contrib/upgrade_status'
22+
# - '*/Tests/*'
23+
24+
file_extensions:
25+
- module
26+
- theme
27+
- install
28+
- profile
29+
- inc
30+
- engine
31+
32+
# Create `use` statements.
33+
auto_import_names: true
34+
# Do not convert `\Drupal` to `Drupal`, etc.
35+
import_short_classes: false
36+
# This will not import classes used in PHP DocBlocks, like in /** @var \Some\Class */
37+
import_doc_blocks: false
38+
39+
services: ~

scripts/makefile/config-inspector-validation.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ if [ "$ERROR_COUNT" -gt "0" ]; then
1212
echo -e "\nConfiguration is not valid : \n- Go to \033[1m/admin/config/development/configuration/inspect\033[0m for more details\n"
1313
exit 1
1414
else
15+
drush pmu config_inspector -y
1516
echo -e "Configuration is valid"
1617
exit 0
1718
fi

scripts/makefile/tests.mk

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,26 @@ else
8686
@echo "scripts/makefile/status-report-validation.sh file does not exist"
8787
endif
8888

89-
## Validate drupal-check
90-
drupalcheckval:
91-
@echo "Drupal-check validation..."
89+
## Validate drupal-rector
90+
drupalrectorval:
91+
ifneq ("$(wildcard rector.yml)","")
92+
@echo "Drupal Rector validation..."
9293
$(call php, composer install -o)
93-
$(call php, vendor/bin/drupal-check -V)
94-
$(call php, vendor/bin/drupal-check -ad -vv -n --no-progress web/modules/custom/)
94+
$(call php, vendor/bin/rector -V)
95+
$(call php, vendor/bin/rector process --dry-run --no-progress-bar web/modules/custom web/themes/custom)
96+
else
97+
@echo "rector.yml file does not exist"
98+
endif
99+
100+
## Validate upgrade-status
101+
upgradestatusval:
102+
ifneq ("$(wildcard scripts/makefile/upgrade-status-validation.sh)","")
103+
@echo "Upgrade status validation..."
104+
$(call php, composer install -o)
105+
@$(call php, /bin/sh ./scripts/makefile/upgrade-status-validation.sh)
106+
else
107+
@echo "scripts/makefile/upgrade-status-validation.sh file does not exist"
108+
endif
95109

96110
## Validate newline at the end of files
97111
newlineeof:
@@ -158,5 +172,5 @@ endif
158172
sniffers: | clang compval phpcs newlineeof
159173

160174
## Run all tests & validations (including sniffers)
161-
tests: | sniffers cinsp drupalcheckval behat watchdogval statusreportval
175+
tests: | sniffers cinsp drupalrectorval upgradestatusval behat watchdogval statusreportval
162176

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env sh
2+
3+
# Enable Upgrade Status module
4+
drush en -y upgrade_status
5+
6+
# Search for no issues message
7+
REPORT=$(drush us-a --all --ignore-contrib --ignore-uninstalled)
8+
IS_VALID=$(echo "$REPORT" | grep "No known issues found.")
9+
10+
# Exit1 and alert if message not found
11+
if [ -z "$IS_VALID" ]; then
12+
printf "There are \033[1missue(s)\033[0m in Upgrade Status report to fix : \n- Go to \033[1m/admin/reports/upgrade-status\033[0m for more details\n"
13+
echo -e "$REPORT"
14+
exit 1
15+
else
16+
drush pmu upgrade_status -y
17+
echo -e "Status report is valid : No error listed"
18+
exit 0
19+
fi

web/profiles/sdd/sdd.info.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: SDD
22
type: profile
33
description: 'Skill drupal development installation profile for content projects'
4-
core: 8.x
4+
core_version_requirement: ^8 || ^9
55

66
dependencies:
77
- automated_cron

0 commit comments

Comments
 (0)