Skip to content

Commit

Permalink
Add major version toggle for Drupal
Browse files Browse the repository at this point in the history
  • Loading branch information
andytson-inviqa committed Mar 17, 2023
1 parent 6b84493 commit d572ffa
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 16 deletions.
15 changes: 14 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipeline {
}
stage('Build and Test') {
parallel {
stage('1. PHP, Drupal 8, Akeneo, Wordpress') {
stage('1. PHP, Drupal, Akeneo, Wordpress') {
// Choose a different agent to our "main" one
agent {
docker {
Expand Down Expand Up @@ -53,6 +53,7 @@ pipeline {
}
steps {
sh './test php static'
sh './test drupal9 static'
sh './test drupal8 static'
sh './test akeneo6 static'
sh './test akeneo5 static'
Expand Down Expand Up @@ -82,6 +83,10 @@ pipeline {
when { expression { return isHarnessChange(['base']) } }
steps { sh './test php static' }
}
stage('Drupal 9') {
when { expression { return isHarnessChange(['drupal8']) } }
steps { sh './test drupal9 static' }
}
stage('Drupal 8') {
when { expression { return isHarnessChange(['drupal8']) } }
steps { sh './test drupal8 static' }
Expand All @@ -107,6 +112,10 @@ pipeline {
when { expression { return isHarnessChange(['base']) } }
steps { sh './test php dynamic' }
}
stage('Drupal 9 Dynamic') {
when { expression { return isHarnessChange(['drupal8']) } }
steps { sh './test drupal9 dynamic' }
}
stage('Drupal 8 Dynamic') {
when { expression { return isHarnessChange(['drupal8']) } }
steps { sh './test drupal8 dynamic' }
Expand All @@ -132,6 +141,10 @@ pipeline {
when { expression { return isHarnessChange(['base']) } }
steps { sh './test php dynamic mutagen' }
}
stage('Drupal 9 Mutagen') {
when { expression { return isHarnessChange(['drupal8']) } }
steps { sh './test drupal9 dynamic mutagen' }
}
stage('Drupal 8 Mutagen') {
when { expression { return isHarnessChange(['drupal8']) } }
steps { sh './test drupal8 dynamic mutagen' }
Expand Down
72 changes: 60 additions & 12 deletions src/drupal8/application/skeleton/composer.json.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"bin-dir": "bin/",
"sort-packages": true,
"platform": {
"php": "8.0.23"
"php": "{{ @('php.version') }}"
},
"allow-plugins": {
"cweagans/composer-patches": true,
Expand All @@ -31,6 +31,7 @@
}
},
"require": {
{% if version_compare(@('drupal.major_version'), '9', '>=') %}
"php": ">= 8.0",
"composer/installers": "^2.1",
"cweagans/composer-patches": "^1.7",
Expand Down Expand Up @@ -64,26 +65,69 @@
"drush/drush": "^11.1",
"fenetikm/autoload-drupal": "dev-master#4503484bf2d78e6d739fe13324ab3e6b96d7c244",
"oomphinc/composer-installers-extender": "^2.0"
{% else %}
"php": ">= 7.4",
"composer/installers": "^1.0",
"cweagans/composer-patches": "^1.5.0",
"drupal/admin_toolbar": "^1.0",
"drupal/core-composer-scaffold": "~8.9",
"drupal/core-recommended": "~8.9",
"drupal/ctools": "^3.0",
"drupal/environment_indicator": "^3.0",
"drupal/field_group": "^3.0@beta",
"drupal/hook_event_dispatcher": "^1.20",
{% if @('services.varnish.enabled') %}
"drupal/http_cache_control": "^2.0",
{% endif %}
"drupal/inline_entity_form": "^1.0-rc1",
"drupal/linkit": "^4.3.0",
"drupal/login_emailusername": "1.1",
"drupal/menu_admin_per_menu": "1.0",
"drupal/metatag": "1.7",
"drupal/pathauto": "^1.8",
"drupal/purge": "^3.0",
"drupal/redirect": "1.3",
"drupal/roleassign": "^1.0@alpha",
"drupal/seckit": "1.1",
"drupal/stage_file_proxy": "^1.0@alpha",
"drupal/taxonomy_access_fix": "2.6",
"drupal/token": "1.5",
"drupal/ultimate_cron": "~2.0.0@alpha",
{% if @('services.varnish.enabled') %}
"drupal/varnish_purge": "^2.0",
{% endif %}
"drush/drush": "^8",
"fenetikm/autoload-drupal": "dev-master#4503484bf2d78e6d739fe13324ab3e6b96d7c244",
"oomphinc/composer-installers-extender": "^2.0"
{% endif %}
},
"require-dev": {
"behat/behat": "^3.10",
"behat/mink-extension": "^2.3",
"behat/mink-goutte-driver": "^1.2",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"behat/behat": "^3.7",
"friends-of-behat/mink-extension": "^2.7",
"behat/mink-goutte-driver": "^1.3",
"dmore/behat-chrome-extension": "^1.4",
"dmore/chrome-mink-driver": "^2.9",
{% if version_compare(@('drupal.major_version'), '9', '>=') %}
"drupal/core-dev": "^9.4",
"drupal/devel": "^4.1",
"drupal/drupal-extension": "^4.2",
"phpunit/phpunit": "^9.6",
"phpspec/prophecy-phpunit": "^2",
{% else %}
"drupal/core-dev": "~8.9",
"drupal/devel": "^2.0",
"drupal/drupal-extension": "^3.4",
"phpunit/phpunit": "^7.5",
"phpspec/prophecy-phpunit": "^1.1",
{% endif %}
"jangregor/phpstan-prophecy": "^1.0",
"mglaman/drupal-check": "^1.1",
"mglaman/phpstan-drupal": "^1.0",
"mikey179/vfsstream": "^1.0",
"phpcompatibility/php-compatibility": "dev-develop",
"phpcsstandards/phpcsutils": "1.0.0-alpha4",
"phpspec/prophecy-phpunit": "^2",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpunit/phpunit": "^9.0",
"phpcsstandards/phpcsutils": "^1.0",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-deprecation-rules": "^1.1",
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
Expand Down Expand Up @@ -132,7 +176,9 @@
"autoload-drupal": {
"modules": [
"docroot/core/modules/",
{% if version_compare(@('drupal.major_version'), '9', '>=') %}
"docroot/core/themes/claro/",
{% endif %}
"docroot/themes/contrib/",
"docroot/themes/custom/",
"docroot/profiles/contrib/",
Expand All @@ -149,11 +195,13 @@
"docroot/modules/contrib/purge/modules/",
"docroot/modules/contrib/redirect/modules/",
"docroot/modules/contrib/varnish_purge/modules/"
],
]
{%- if version_compare(@('drupal.major_version'), '9', '>=') %},
"classmap": [
"docroot/core/themes/claro/src",
"docroot/core/themes/olivero/src"
]
{% endif %}
},
"drupal-scaffold": {
"locations": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ parameters:
paths:
- docroot/modules/custom
scanFiles:
{% if version_compare(@('drupal.major_version'), '9', '>=') %}
- docroot/core/tests/Drupal/Tests/PhpUnitCompatibilityTrait.php
{% else %}
- docroot/core/tests/Drupal/Tests/PhpunitCompatibilityTrait.php
{% endif %}
3 changes: 2 additions & 1 deletion src/drupal8/harness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ attributes:
drupal:
salt: 2tkqCCRKy5rT4wMVz8KTCh8r3sJGkL5v
docroot: docroot
major_version: 9
nginx:
php_fpm:
conf:
Expand Down Expand Up @@ -71,7 +72,7 @@ attributes:
cli:
ini:
opcache.file_cache_only: '0'
version: '8.0'
version: "= version_compare(@('drupal.major_version'), '9', '>=') ? '8.0' : '7.4'"
persistence:
enabled: false
drupal:
Expand Down
1 change: 1 addition & 0 deletions src/drupal8/harness/config/confd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ confd('harness:/'):
- { src: application/overlay/phpunit.xml }
- { src: application/skeleton/behat.yml }
- { src: application/skeleton/composer.json }
- { src: application/skeleton/phpstan.neon }
21 changes: 19 additions & 2 deletions test
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ function main()
local harness="$1"
local mode="$2"
local sync="${3:-}"
local akeneo_version=5
local akeneo_version
local drupal_version

local sync_path=""
if [[ -n "$sync" ]]; then
Expand All @@ -41,6 +42,14 @@ function main()
harness="akeneo"
fi

if [[ "$harness" =~ ^(drupal9)$ ]]; then
drupal_version=9
harness="drupal8"
elif [[ "$harness" =~ ^(drupal8)$ ]]; then
drupal_version=8
harness="drupal8"
fi

if [[ "$REUSE_EXISTING_WORKSPACE" != "yes" ]]; then
# Test default mode of static or dynamic harnesses
# For dynamic this means a mountpoint for the application code
Expand All @@ -51,9 +60,12 @@ function main()
elif [[ "$sync" == "mutagen" ]]; then
setup_dynamic_mutagen
fi
if [[ "$harness" =~ ^(akeneo)$ ]]; then
if [ -n "${akeneo_version:-}" ]; then
setup_akeneo_version "$akeneo_version"
fi
if [ -n "${drupal_version:-}" ]; then
setup_drupal_version "$drupal_version"
fi
prepare_environment
fi

Expand Down Expand Up @@ -225,6 +237,11 @@ function setup_akeneo_version() {
echo "attribute('akeneo.major_version'): ${version}" >> "${path_test}/workspace.override.yml"
}

function setup_drupal_version() {
local version="$1"
echo "attribute('drupal.major_version'): ${version}" >> "${path_test}/workspace.override.yml"
}

function wait_for_vendor_directory()
(
set +x
Expand Down

0 comments on commit d572ffa

Please sign in to comment.