Skip to content
Snippets Groups Projects
Commit c33db16b authored by Adam Nagy's avatar Adam Nagy
Browse files

Issue #3492522: Move from OpenEuropa github repository.

parent d3a9a14f
Branches 2.3.x
Tags 2.3.1
1 merge request!3Issue #3492522: Move from OpenEuropa github repository.
Pipeline #426289 passed
clone:
git:
image: registry.fpfis.eu/drone-plugins/git:next
when:
event: [ push, pull_request, tag ]
git:
image: registry.fpfis.eu/drone-plugins/git
when:
event: [ deployment ]
workspace:
base: /test
path: composite_reference
services:
web:
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
environment:
- DOCUMENT_ROOT=/test/composite_reference
- COMPOSERVER=--2
mysql:
image: registry.fpfis.eu/fpfis/sql:percona-5.7
command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
pipeline:
composer-install:
group: prepare
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
volumes:
- /cache/${DRONE_REPO_NAME}:/cache
commands:
- composer self-update --2
- composer require drupal/core:~${CORE_VERSION} drupal/core-composer-scaffold:~${CORE_VERSION} drupal/core-dev:~${CORE_VERSION} --update-with-all-dependencies --ansi --no-progress --no-interaction
site-install:
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
commands:
- while ! mysqladmin ping -h mysql --silent; do sleep 1; done
- ./vendor/bin/run drupal:site-install
grumphp:
group: test
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
commands:
- ./vendor/bin/grumphp run
phpunit:
group: test
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
commands:
- ./vendor/bin/phpunit
debug:
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
commands:
- ./vendor/bin/drush ws --count 500
when:
status: failure
matrix:
include:
- CORE_VERSION: 10.1.0
PHP_VERSION: 8.1
- CORE_VERSION: 10.1.0
PHP_VERSION: 8.2
- CORE_VERSION: 10.2.0
PHP_VERSION: 8.1
- CORE_VERSION: 10.2.0
PHP_VERSION: 8.2
.DS_Store
.idea
.ddev
behat.yml
build
composer.lock
......@@ -11,5 +12,6 @@ package-lock.json
phpunit.xml
runner.yml
vendor
web
yarn.lock
/.gitattributes
\ No newline at end of file
/.gitattributes
################
# GitLabCI template for Drupal projects.
#
# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification.
# It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained.
# As long as you include the project, ref and three files below, any future updates added by the Drupal Association will be used in your
# pipelines automatically. However, you can modify this template if you have additional needs for your project.
# The full documentation is on https://project.pages.drupalcode.org/gitlab_templates/
################
# For information on alternative values for 'ref' see https://project.pages.drupalcode.org/gitlab_templates/info/templates-version/
# To test a Drupal 7 project, change the first include filename from .main.yml to .main-d7.yml
include:
- project: $_GITLAB_TEMPLATES_REPO
ref: $_GITLAB_TEMPLATES_REF
file:
- '/includes/include.drupalci.main.yml'
- '/includes/include.drupalci.variables.yml'
- '/includes/include.drupalci.workflows.yml'
#
################
# Pipeline configuration variables are defined with default values and descriptions in the file
# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml
# Uncomment the lines below if you want to override any of the variables. The following is just an example.
################
# variables:
# SKIP_ESLINT: '1'
# OPT_IN_TEST_NEXT_MAJOR: '1'
# _CURL_TEMPLATES_REF: 'main'
variables:
# This runs D10 with PHP 8.1.
OPT_IN_TEST_PREVIOUS_MAJOR: '1'
SKIP_CSPELL: '1'
_SHOW_ENVIRONMENT_VARIABLES: '1'
# Make sure we run over D10 with the PHP 8.3 until the module is updated to D11.
composer:
variables:
DRUPAL_CORE: $CORE_PREVIOUS_STABLE
......@@ -30,124 +30,6 @@ $fields['my_field'] = BaseFieldDefinition::create('entity_reference')
If the base field gets overridden, this setting will get exported to the third party setting and it will continue to work.
## Development setup
You can build the development site by running the following steps:
* Install the Composer dependencies:
```bash
composer install
```
A post command hook (`drupal:site-setup`) is triggered automatically after `composer install`.
It will make sure that the necessary symlinks are properly setup in the development site.
It will also perform token substitution in development configuration files such as `behat.yml.dist`.
* Install test site by running:
```bash
./vendor/bin/run drupal:site-install
```
Your test site will be available at `./build`.
**Please note:** project files and directories are symlinked within the test site by using the
[OpenEuropa Task Runner's Drupal project symlink](https://github.com/openeuropa/task-runner-drupal-project-symlink) command.
If you add a new file or directory in the root of the project, you need to re-run `drupal:site-setup` in order to make
sure they are be correctly symlinked.
If you don't want to re-run a full site setup for that, you can simply run:
```
$ ./vendor/bin/run drupal:symlink-project
```
### Using Docker Compose
Alternatively, you can build a development site using [Docker](https://www.docker.com/get-docker) and
[Docker Compose](https://docs.docker.com/compose/) with the provided configuration.
Docker provides the necessary services and tools such as a web server and a database server to get the site running,
regardless of your local host configuration.
#### Requirements:
- [Docker](https://www.docker.com/get-docker)
- [Docker Compose](https://docs.docker.com/compose/)
#### Configuration
By default, Docker Compose reads two files, a `docker-compose.yml` and an optional `docker-compose.override.yml` file.
By convention, the `docker-compose.yml` contains your base configuration and it's provided by default.
The override file, as its name implies, can contain configuration overrides for existing services or entirely new
services.
If a service is defined in both files, Docker Compose merges the configurations.
Find more information on Docker Compose extension mechanism on [the official Docker Compose documentation](https://docs.docker.com/compose/extends/).
#### Usage
To start, run:
```bash
docker-compose up
```
It's advised to not daemonize `docker-compose` so you can turn it off (`CTRL+C`) quickly when you're done working.
However, if you'd like to daemonize it, you have to add the flag `-d`:
```bash
docker-compose up -d
```
Then:
```bash
docker-compose exec web composer install
docker-compose exec web ./vendor/bin/run drupal:site-install
```
Using default configuration, the development site files should be available in the `build` directory and the development site
should be available at: [http://127.0.0.1:8080/build](http://127.0.0.1:8080/build).
#### Running the tests
To run the grumphp checks:
```bash
docker-compose exec web ./vendor/bin/grumphp run
```
To run the phpunit tests:
```bash
docker-compose exec web ./vendor/bin/phpunit
```
To run the behat tests:
```bash
docker-compose exec web ./vendor/bin/behat
```
#### Step debugging
To enable step debugging from the command line, pass the `XDEBUG_SESSION` environment variable with any value to
the container:
```bash
docker-compose exec -e XDEBUG_SESSION=1 web <your command>
```
Please note that, starting from XDebug 3, a connection error message will be outputted in the console if the variable is
set but your client is not listening for debugging connections. The error message will cause false negatives for PHPUnit
tests.
To initiate step debugging from the browser, set the correct cookie using a browser extension or a bookmarklet
like the ones generated at https://www.jetbrains.com/phpstorm/marklets/.
## Contributing
Please read [the full documentation](https://github.com/openeuropa/openeuropa) for details on our code of conduct, and the process for submitting pull requests to us.
......
......@@ -6,23 +6,17 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"drupal/core": "^10"
"php": ">=8.1"
},
"require-dev": {
"composer/installers": "^1.11",
"drupal/core-composer-scaffold": "^10",
"drupal/core-dev": "^10",
"drupal/core-recommended": "^10",
"drupal/entity_reference_revisions": "^1.3",
"drush/drush": "^12",
"openeuropa/code-review": "^2.0.0-alpha6",
"openeuropa/task-runner-drupal-project-symlink": "^1.0-beta6",
"phpspec/prophecy-phpunit": "^2"
},
"scripts": {
"post-install-cmd": "./vendor/bin/run drupal:site-setup",
"post-update-cmd": "./vendor/bin/run drupal:site-setup"
},
"repositories": [
{
"type": "composer",
......@@ -41,18 +35,7 @@
},
"extra": {
"composer-exit-on-patch-failure": true,
"enable-patching": true,
"installer-paths": {
"build/core": ["type:drupal-core"],
"build/profiles/contrib/{$name}": ["type:drupal-profile"],
"build/modules/contrib/{$name}": ["type:drupal-module"],
"build/themes/contrib/{$name}": ["type:drupal-theme"]
},
"drupal-scaffold": {
"locations": {
"web-root": "./build"
}
}
"enable-patching": true
},
"config": {
"sort-packages": true,
......
version: '2'
services:
web:
image: fpfis/httpd-php-dev:8.1
working_dir: /var/www/html
ports:
- 8080:8080
volumes:
- .:/var/www/html # Non Mac users.
# - nfsmount:/var/www/html # Mac Users with the nfsmount volume.
environment:
COMPOSERVER: "--2"
XDEBUG_CONFIG: "client_host=172.17.0.1" # Non-Mac users.
# XDEBUG_CONFIG: "client_host=host.docker.internal" # Mac users.
XDEBUG_MODE: "develop, debug"
PHP_IDE_CONFIG: "serverName=Docker"
# Enable step debugging for all PHP request. See ./README.md#step-debugging for more information.
# XDEBUG_SESSION: 1
mysql:
image: percona/percona-server:5.7
command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
# ports:
# - 3306:3306
#### Mac users: uncomment the "volumes" key to enable the NFS file sharing. You can find more information about Docker for Mac here: https://github.com/openeuropa/openeuropa/blob/master/docs/starting/tooling.md#using-docker-on-macos
#volumes:
# nfsmount:
# driver: local
# driver_opts:
# type: nfs
# o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
# device: ":${PWD}/"
#### End Mac users.
imports:
- { resource: vendor/openeuropa/code-review/dist/drupal-conventions.yml }
parameters:
tasks.phpcs.ignore_patterns:
- build/
- node_modules/
- vendor/
tasks.phpcs.triggered_by:
- inc
- install
- module
- php
- theme
- yml
grumphp:
git_hook_variables:
EXEC_GRUMPHP_COMMAND: 'docker-compose exec -T web'
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="${drupal.root}/core/tests/bootstrap.php" backupGlobals="true" colors="true" cacheResult="false">
<php>
<ini name="error_reporting" value="32767"/>
<ini name="memory_limit" value="-1"/>
<env name="SIMPLETEST_IGNORE_DIRECTORIES" value="${drupal.root}"/>
<env name="SIMPLETEST_BASE_URL" value="${drupal.base_url}"/>
<env name="SIMPLETEST_DB" value="mysql://${drupal.database.user}:${drupal.database.password}@${drupal.database.host}:${drupal.database.port}/${drupal.database.name}"/>
</php>
<testsuites>
<testsuite name="Composite reference tests">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
drupal:
root: "build"
base_url: "http://web:8080/build"
site:
name: "OpenEuropa"
profile: "minimal"
database:
host: "mysql"
port: "3306"
name: "composite_reference"
user: "root"
password: ""
post_install:
# Prepare the instance.
- "./vendor/bin/drush en toolbar -y"
- "./vendor/bin/drush theme:enable olivero -y"
- "./vendor/bin/drush theme:enable claro -y"
- "./vendor/bin/drush config-set system.theme default olivero -y"
- "./vendor/bin/drush config-set system.theme admin claro -y"
- "./vendor/bin/drush config-set node.settings use_admin_theme 1 -y"
# Enable the modules.
- "./vendor/bin/drush en composite_reference -y"
- "./vendor/bin/drush cr"
settings:
settings:
file_scan_ignore_directories:
- "node_modules"
- "bower_components"
- "vendor"
- "${drupal.root}"
commands:
drupal:site-setup:
- { task: "run", command: "drupal:symlink-project" }
- { task: "run", command: "drupal:drush-setup" }
- { task: "run", command: "drupal:settings-setup" }
- { task: "run", command: "setup:phpunit" }
setup:phpunit:
- { task: "process", source: "phpunit.xml.dist", destination: "phpunit.xml" }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment