Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy (prepare 2.6.21) #3070

Merged
merged 30 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
54cb63e
NEPT-2956: Upgrade wysiwyg to the latest version.
Fefaine Jan 6, 2022
40f76a9
NEPT-2956: Adapt betat to new year
Fefaine Jan 6, 2022
d7aa4ac
Revert "NEPT-2963: Remove temporarly SolR Behat tests."
julien- Feb 24, 2022
6b4e0ca
NEPT-2980: Update README.
julien- Feb 24, 2022
cf5a15c
NEPT-2980: Fix Behat SolR.
julien- Mar 15, 2022
fa0ba30
NEPT-2980: Remove temporarly SolR Behat tests.
julien- Mar 16, 2022
88bf04e
NEPT-2996: Add patch to fix fieldset collapsible in 'seven' theme.
julien- May 5, 2022
788f4b4
NEPT-2997: Patch for debuging Views.
julien- May 17, 2022
288caff
NEPT-2998 Add patch 2313517 on Durpal Core to fix error
Sokarion May 17, 2022
68aa256
DQA-0: Fix string arguments on scheduler message.
joaocsilva Jun 15, 2022
fec6de7
Merge pull request #3056 from ec-europa/feature/NEPT-2996_seven_field…
Sokarion Jul 6, 2022
a5dbc9f
NEPT-2980: Revert tests changes (in deploy state).
julien- Jul 8, 2022
aebf5bf
Merge branch 'deploy' into feature/NEPT-2997_debug_views
julien- Jul 12, 2022
9250925
Merge pull request #3057 from ec-europa/feature/NEPT-2997_debug_views
julien- Jul 12, 2022
1f2b9f8
Merge branch 'deploy' into feature/NEPT-2998-fix-date-popup-widget-br…
julien- Jul 12, 2022
2951327
Merge pull request #3059 from Sokarion/feature/NEPT-2998-fix-date-pop…
julien- Jul 12, 2022
1e97fde
Merge pull request #3066 from ec-europa/feature/DQA-0
julien- Jul 12, 2022
dc1498b
Merge branch 'release-2.6' into deploy
julien- Jul 12, 2022
533b09d
Merge branch 'deploy' into nept-2956
julien- Jul 12, 2022
50e56aa
NEPT-2980: Cancel test failure.
julien- Jul 12, 2022
383c4f8
Merge pull request #3010 from ec-europa/nept-2956
julien- Jul 12, 2022
e2deb4e
Merge branch 'deploy' into NEPT-2980_behat_solr
julien- Jul 13, 2022
3b25230
Merge pull request #3046 from ec-europa/NEPT-2980_behat_solr
julien- Jul 13, 2022
99e6b78
NEPT-2995: Fix warning by using empty() function.
julien- Jul 13, 2022
37bba8a
Merge pull request #3071 from ec-europa/NEPT-2995_notice_nexteuropa_j…
julien- Jul 13, 2022
290b067
NEPT-2985: ec_europa 0.0.26 => 0.0.27.
julien- Jul 13, 2022
d28452d
NEPT-3002: Drupal 7.91 + Composer update (root + resources).
julien- Aug 2, 2022
c5df29e
NEPT-3002: Remove unused patches + refactor .make files.
julien- Aug 3, 2022
531491a
NEPT-3002: PHPCS usage of the hook hook_form_alter() is forbidden.
julien- Aug 3, 2022
2f0ba5d
Merge pull request #3073 from ec-europa/NEPT-3002_drupal_791
julien- Aug 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 134 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Requirements

* Composer
* Composer 1
* PHP Phar extension
* PhantomJS (in order to run JavaScript during Behat tests)
* PHP 7.3 or higher
Expand All @@ -13,17 +13,17 @@ Before we can build the NextEuropa platform we need to install the build system
itself. This can be done using [composer](https://getcomposer.org/):


```
$ composer install
```bash
composer install
```

## Customize build properties

Create a new file in the root of the project named `build.properties.local`
using your favourite text editor:

```
$ vim build.properties.local
```bash
vim build.properties.local
```

This file will contain configuration which is unique to your development
Expand All @@ -35,64 +35,104 @@ Because these settings are personal they should not be shared with the rest of
the team. Make sure you never commit this file!

All options you can use can be found in the `build.properties.dist` file. Just
copy the lines you want to override and change their values. For example:
copy the lines you want to override and change their values.
<details style="padding-left: 3em;"><summary style="margin-left: -3em;">Example of `build.properties.local`</summary>
<p>

```
# The location of the Composer binary.
myLocalIP = __TO_BE_DEFINED
project.folder = platform-dev
composer.bin = /usr/bin/composer
drush.bin = /usr/local/bin/drush

# The install profile to use.
platform.profile.name = multisite_drupal_standard
platform.site.theme_default = ec_resp
behat.base_url = http://${myLocalIP}:8080/${project.folder}/build
behat.wd_host.url = http://${myLocalIP}:4444/wd/hub
behat.screenshots.path = ${project.basedir}/tests/screenshots
behat.browser.name = chrome

# Drush Context configuration
# ---------------------------
drush.db.dump = ${platform.build.dir}/dump.sql


# Database settings.
drupal.db.name = my_database
drupal.db.name = platform_dev
drupal.db.user = root
drupal.db.password = hunter2
drupal.db.password =

# Configuration to append to the settings.php file of the build.
drupal.settings.append.text = ${line.separator}$conf['field_sql_storage_skip_writing_unchanged_fields'] = FALSE;${line.separator}$conf['multisite_toolbox_cs_whitelist'] = array('*.europa.eu', 'europa.eu');${line.separator}$conf['poetry_mock_base_url'] = "${mock.poetry.base_url}";${line.separator}$conf['ecas_whitelisted_user_roles'] = array();${line.separator}$conf['dev_credentials'] = "pass";${line.separator}define('FPFIS_ECAS_URL', 'ecas.ec.europa.eu');${line.separator}define('FPFIS_ECAS_PORT', 443);${line.separator}define('FPFIS_ECAS_URI', '/cas');${line.separator}

# Admin user.
drupal.admin.username = admin
drupal.admin.password = admin

# The base URL to use in Behat tests.
behat.base_url = http://nexteuropa.local
# Flickr configuration
# --------------------
# A valid API key & secret used by the behat tests
flickr.key = foobar
flickr.secret = bas

# Integration configuration
# -------------------------
# Port on which the mocked integration server used by the behat tests will listen.
integration.server.port = 8888

# Development variables
# -------------------------
devel.vars.autologout_timeout = 172800

```
<p>
</details>

## Listing the available build commands

You can get a list of all the available Phing build commands ("targets") with a
short description of each target with the following command:

```
$ ./bin/phing
```bash
./bin/phing
```

## Building a local development environment

```bash
./bin/phing build-platform-dev install-platform
```
$ ./bin/phing build-platform-dev
$ ./bin/phing install-platform
```

### From the release 2.4.x following configuration variables are available:

- The default theme to enable, set to either "ec_resp" (default) or "ec_europa".
<details style="padding-left: 3em;"><summary style="margin-left: -3em;">Some configuraion variables</summary>
<p>
- The default theme to enable, set to either "ec_resp" (default) or "ec_europa".

> platform.site.theme_default = ec_resp
```
platform.site.theme_default = ec_resp
```

- The default Europa Component Library release which is used to build the EC Europa theme.

> ecl.version = v0.10.0
```
ecl.version = v0.10.0
```

- The default EC Europa theme release version.

> ec_europa.version = 0.0.2
```
ec_europa.version = 0.0.2
```

- The default Atomium theme build properties. Used only if default theme is set to "ec_europa".
You can find default values of those variables below.

>platform.theme.atomium.repo.url = https://github.com/ec-europa/atomium.git
>platform.theme.atomium.repo.branch = 7.x-1.x
```
platform.theme.atomium.repo.url = https://github.com/ec-europa/atomium.git
platform.theme.atomium.repo.branch = 7.x-1.x
```

</p>
</details>

## Building a local development environment for the EC Europa theme

Expand All @@ -108,16 +148,16 @@ section above. The most important is to set the `platform.site.theme_default` va
to `ec_europa`.

You can use this Phing target in the following way:
```
$ ./bin/phing build-europa-dev
```bash
./bin/phing build-europa-dev
```
This Phing target is meant to be used only for the local development purposes.

## Generic users.
After install, generic users are created. Login using drush user-login command.
```
$ cd ./build
$ drush uli
```bash
cd ./build
drush uli
```
And setup a new password for these users.

Expand All @@ -132,17 +172,17 @@ If you are not using the development build but one of the other builds
(`build-platform-dist` or `build-multisite-dist`) and you want to run the tests
then you'll need to set up the Behat configuration manually:

```
$ ./bin/phing setup-behat
```bash
./bin/phing setup-behat
```

In order to run JavaScript in your Behat tests, you must launch a PhantomJS
instance before. Use the `--debug` parameter to get more information. Please
be sure that the webdriver's port you specify corresponds to the one in your
Behat configuration (`behat.wd_host.url: "http://localhost:8643/wd/hub"`).

```
$ phantomjs --debug=true --webdriver=8643
```bash
phantomjs --debug=true --webdriver=8643
```

If you prefer to use an actual browser with Selenium instead of PhantomJS, you
Expand All @@ -159,43 +199,74 @@ by calling the behat executable directly and specifying the location of the

Behat tests can be executed from the repository root by running:

```
$ ./bin/behat -c tests/behat.yml
```bash
./bin/behat -c tests/behat.yml
```

The platform can run 4 different behat profiles:
* default: it runs behat tests against a multisite_drupal_standard build using
the "Europa" theme;
* communities: it runs behat tests against a multisite_drupal_communities build
using the "Europa" theme;
* standard_ec_resp: it runs behat tests against a multisite_drupal_standard build using
the "ec_resp" theme;
* communities_ec_resp: it runs behat tests against a multisite_drupal_communities build
using the "ec_resp" theme;

The behat execution command mentioned above runs the tests only with the default profile. <br />
The tests will fail with it if the platform is built with the "ec_resp" theme.
<table>
<thead>
<tr>
<th style="border-bottom: none !important;">Profile name <span style="display: block; font-weight: 400; font-size: 0.8rem;">to call in your behat command<span></th>
<th rowspan=2></th>
<th rowspan=2>called build</th>
<th rowspan=2>used theme</th>
</tr>
</thead>
<tbody>
<tr>
<td>default</td>
<td rowspan=4>runs behat tests against a</td>
<td><span style="background-color: #054e9f; color: white;">multisite_drupal_standard</span></td>
<td><span style="background-color: #054e9f; color: gold;">ec_europa</span></td>
</tr>
<tr>
<td>communities</td>
<td><span style="background-color: #668eba; color: white;">multisite_drupal_communities</span></td>
<td><span style="background-color: #054e9f; color: gold;">ec_europa</span></td>
</tr>
<tr>
<td>standard_ec_resp</td>
<td><span style="background-color: #054e9f; color: white;">multisite_drupal_standard</span></td>
<td><span style="background-color: white; color: darkblue; border: 1px solid darkblue; padding : 2px 5px;">ec_resp</span></td>
</tr>
<tr>
<td>communities_ec_resp</td>
<td><span style="background-color: #668eba; color: white;">multisite_drupal_communities</span></td>
<td><span style="background-color: white; color: darkblue; border: 1px solid darkblue; padding : 2px 5px;">ec_resp</span></td>
</tr>
</tbody>
</table>

The behat execution command mentioned above runs the tests only with the `default` profile. <br />
The tests will fail with it if the platform is built with the `ec_resp` theme.

To run a profile other than the default one , the following command must be executed:

```
$ ./bin/behat -c tests/behat.yml -p [profile]
```bash
./bin/behat -c tests/behat.yml -p [profile]
```

`[profile]` stands for the profile name as written in the list above; I.E: communities,
standard_ec_resp, communities_ec_resp.
`[profile]` stands for the profile name as written in the table above

If you want to execute a single test, just provide the path to the test as an argument.
The tests are located in `tests/features/`. For example:

```bash
./bin/behat -c tests/behat.yml tests/features/content_editing.feature
```
$ ./bin/behat -c tests/behat.yml tests/features/content_editing.feature

Some tests are functionnal only with specific theme. So you have to build your site using this theme. To check it see in `tests/balancer/` where your .feature behat file is called (folder available after setup behat).
For sample `tests/features/tmgmt/tmgmt_dgt_connector_cart.feature` is in `tests/balancer/behat.standard_ec_resp.0.yml` so you have to install the platform in local with the `multisite_drupal_standard` profile and `ec_resp` theme:
```bash
./bin/behat -c tests/behat.yml -p standard_ec_resp --colors -f pretty --strict tests/features/tmgmt/tmgmt_dgt_connector_cart.feature
```


Some tests need to mimic external services that listen on particular ports, e.g.
the central server of the Integration Layer. If you already have services running
on the same ports, they will conflict. You will need to change the ports used in
build.properties.local.
`build.properties.local`.

Remember to specify the right configuration file before running the tests.

Expand All @@ -211,8 +282,8 @@ If you are not using the development build but one of the other builds
(`build-platform-dist` or `build-multisite-dist`) and you want to run PHPUnit tests
then you'll need to set up the PHPUnit configuration manually by running:

```
$ ./bin/phing setup-phpunit
```bash
./bin/phing setup-phpunit
```

Each custom module or feature can expose unit tests by executing the following steps:
Expand Down Expand Up @@ -254,8 +325,8 @@ class ExampleTest extends AbstractUnitTest {

PHPUnit tests can be executed from the repository root by running:

```
$ ./bin/phpunit -c tests/phpunit.xml
```bash
./bin/phpunit -c tests/phpunit.xml
```

## Running Drupal Simpletests on the platform
Expand All @@ -267,12 +338,12 @@ Check the documentation [here](https://webgate.ec.europa.eu/fpfis/wikis/x/NJUQE)
After executing the 'setup-php-codesniffer' Phing target,
PHP CodeSniffer will be set up and can be run with the following command:

```
```bash
# Scan all files for coding standards violations.
$ ./bin/phpcs
./bin/phpcs

# Scan only a single folder.
$ ./bin/phpcs profiles/common/modules/custom/ecas
./bin/phpcs profiles/common/modules/custom/ecas
```

# Docker-compose.yml file
Expand All @@ -294,12 +365,12 @@ Composer patches are added via cweagans/composer-patches to projects via compose
### rych/random

Add PHP 7 compatibility.
```
```JSON
"https://github.com/rchouinard/rych-random/pull/5": "https://patch-diff.githubusercontent.com/raw/rchouinard/rych-random/pull/5.patch"
```

Provide new generator that works with PHP version >= 7.1
```
```JSON
"https://github.com/rchouinard/rych-random/pull/7": "https://patch-diff.githubusercontent.com/raw/rchouinard/rych-random/pull/7.patch
```

Expand All @@ -308,7 +379,7 @@ Provide new generator that works with PHP version >= 7.1
Prevent infinite loops, see https://webgate.ec.europa.eu/CITnet/jira/browse/NEPT-2160
To better handle XML parsing for attributes (modification of http://www.akchauhan.com/convert-xml-to-array-using-dom-extension-in-php5/),
see https://webgate.ec.europa.eu/CITnet/jira/browse/NEPT-1278, https://webgate.ec.europa.eu/CITnet/jira/browse/NEXTEUROPA-11605
```
```JSON
"phpCAS-1.4.0_handle_XML_parsing_ECAS_attributes.patch": "../resources/patches/phpCAS-1.4.0_handle_XML_parsing_ECAS_attributes.patch"
```

4 changes: 4 additions & 0 deletions build.properties.dist
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ behat.poetry.wsdl = /wsdl
behat.poetry.username = username
behat.poetry.password = password

# Solr mock
behat.solr.host = localhost
behat.solr.port = 8983

# Poetry mock
# Example mock.poetry.base_url = http://127.0.0.1:8080/platform-dev/build
# Example mock.poetry.base_url = http://web:8080
Expand Down
2 changes: 2 additions & 0 deletions build.test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@
<token key="platform.build.dir" value="${platform.build.dir}" />
<token key="behat.screenshots.path" value="${behat.screenshots.path}" />
<token key="behat.subcontexts.path" value="${behat.subcontexts.path}" />
<token key="behat.solr.host" value="${behat.solr.host}" />
<token key="behat.solr.port" value="${behat.solr.port}" />
<token key="flickr.key" value="${flickr.key}" />
<token key="flickr.secret" value="${flickr.secret}" />
<token key="drush.bin" value="${drush.bin}" />
Expand Down
Loading