Skip to content

Commit

Permalink
add stable drupal 11.0 image and create 11.1 (11.x-dev) unstable one
Browse files Browse the repository at this point in the history
  • Loading branch information
WengerK committed Aug 9, 2024
1 parent b3794d7 commit 240502c
Show file tree
Hide file tree
Showing 10 changed files with 365 additions and 29 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/container-structure-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
drupal_version: ['8.9', '9.0', '9.1', '9.2', '9.3', '9.4', '9.5', '10.0', '10.1', '10.2', '10.3', '11.0']
drupal_version: ['8.9', '9.0', '9.1', '9.2', '9.3', '9.4', '9.5', '10.0', '10.1', '10.2', '10.3', '11.0', '11.1']
include:
- drupal_version: '8.9'
drupal_major: '8'
Expand All @@ -35,6 +35,8 @@ jobs:
drupal_major: '10'
- drupal_version: '11.0'
drupal_major: '11'
- drupal_version: '11.1'
drupal_major: '11'
steps:
- name: checkout source
uses: actions/checkout@master
Expand All @@ -56,7 +58,7 @@ jobs:
', github.ref)
strategy:
matrix:
drupal_version: ['8.9', '9.0', '9.1', '9.2', '9.3', '9.4', '9.5', '10.0', '10.1', '10.2', '10.3', '11.0']
drupal_version: ['8.9', '9.0', '9.1', '9.2', '9.3', '9.4', '9.5', '10.0', '10.1', '10.2', '10.3', '11.0', '11.1']
include:
- drupal_version: '8.9'
drupal_major: '8'
Expand All @@ -82,6 +84,8 @@ jobs:
drupal_major: '10'
- drupal_version: '11.0'
drupal_major: '11'
- drupal_version: '11.1'
drupal_major: '11'
steps:
- name: checkout source
uses: actions/checkout@master
Expand Down
16 changes: 4 additions & 12 deletions 11/11.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE_TAG
FROM drupal:${BASE_IMAGE_TAG}-php8.3-apache
FROM drupal:${BASE_IMAGE_TAG}-apache

ARG DRUPAL_VER

Expand Down Expand Up @@ -29,20 +29,12 @@ RUN curl -OL https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait
# installed into the vendor directory.
RUN composer config --no-interaction allow-plugins true

# Prepare for Drupal 11.0 upgrade.
# @see https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-to-drupal-9-or-higher
RUN composer require drupal/core-recommended:~${DRUPAL_VER} --update-with-all-dependencies --no-update
RUN composer require drupal/core-dev:~${DRUPAL_VER} --dev --update-with-all-dependencies --no-update

# Set the minimum stability to "dev" to allow installing unstable Drupal Core.
RUN composer config minimum-stability dev

# Perform Drupal 11.0-dev installation.
RUN COMPOSER_MEMORY_LIMIT=-1 composer update --with-all-dependencies
# Install Drupal Dev dependencies such as PHPUnit, Behat-Mink, ...
RUN COMPOSER_MEMORY_LIMIT=-1 composer require --dev drupal/core-dev:~${DRUPAL_VERSION}

# Install Drush.
# Drush will be heavily use to setup a working Drupal environment.
RUN composer require drush/drush:^13.0 --with-all-dependencies
RUN COMPOSER_MEMORY_LIMIT=-1 composer require drush/drush:^13.0

# Clean repository.
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
Expand Down
2 changes: 1 addition & 1 deletion 11/11.0/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DRUPAL_VER ?= 11.0
DRUPAL_VER_MAJOR ?= $(shell echo "${DRUPAL_VER}" | grep -oE '^[0-9]+\.[0-9]+')

BASE_IMAGE_TAG = 10.2
BASE_IMAGE_TAG = 11.0
ARCH_TO_BUILD ?= "linux/amd64"

REPO = wengerk/drupal-for-contrib
Expand Down
4 changes: 4 additions & 0 deletions 11/11.0/tests/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ metadataTest:
workdir: '/opt/drupal'
exposedPorts: ['80']
commandTests:
- name: 'PHP'
command: 'php'
args: [ '-v' ]
expectedOutput: ['^PHP 8\.3\.\d']
- name: 'Drupal Root location'
command: 'drush'
args: ['status']
Expand Down
51 changes: 51 additions & 0 deletions 11/11.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ARG BASE_IMAGE_TAG
FROM drupal:${BASE_IMAGE_TAG}-apache

ARG DRUPAL_VER

ENV COMPOSER_ALLOW_SUPERUSER=1
ENV DRUPAL_VER="${DRUPAL_VER}"

WORKDIR /opt/drupal

# Install git and zip library.
# Necessary for some composer operations.
RUN set -eux; \
\
apt-get update; \
apt-get install -y \
git \
zip \
unzip \
;

# Install wait-for-it script to be able to check if services are up.
RUN curl -OL https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && \
chmod +x wait-for-it.sh && \
mv wait-for-it.sh /usr/local/bin/wait-for-it

# As of Composer 2.2.0, the allow-plugins option adds a layer of security.
# Some plugin Installer must be authorized. Not allowing it may lead to an instance of Drupal
# installed into the vendor directory.
RUN composer config --no-interaction allow-plugins true

# Prepare for Drupal 11.0 upgrade.
# @see https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-to-drupal-9-or-higher
RUN composer require drupal/core-recommended:~${DRUPAL_VER} --update-with-all-dependencies --no-update
RUN composer require drupal/core-dev:~${DRUPAL_VER} --dev --update-with-all-dependencies --no-update

# Set the minimum stability to "dev" to allow installing unstable Drupal Core.
RUN composer config minimum-stability dev

# Perform Drupal 11.0-dev installation.
RUN COMPOSER_MEMORY_LIMIT=-1 composer update --with-all-dependencies

# Install Drush.
# Drush will be heavily use to setup a working Drupal environment.
RUN composer require drush/drush:^13.0 --with-all-dependencies

# Clean repository.
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy a default template for PHPUnit testing.
COPY templates/phpunit.xml /opt/drupal/web/phpunit.xml
65 changes: 65 additions & 0 deletions 11/11.1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
DRUPAL_VER ?= 11.1
DRUPAL_VER_MAJOR ?= $(shell echo "${DRUPAL_VER}" | grep -oE '^[0-9]+\.[0-9]+')

BASE_IMAGE_TAG = 11.0
ARCH_TO_BUILD ?= "linux/amd64"

REPO = wengerk/drupal-for-contrib
NAME = drupal-$(DRUPAL_VER_MAJOR)

TAG ?= $(DRUPAL_VER_MAJOR)

ifneq ($(BASE_IMAGE_STABILITY_TAG),)
BASE_IMAGE_TAG := $(BASE_IMAGE_TAG)-$(BASE_IMAGE_STABILITY_TAG)
endif

ifneq ($(STABILITY_TAG),)
ifneq ($(TAG),latest)
override TAG := $(TAG)-$(STABILITY_TAG)
endif
endif

.PHONY: build test push shell run start stop logs clean release

default: build

build:
docker buildx build -t $(REPO):$(TAG) \
--platform=${ARCH_TO_BUILD} \
--build-arg BASE_IMAGE_TAG=$(BASE_IMAGE_TAG) \
--build-arg DRUPAL_VER=$(DRUPAL_VER) \
./

build-nc:
docker buildx build -t $(REPO):$(TAG) \
--platform=${ARCH_TO_BUILD} \
--build-arg BASE_IMAGE_TAG=$(BASE_IMAGE_TAG) \
--build-arg DRUPAL_VER=$(DRUPAL_VER) \
--no-cache --pull \
./

test:
cd ./tests && IMAGE=$(REPO):$(TAG) ./run.sh

push:
docker push $(REPO):$(TAG)

shell:
docker run --rm --name $(NAME) -i -t $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) /bin/bash

run:
docker run --rm --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) $(CMD)

start:
docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG)

stop:
docker stop $(NAME)

logs:
docker logs $(NAME)

clean:
-docker rm -f $(NAME)

release: build push
118 changes: 118 additions & 0 deletions 11/11.1/templates/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- For how to customize PHPUnit configuration, see core/tests/README.md. -->
<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
<!-- PHPUnit expects functional tests to be run with either a privileged user
or your current system user. See core/tests/README.md and
https://www.drupal.org/node/2116263 for details.
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="core/tests/bootstrap.php" colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
failOnWarning="true"
printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter"
cacheResult="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<php>
<!-- Set error reporting to E_ALL. -->
<ini name="error_reporting" value="32767"/>
<!-- Do not limit the amount of memory tests take to run. -->
<ini name="memory_limit" value="-1"/>
<!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
<env name="SIMPLETEST_BASE_URL" value="http://drupal"/>
<!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix -->
<env name="SIMPLETEST_DB" value="mysql://drupal:drupal@db/drupal"/>
<!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->
<env name="BROWSERTEST_OUTPUT_DIRECTORY" value="/opt/drupal/web/sites/default/files/simpletest/browser_output"/>
<!-- To have browsertest output use an alternative base URL. For example if
SIMPLETEST_BASE_URL is an internal DDEV URL, you can set this to the
external DDev URL so you can follow the links directly.
-->
<env name="BROWSERTEST_OUTPUT_BASE_URL" value=""/>

<!-- Deprecation testing is managed through Symfony's PHPUnit Bridge.
The environment variable SYMFONY_DEPRECATIONS_HELPER is used to configure
the behaviour of the deprecation tests.
See https://symfony.com/doc/current/components/phpunit_bridge.html#configuration
Drupal core's testing framework is setting this variable to its defaults.
Projects with their own requirements need to manage this variable
explicitly.
-->
<!-- To disable deprecation testing completely uncomment the next line. -->
<!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> -->
<!-- Deprecation errors can be selectively ignored by specifying a file of
regular expression patterns for exclusion.
See https://symfony.com/doc/current/components/phpunit_bridge.html#ignoring-deprecations
Uncomment the line below to specify a custom deprecations ignore file.
NOTE: it may be required to specify the full path to the file to run tests
correctly.
-->
<!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="ignoreFile=.deprecation-ignore.txt"/> -->

<!-- To disable deprecation testing completely uncomment the next line. -->
<!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> -->
<!-- Example for changing the driver class for mink tests MINK_DRIVER_CLASS value: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver' -->
<env name="MINK_DRIVER_CLASS" value=''/>
<!-- Example for changing the driver args to mink tests MINK_DRIVER_ARGS value: '["http://127.0.0.1:8510"]' -->
<env name="MINK_DRIVER_ARGS" value=''/>
<!-- Example for changing the driver args to webdriver tests MINK_DRIVER_ARGS_WEBDRIVER value: '["chrome", { "chromeOptions": { "w3c": false } }, "http://localhost:4444/wd/hub"]' For using the Firefox browser, replace "chrome" with "firefox" -->
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless", "--no-sandbox", "--disable-dev-shm-usage"]}}, "http://chrome:9515"]'/>
</php>
<testsuites>
<testsuite name="unit">
<file>./core/tests/TestSuites/UnitTestSuite.php</file>
</testsuite>
<testsuite name="kernel">
<file>./core/tests/TestSuites/KernelTestSuite.php</file>
</testsuite>
<testsuite name="functional">
<file>./core/tests/TestSuites/FunctionalTestSuite.php</file>
</testsuite>
<testsuite name="functional-javascript">
<file>./core/tests/TestSuites/FunctionalJavascriptTestSuite.php</file>
</testsuite>
<testsuite name="build">
<file>./core/tests/TestSuites/BuildTestSuite.php</file>
</testsuite>
</testsuites>
<listeners>
<listener class="\Drupal\Tests\Listeners\DrupalListener">
</listener>
<!-- The Symfony deprecation listener has to come after the Drupal listener -->
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
</listener>
</listeners>
<!-- Filter for coverage reports. -->
<filter>
<whitelist>
<directory>./core/includes</directory>
<directory>./core/lib</directory>
<directory>./core/modules</directory>
<!-- Extensions can have their own test directories, so exclude those. -->
<exclude>
<directory>./core/modules/*/src/Tests</directory>
<directory>./core/modules/*/tests</directory>
</exclude>
<directory>./modules</directory>
<exclude>
<directory>./modules/*/src/Tests</directory>
<directory>./modules/*/tests</directory>
<directory>./modules/*/*/src/Tests</directory>
<directory>./modules/*/*/tests</directory>
</exclude>
<directory>./sites</directory>
<!-- By definition test classes have no tests. -->
<exclude>
<directory suffix="Test.php">./</directory>
<directory suffix="TestBase.php">./</directory>
</exclude>
</whitelist>
</filter>
<!-- Logging for coverage reports. -->
<logging>
<log type="coverage-clover" target="./build/logs/clover.xml"/>
<log type="coverage-html" target="./build/logs/coverage-html"/>
</logging>
</phpunit>
68 changes: 68 additions & 0 deletions 11/11.1/tests/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
schemaVersion: '2.0.0'
metadataTest:
envVars:
- key: 'DRUPAL_VER'
value: '11.1'
workdir: '/opt/drupal'
exposedPorts: ['80']
commandTests:
- name: 'PHP'
command: 'php'
args: [ '-v' ]
expectedOutput: ['^PHP 8\.3\.\d']
- name: 'Drupal Root location'
command: 'drush'
args: ['status']
expectedOutput: ['Drupal root\s+:\s+/opt/drupal/web']
- name: 'Drupal version'
command: 'drush'
args: ['status']
expectedOutput: ['Drupal version\s+:\s+11\.0(\.\d)*(\-alpha\d|\-beta\d|\-dev|\-rc\d|\d*)']
- name: 'Drupal Core Dev version'
command: bash
args: ['-c', 'composer show drupal/core-dev']
expectedOutput: ['versions\s+:\s\* 11\.(x|\d+)(-(alpha|beta|dev|rc))?']
- name: 'Drush location'
command: 'drush'
args: ['status']
expectedOutput: ['Drush script\s+:\s+/opt/drupal/vendor/bin/drush']
- name: 'Drush version'
command: 'drush'
args: ['status']
expectedOutput: ['Drush\s+version\s*:\s*13(\.(x|\d))*(\-alpha\d|\-beta\d|\-dev|\-rc\d|\d*)']
- name: 'PHPUnit location'
command: 'which'
args: ['phpunit']
expectedOutput: ['/opt/drupal/vendor/bin/phpunit']
- name: 'PHPUnit version'
command: 'phpunit'
args: ['--version']
expectedOutput: ['^PHPUnit 10\.\d\.\d']
fileExistenceTests:
- name: 'Root'
path: '/'
shouldExist: true
permissions: 'drwxr-xr-x'
uid: 0
gid: 0
- name: 'PHPUnit default file'
path: '/opt/drupal/web/phpunit.xml'
shouldExist: true
- name: 'Wait-for-it script'
path: '/usr/local/bin/wait-for-it'
shouldExist: true
permissions: '-rwxr-xr-x'
uid: 0
gid: 0
- name: 'Drupal Root'
path: '/opt/drupal/web'
shouldExist: true
permissions: 'drwxr-xr-x'
uid: 0
gid: 0
- name: 'Drupal Public'
path: '/opt/drupal/web/sites/default'
shouldExist: true
permissions: 'drwxr-xr-x'
uid: 33
gid: 33
Loading

0 comments on commit 240502c

Please sign in to comment.