Skip to content

Commit

Permalink
Merge pull request #1339 from UN-OCHA/release-versions/v1.13.16
Browse files Browse the repository at this point in the history
release versions/v1.13.16
  • Loading branch information
berliner authored Feb 27, 2025
2 parents 79380c1 + fbaf4cd commit 918415e
Show file tree
Hide file tree
Showing 160 changed files with 9,120 additions and 6,129 deletions.
45 changes: 35 additions & 10 deletions .docksal/commands/phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,66 @@ if [[ ! -f "$phpunit_xml_path" ]]; then
fi

phpunit_path="vendor/bin/phpunit"
paraunit_path="vendor/bin/paraunit"

if [[ ! -f "$phpunit_path" ]]; then
echo "Could not find $phpunit_path"
exit 1
fi


COVERAGE=false
CLEAR_LOGS=false
PARALLEL=true
args=""
while [ "$1" != "" ]; do
case $1 in
--open-coverage ) COVERAGE=true
;;
*) args="$args $1"
;;
-c | --clear-logs)
CLEAR_LOGS=true
;;
--open-coverage)
COVERAGE=true
;;
-s | --force-sequential)
PARALLEL=false
;;
*)
args="$args $1"
;;
esac
shift
done

if $PARALLEL; then
if [[ ! -f "$paraunit_path" ]]; then
echo "Could not find $paraunit_path"
exit 1
fi
fi

timestamp=`date +%s`
COVERAGE_FILE="$path/$DOCROOT/sites/simpletest/coverage/coverage-${timestamp}.cov"

# fin exec "mkdir -p $path/$DOCROOT/sites/simpletest/coverage"
fin exec "mkdir -p $path/$DOCROOT/sites/simpletest/coverage"

if [ "${#args}" -eq 0 ]; then
if [ "${#args}" -eq 0 ] || $CLEAR_LOGS; then
# Clear coverage repository if the full test suite is run, meaning phpunit is
# invoked without any argument.
fin exec "rm -r $path/$DOCROOT/sites/simpletest/coverage/*"
fin exec "rm -r $path/$DOCROOT/sites/simpletest/browser-output/Drupal_* 2> /dev/null"
fin exec "rm -r $path/$DOCROOT/sites/simpletest/coverage/* 2> /dev/null"
fin exec "rm -r $path/$DOCROOT/sites/simpletest/coverage-html/* 2> /dev/null"
fi

# Always create a dedicated coverage file for each test run. They get later
# merged together into an HTML report
fin exec "XDEBUG_MODE=coverage $path/${phpunit_path} -c $path ${args} $path/$DOCROOT/modules/custom --coverage-php $path/$DOCROOT/sites/simpletest/coverage/coverage-${timestamp}.cov"
if $PARALLEL; then
fin exec "XDEBUG_MODE=coverage $path/${paraunit_path} coverage -c $path ${args} --php $COVERAGE_FILE"
else
fin exec "XDEBUG_MODE=coverage $path/${phpunit_path} -c $path ${args} --coverage-php $COVERAGE_FILE"
fi

# Create the HTML report.
fin exec "phpcov merge --html $path/$DOCROOT/sites/simpletest/coverage-html $path/$DOCROOT/sites/simpletest/coverage"

if $COVERAGE; then
fin utils/open-link "http://ghi-site.docksal.site/sites/simpletest/test-coverage/dashboard.html"
fin utils/open-link "http://${VIRTUAL_HOST}/sites/simpletest/coverage-html/dashboard.html"
fi
14 changes: 10 additions & 4 deletions .docksal/docksal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,22 @@ services:

browser:
hostname: browser
# image: seleniarm/standalone-chromium:latest
image: seleniarm/standalone-chromium:103.0
image: selenium/standalone-chromium:latest
volumes:
# Workaround to avoid the browser crashing inside a docker container
# See https://github.com/SeleniumHQ/docker-selenium#quick-start
- /tmp:/dev/shm
- ${PROJECT_ROOT}/logs/chromedriver:/var/log/chromedriver
environment:
- JAVA_OPTS=-Dwebdriver.chrome.whitelistedIps=
# - JAVA_OPTS=-Dwebdriver.chrome.whitelistedIps=
- 'JAVA_OPTS=-Dwebdriver.chrome.logfile=/var/log/chromedriver/chromedriver.log'
- 'SE_NODE_MAX_SESSIONS=2'
- 'SE_NODE_STEREOTYPE={"browserName": "chrome"}'
# shm_size: '2gb'
ports:
- 5903:5903
- 5900:5900
- 7900:7900
- 4444:4444

snap:
image: public.ecr.aws/unocha/tools-snap-service:v3.0.4
Expand Down
2 changes: 1 addition & 1 deletion .docksal/etc/apache/httpd-vhost-overrides.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<IfModule mod_rewrite.c>
RewriteEngine on
SSLProxyEngine on
#Add the string and keep hidden from user with [P]
# Add the string and keep hidden from user with [P]
RewriteCond %{QUERY_STRING} ^(([^&]*&)*)access_token=token(&.*)?$
RewriteRule ^/mapbox/(.*)$ https://api.mapbox.com/$1?%1access_token=${MAPBOX_TOKEN}%3 [P]
</IfModule>
1 change: 1 addition & 0 deletions .github/workflows/composer-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
aws_secret_access_key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
github_access_token: ${{ secrets.PAT }}
patch_branch: ${{ github.head_ref || github.ref_name }}
patch_config: false
patch_maintainers: ${{ vars.DRUPAL_MAINTAINERS }}
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
slack_channel_name: ${{ vars.SLACK_CHANNEL }}
13 changes: 6 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
tests:
runs-on: ubuntu-latest
permissions:
contents: write
contents: write
checks: write
pull-requests: write
actions: read
statuses: write
pull-requests: write
actions: read
statuses: write

steps:
- name: Checkout Code
Expand Down Expand Up @@ -103,6 +103,7 @@ jobs:
with:
run: |
docker compose -f .github/tests/docker-compose.yml exec -w /srv/www -T drupal /usr/bin/composer run sub-theme
- name: PHPCS
id: phpcs
uses: cafuego/command-output@main
Expand Down Expand Up @@ -133,7 +134,7 @@ jobs:
docker compose -f .github/tests/docker-compose.yml exec -T drupal chmod -R 777 /srv/www/html/build/logs
docker compose -f .github/tests/docker-compose.yml exec -T drupal mkdir -p /srv/www/html/sites/simpletest/browser_output
docker compose -f .github/tests/docker-compose.yml exec -T drupal chmod -R 777 /srv/www/html/sites/simpletest
docker compose -f .github/tests/docker-compose.yml exec -T -u appuser -w /srv/www -e XDEBUG_MODE=coverage -e BROWSERTEST_OUTPUT_DIRECTORY=/tmp -e BROWSERTEST_OUTPUT_BASE_URL=http://127.0.0.1:8081 -e DTT_BASE_URL=http://127.0.0.1 -e SIMPLETEST_BASE_URL=http://127.0.0.1 -e SIMPLETEST_DB=mysql://ghi:ghi@mysql/ghi drupal ./vendor/bin/phpunit --coverage-clover /srv/www/html/build/logs/clover.xml --debug -c /srv/www
docker compose -f .github/tests/docker-compose.yml exec -T -u appuser -w /srv/www -e XDEBUG_MODE=coverage -e BROWSERTEST_OUTPUT_DIRECTORY=/tmp -e BROWSERTEST_OUTPUT_BASE_URL=http://127.0.0.1:8081 -e DTT_BASE_URL=http://127.0.0.1 -e SIMPLETEST_BASE_URL=http://127.0.0.1 -e SIMPLETEST_DB=mysql://ghi:ghi@mysql/ghi drupal ./vendor/bin/paraunit coverage --clover /srv/www/html/build/logs/clover.xml -c /srv/www
env:
fail-fast: true

Expand Down Expand Up @@ -166,15 +167,13 @@ jobs:
uses: peter-evans/find-comment@v2
id: fc
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Build output

- name: Create or update comment
uses: peter-evans/create-or-update-comment@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ buildlog.txt
/private/
/notes/
/logs
/tests

###> squizlabs/php_codesniffer ###
/.phpcs-cache
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,17 @@ The tests can be optionally filtered down very specifically, e.g.:

fin phpunit --filter testImportParagraphs

Testing against chromium browser via selenium grid should be setup and ready to use out of the box.

Local VNC to observe the browser actions in real time:

http://ghi-site.docksal.site::7900

Access to the Selenium Grid UI:

http://ghi-site.docksal.site:4444/ui



REFERENCES
----------
Expand Down
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
"drupal/ctools": "^3.7",
"drupal/editor_advanced_link": "^2.2",
"drupal/entity_access_password": "^1.0",
"drupal/entity_browser": "^2.12",
"drupal/entity_browser_table": "^1.4",
"drupal/field_group": "^3.1",
"drupal/flat_taxonomy": "^2.0",
"drupal/fpa": "^4.0.0",
Expand Down Expand Up @@ -133,11 +135,6 @@
"drupal/webp": "^1.0-beta7",
"drush/drush": "^12.4",
"npm-asset/d3": "^7.4",
"npm-asset/leaflet": "^1.7",
"npm-asset/leaflet-modal": "^0.2.0",
"npm-asset/leaflet-providers": "^1.13",
"npm-asset/leaflet-search": "^3",
"npm-asset/leaflet-sidebar": "^0.2.2",
"npm-asset/select2": "^4.0",
"npm-asset/swiper": "^8.1",
"oomphinc/composer-installers-extender": "^2.0",
Expand All @@ -153,6 +150,7 @@
"drupal/devel": "^5.0",
"drupal/xhprof": "^1.0@beta",
"drupal/yaml_content": "^1.0@alpha",
"facile-it/paraunit": "^1.3",
"phpcompatibility/php-compatibility": "^9.3",
"phpmd/phpmd": "^2.9",
"phpspec/prophecy-phpunit": "^2",
Expand Down
Loading

0 comments on commit 918415e

Please sign in to comment.