Skip to content

Commit

Permalink
Merge pull request #286 from City-of-Helsinki/UHF-9125
Browse files Browse the repository at this point in the history
UHF-9125: Update platform
  • Loading branch information
tuutti authored Oct 10, 2023
2 parents 5dd6f0b + 5d11ed1 commit 745815a
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 124 deletions.
12 changes: 4 additions & 8 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@ DRUPAL_HOSTNAME=helfi-elo.docker.so
OC_PROJECT_NAME=hki-kanslia-tyo-yrittaminen-test

# Stage file proxy origin domain
STAGE_FILE_PROXY_ORIGIN=https://tyoyrittaminen.blob.core.windows.net

STAGE_FILE_PROXY_ORIGIN=
# Stage file proxy path
STAGE_FILE_PROXY_ORIGIN_DIR=

# Docker image
DRUPAL_IMAGE=ghcr.io/city-of-helsinki/drupal-web:8.1
COMPOSE_PROFILES=queue

# Default source @alias where to sync database and files from
DRUPAL_SYNC_SOURCE=main
# Docker image
DRUPAL_IMAGE=ghcr.io/city-of-helsinki/drupal-web:8.2

# Public webroot
DRUPAL_WEBROOT=public

DRUPAL_SYNC_FILES=no
13 changes: 6 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ on:
name: CI
env:
SYMFONY_DEPRECATIONS_HELPER: disabled
SIMPLETEST_BASE_URL: http://app:8888
jobs:
tests:
runs-on: ubuntu-latest
container:
image: ghcr.io/city-of-helsinki/drupal-php-docker:8.2-alpine
options: --hostname app

services:
db:
Expand All @@ -31,7 +33,7 @@ jobs:
run: composer install --no-interaction

- name: Scan security updates
run: drush pm:security
run: composer audit

- name: Check that subtheme is not built with dev mode
run: if grep -q 'sourceMappingURL=' -R public/themes/custom/hdbt_subtheme/dist/css; then exit 1; fi
Expand All @@ -53,16 +55,13 @@ jobs:
- name: Start services
run: |
drush runserver $SIMPLETEST_BASE_URL > /dev/null 2>&1 &
chromedriver --port=4444 > /dev/null 2>&1 &
# Chromium browser is required to run 'functional-javascript' and
# 'existing-site-javascript' tests.
chromium-browser --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 &
drush runserver $SIMPLETEST_BASE_URL --dns > /dev/null 2>&1 &
# Wait for drush server to start.
for i in {1..5}; do RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$SIMPLETEST_BASE_URL" || true); if [ "$RESPONSE_CODE" -gt "301" ] || [ "$RESPONSE_CODE" -lt "200" ]; then sleep 2; fi; done
- name: Run PHPUnit tests
run: |
composer test-php public/modules/custom
[ -d "tests/" ] && composer test-php tests/ || echo "No DTT tests found. Ignoring..."
if [ -d "tests/" ]; then composer test-php tests/; else echo "No DTT tests found. Ignoring..."; fi
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"drupal/coder": "^8.3",
"drupal/core-dev": "^9.1",
"phpspec/prophecy-phpunit": "^2",
"phpunit/phpunit": "^9.6"
"phpunit/phpunit": "^9.6",
"weitzman/drupal-test-traits": "^2.1"
},
"conflict": {
"drupal/drupal": "*"
Expand All @@ -44,6 +45,9 @@
"cweagans/composer-patches": true,
"drupal/core-composer-scaffold": true,
"php-http/discovery": false
},
"audit": {
"abandoned": "report"
}
},
"extra": {
Expand Down
69 changes: 61 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 57 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ services:
STAGE_FILE_PROXY_ORIGIN: "${STAGE_FILE_PROXY_ORIGIN}"
STAGE_FILE_PROXY_ORIGIN_DIR: "${STAGE_FILE_PROXY_ORIGIN_DIR}"
APP_ENV: "${APP_ENV:-local}"
ELASTIC_PROXY_URL: ${ELASTIC_PROXY_URL:-""}
DRUPAL_ROUTES: "https://varnish-${DRUPAL_HOSTNAME},https://helfi-proxy.docker.so,http://${COMPOSE_PROJECT_NAME}-varnish"
DRUPAL_REVERSE_PROXY_ADDRESS: helfi-proxy.docker.so
DRUSH_OPTIONS_URI: "https://${DRUPAL_HOSTNAME}"
Expand All @@ -21,9 +22,9 @@ services:
# xdebug by default (like /etc/environments, ~/.bashrc, or ~/.zshrc).
XDEBUG_ENABLE: "${XDEBUG_ENABLE:-false}"
# DOCKERHOST: host.docker.internal
# Use drush server to run functional tests so we don't have to care about
# permission issues.
SIMPLETEST_BASE_URL: "http://127.0.0.1:8888"
# Use drush server to run functional tests, so we don't have to care about
# permission or SSL issues.
SIMPLETEST_BASE_URL: "http://app:8888"
SIMPLETEST_DB: "mysql://drupal:drupal@db:3306/drupal"
BROWSERTEST_OUTPUT_BASE_URL: "https://${DRUPAL_HOSTNAME}"
DRUPAL_VARNISH_HOST: "${COMPOSE_PROJECT_NAME}-varnish"
Expand Down Expand Up @@ -82,6 +83,59 @@ services:
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-varnish.tls=true"
- "traefik.http.services.${COMPOSE_PROJECT_NAME}-varnish.loadbalancer.server.port=6081"
- "traefik.docker.network=stonehenge-network"
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:8.4.0
container_name: "${COMPOSE_PROJECT_NAME}-elastic"
environment:
- node.name="${COMPOSE_PROJECT_NAME}-elastic"
- discovery.seed_hosts=elastic
- cluster.name=es-docker-cluster
- cluster.initial_master_nodes="${COMPOSE_PROJECT_NAME}-elastic"
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "http.cors.allow-origin=\"*\""
- "http.cors.enabled=true"
- "http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization"
- "http.cors.allow-credentials=true"
- xpack.security.enabled=false
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200-9220:9200
networks:
- internal
- stonehenge-network
labels:
- "traefik.enable=true"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-elastic.entrypoints=https"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-elastic.rule=Host(`elastic-${DRUPAL_HOSTNAME}`)"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-elastic.tls=true"
- "traefik.http.services.${COMPOSE_PROJECT_NAME}-elastic.loadbalancer.server.port=9200"
- "traefik.docker.network=stonehenge-network"
- "traefik.port=9200"
profiles:
- search
artemis:
container_name: "${COMPOSE_PROJECT_NAME}-artemis"
image: quay.io/artemiscloud/activemq-artemis-broker
environment:
AMQ_EXTRA_ARGS: "--nio --user admin --password admin"
depends_on:
- app
networks:
- internal
profiles:
- queue
chromium:
# @todo Update this to newer version once minkphp supports Selenium 4.
# @see https://github.com/minkphp/MinkSelenium2Driver/pull/372
image: selenium/standalone-chrome:106.0
networks:
- internal
profiles:
- testing
networks:
internal:
external: false
Expand Down
22 changes: 13 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./public/core/tests/bootstrap.php" colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutCoversAnnotation="false"
printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutCoversAnnotation="false"
failOnRisky="true"
failOnWarning="true"
failOnSkipped="true"
verbose="true"
printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter"
>
<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"/>
<env name="BROWSERTEST_OUTPUT_DIRECTORY" value="public/sites/simpletest"/>
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", {"browserName":"chrome","chromeOptions":{"w3c": false, "args":["--disable-gpu","--headless", "--no-sandbox"]}}, "http://127.0.0.1:4444"]' />
<env name="DTT_MINK_DRIVER_ARGS" value='["chrome", {"chromeOptions":{"w3c": false }}, "http://127.0.0.1:4444"]'/>
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", {"browserName":"chrome","chromeOptions":{"w3c": false}}, "http://chromium:4444"]' />
<env name="DTT_MINK_DRIVER_ARGS" value='["chrome", {"chromeOptions":{"w3c": false }}, "http://chromium:4444"]'/>
<env name="DTT_API_OPTIONS" value='{"socketTimeout": 360, "domWaitTimeout": 3600000}' />
<env name="DTT_API_URL" value="http://127.0.0.1:9222"/>
<env name="DTT_BASE_URL" value="http://127.0.0.1:8888"/>
<env name="DTT_API_URL" value="http://chromium:9222"/>
<env name="DTT_BASE_URL" value="http://app:8888"/>
</php>
<testsuites>
<testsuite name="unit">
Expand Down
Loading

0 comments on commit 745815a

Please sign in to comment.