Skip to content

Commit

Permalink
Merge pull request #521 from danskernesdigitalebibliotek/release/2023…
Browse files Browse the repository at this point in the history
…-49-0

Release 2023-49-0
  • Loading branch information
kasperg authored Dec 5, 2023
2 parents d10355b + 52fd494 commit 9d1f447
Show file tree
Hide file tree
Showing 272 changed files with 9,593 additions and 5,433 deletions.
16 changes: 8 additions & 8 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@
*.config text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.css text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.dist text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.engine text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.engine text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php linguist-language=php
*.html text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=html
*.inc text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.install text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.inc text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php linguist-language=php
*.install text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php linguist-language=php
*.js text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.json text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.lock text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.map text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.md text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.module text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.php text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.module text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php linguist-language=php
*.php text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php linguist-language=php
*.po text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.profile text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.profile text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php linguist-language=php
*.script text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.sh text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.sh text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php linguist-language=php
*.sql text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.svg text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.theme text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.theme text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php linguist-language=php
*.twig text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.txt text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.xml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
on: pull_request
name: CI Tests
env:
PHP_VERSION: 8.0
PHP_VERSION: 8.1
COMPOSER_VERSION: v2

jobs:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ web/sites/simpletest
.history
.vscode

# Task environment file
# Task workspace and environment file
.task/
.task.env

# drush contrib commands
Expand Down
2 changes: 1 addition & 1 deletion .lagoon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ environments:
schedule: "M/30 * * * *"
command: drush locale-check && drush locale-update
service: cli
pr-481:
pr-521:
cronjobs:
- name: drush cron
schedule: "M/15 * * * *"
Expand Down
4 changes: 0 additions & 4 deletions .pa11yci
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
"timeout": 600000
},
"urls": [
{
"url": "http://varnish:8080/",
"screenCapture": "/app/pa11y/screenshots/front-page.png"
},
{
"url": "http://varnish:8080/search?q=harry+potter&x=0&y=0",
"screenCapture": "/app/pa11y/screenshots/search-page.png"
Expand Down
58 changes: 7 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,13 @@
# dpl-cms
# dpl-cms - The library CMS, powered by Drupal

This is the main repository used for building the core Drupal CMS which is used
by the danish public libraries.

## Running a local development
This repo uses styling from the
[dpl-design-system repo](https://github.com/danskernesdigitalebibliotek/dpl-design-system/).

If you want to develop and maintain the DPL cms project locally you can run:
`dev:reset`. The command builds the site with dependencies and starts the
required Docker containers.
You can find the full documentation, along with setup instructions in either the
[documentation site](https://danskernesdigitalebibliotek.github.io/dpl-docs/dpl-cms/),
or directly in [the docs folder](docs/)

## Prerequisites

In order to run local development you need:

* [`go-task`](https://taskfile.dev)
* Docker
* Preferably support for `VIRTUAL_HOST` environment variables for Docker
containers. Examples: [Dory (OSX)](https://github.com/FreedomBen/dory) or
[`nginx-proxy`](https://github.com/nginx-proxy/nginx-proxy).

## Other initial steps

If you are using a mac/OSX it is recommended to use [VirtioFS](https://virtio-fs.gitlab.io)
on the mounted volumes in docker-compose.

In your Docker for mac preference you need to activate VirtioFS for directory sharing:

![OSX preference pane providing access to VirtioFS](docs/images/virtiofs.png)

## Building and publishing releases

A release of dpl-cms can be build by pushing a tag that matches the following
pattern:

```shell
# Replace <version> with the version.
git tag <version>

# Eg.
git tag 1.2.3
```

The actual release is performed by the `Publish source` Github action which
invokes `task source:deploy` which in turn uses the tasks `source:build` and
`source:push` to build and publish the release.

Using the action should be the preferred choice for building and publishing
releases, but should you need to - it is possible to run the task manually
given you have the necessary permissions for pushing the resulting source-image.
Should you only need to produce the image, but not push it the task you can opt
for just invoking the `source:build` task.

You can override the name of the built image and/or the destination registry
temporarily by providing a number of environment variables (see the
[Taskfile](Taskfile.yml)). To permanently change these configurations, eg. in
a fork, change the defaults directly in the `Taskfile.yml`.
**tl;dr:** Run `task dev:reset` to get the site up and running locally.
49 changes: 44 additions & 5 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,25 @@ tasks:
- sh: "[ ! -z {{.CR_PAT}} ]"
msg: "Env variable CR_PAT is not set or empty."

dev:build:
summary: Build docker containers
# Ensure that we only rebuild if there are changes to Dockerfiles
sources:
- "{{ .LAGOON_DIR }}/*.dockerfile"
cmds:
- docker compose build

dev:cli:
summary: Performs command inside container. Expects parameter(s).
# This could have a dependency on dev:build but does not to avoid excessive
# log output. dev:cli gets called a lot.
cmds:
- docker compose {{ .DOCKER_COMPOSE_FILES }} run --rm cli sh -c "{{.CLI_ARGS}}"

dev:start:
summary: Run docker compose
deps:
- dev:build
cmds:
- docker compose {{ .DOCKER_COMPOSE_FILES }} up -d {{if eq .CI "true"}}--quiet-pull{{end}}
vars:
Expand All @@ -94,11 +106,19 @@ tasks:
# causes the process to fail. Wait and retry if that is the case
- docker compose {{ .DOCKER_COMPOSE_FILES }} down --volumes --remove-orphans || (sleep 3 && docker-compose down)

dev:pull:
summary: Pull latest docker images.
cmds:
- docker compose {{ .DOCKER_COMPOSE_FILES }} pull

dev:reset:
desc: Create local development setup in a clean state
cmds:
deps:
# Build new containers if necessary.
- dev:build
# Stop potential running environment.
- task dev:down
- dev:down
cmds:
# Create a .env file with recommended defaults.
- cp -n .env.example .env || true
# Build site.
Expand All @@ -107,8 +127,12 @@ tasks:
# packages may change without composer package version changes so ensure
# we have the latest version.
- task dev:cli -- composer reinstall danskernesdigitalebibliotek/dpl-design-system danskernesdigitalebibliotek/dpl-react --no-cache
# (Re)run Drupal scaffolding.
- task dev:cli -- composer drupal:scaffold
# Build dev scripts
- task dev:cli -- $(cd dev-scripts/dpl-react; composer install)
# Pull the images (necessary for the first reset)
- task dev:pull
# Start local environment.
- task dev:start
# Install site.
Expand All @@ -123,9 +147,22 @@ tasks:
- task dev:cache:clear:all
# Ensure site is reachable and warm any caches
- task dev:cli -- curl --silent --show-error --fail --output /dev/null http://varnish:8080/
# Enable dev modules.
- task dev:enable-dev-tools
# Show a one-time login to the local site.
- task dev:cli -- drush user-login

dev:enable-dev-tools:
desc: Enable dev modules and settings, which are not to be used in Prod. They are config-ignored
cmds:
- task dev:cli -- drush install -y field_ui views_ui

dev:enable-xdebug:
cmds:
- XDEBUG_ENABLE=true task dev:start
- read -p "Press enter to disable Xdebug"
- task dev:start

dev:phpunit:
desc: Run PHPUnit tests with code coverage
cmds:
Expand Down Expand Up @@ -194,7 +231,7 @@ tasks:
cmds:
- cmd: |
docker run --rm -v ${PWD}:/local -v ${PWD}/openapi-generator.config.fbs.yaml:/openapi-generator.config.fbs.yaml \
openapitools/openapi-generator-cli:v5.2.1 generate \
openapitools/openapi-generator-cli:v7.1.0 generate \
-i https://raw.githubusercontent.com/danskernesdigitalebibliotek/dpl-react/main/src/core/fbs/fbs-adapter.yaml \
-g php -o /local/packages/fbs-client -c /openapi-generator.config.fbs.yaml
Expand All @@ -216,6 +253,7 @@ tasks:
# All tests that delete mappings and make their own run afterwards.
- docker compose {{ .DOCKER_COMPOSE_FILES_CI }} run --rm -e CYPRESS_DRUPAL_USERNAME=$CYPRESS_DRUPAL_USERNAME -e CYPRESS_DRUPAL_PASSWORD=$CYPRESS_DRUPAL_PASSWORD cypress --spec "cypress/e2e/*.ts"
env:
DOCKER_COMPOSE_FILES: "{{ .DOCKER_COMPOSE_FILES_CI }}"
CYPRESS_DRUPAL_USERNAME: admin
CYPRESS_DRUPAL_PASSWORD: admin

Expand All @@ -227,6 +265,7 @@ tasks:
- task dev:cli -- drush user:password $CYPRESS_DRUPAL_USERNAME $CYPRESS_DRUPAL_PASSWORD
- http_proxy={{ .WIREMOCK_HOST_LOCAL }} https_proxy={{ .WIREMOCK_HOST_LOCAL_HTTPS }} npx cypress open
env:
DOCKER_COMPOSE_FILES: "{{ .DOCKER_COMPOSE_FILES_CI }}"
CYPRESS_BASE_URL: http://localhost:{{ .CYPRESS_BASE_PORT }}
CYPRESS_WIREMOCK_URL: '{{ .WIREMOCK_HOST_LOCAL }}'
CYPRESS_DRUPAL_USERNAME: admin
Expand Down Expand Up @@ -292,9 +331,9 @@ tasks:
- task: source:push

lagoon:drush:uli:
desc: Get an Drupal one-time login link for a Lagoon environment through Drush
desc: Get an Drupal one-time user login link for a Lagoon environment through Drush
cmds:
- task lagoon:cli -- drush uli
- task lagoon:cli -- drush user-login

lagoon:cli:
desc: Performs a command in a Lagoon environment and display the output. Expects parameter(s).
Expand Down
8 changes: 7 additions & 1 deletion assets/all.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
}

// Exclude development modules from configuration export.
$settings['config_exclude_modules'] = ['devel', 'field_ui', 'restui'];
$settings['config_exclude_modules'] = [
'devel',
'field_ui',
'views_ui',
'restui',
'upgrade_status',
];

// Defines where the sync folder of your configuration lives. In this case it's
// inside the Drupal root, which is protected by amazee.io Nginx configs, so it
Expand Down
6 changes: 6 additions & 0 deletions assets/local.services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
twig.config:
debug: true
services:
cache.backend.null:
class: Drupal\Core\Cache\NullBackendFactory
11 changes: 11 additions & 0 deletions assets/local.settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

# Enable verbose error reporting.
$config['system.logging']['error_level'] = 'verbose';

# Disable preprocessing
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;

# Disable caching.
$settings['cache']['default'] = 'cache.backend.null';
Loading

0 comments on commit 9d1f447

Please sign in to comment.