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

Dev to main #627

Merged
merged 22 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
14d080a
UHF-10555: Remove references to deprecated image style 3_2_m_2x that …
teroelonen Dec 3, 2024
646270b
Merge pull request #624 from City-of-Helsinki/UHF-10555
teroelonen Dec 5, 2024
eb94b28
Helbit client id was accidentally removed in UHF-10549
hyrsky Dec 5, 2024
93b5e7f
Update configuration
hel-platta-automation Dec 5, 2024
8b7d8c2
Allow videos in non-finnish job listings
hyrsky Dec 5, 2024
ef2bcea
Merge pull request #628 from City-of-Helsinki/UHF-X-helbit-client
hyrsky Dec 5, 2024
7b59180
Merge pull request #630 from City-of-Helsinki/UHF-X-video-migration
hyrsky Dec 5, 2024
491f722
Merge pull request #629 from City-of-Helsinki/update-configuration
teroelonen Dec 9, 2024
786d81f
Update configuration
hel-platta-automation Dec 12, 2024
95ed27c
Updated workflows.
khalima Dec 12, 2024
26c588b
Merge pull request #631 from City-of-Helsinki/update-configuration
khalima Dec 12, 2024
76e3b25
Update configuration
hel-platta-automation Dec 13, 2024
3acfb90
Merge pull request #632 from City-of-Helsinki/update-configuration
khalima Dec 13, 2024
c1e15eb
UHF-11137: Run CI pipelines using Docker compose setup
tuutti Dec 13, 2024
5209153
Merge pull request #633 from City-of-Helsinki/UHF-11137
tuutti Dec 13, 2024
646014a
Update configuration
hel-platta-automation Dec 17, 2024
0322d57
Merge pull request #635 from City-of-Helsinki/update-configuration
teroelonen Dec 17, 2024
1b0f342
Update configuration
hyrsky Dec 17, 2024
515258e
Enable dependabot for testing
hyrsky Dec 17, 2024
665e60e
Fix phpcs errors
hyrsky Dec 17, 2024
81f82ee
Fix phpstan
hyrsky Dec 17, 2024
16acdfc
Merge pull request #636 from City-of-Helsinki/update-configuration
hyrsky Dec 17, 2024
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
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git/
.github/
.idea/
*.sql
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "composer" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
allow:
# Update only direct dependencies. This reduces spam since most
# indirect dependencies are handles by update-config workflow.
- dependency-type: "direct"
ignore:
# Updated by update-config workflow
- dependency-name: "drupal/helfi_*"
- dependency-name: "drupal/hdbt*"
# Updated separately
- dependency-name: "drupal/core*"
38 changes: 19 additions & 19 deletions .github/workflows/artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ name: Build artifacts
jobs:
build:
runs-on: ubuntu-latest
container:
image: ghcr.io/city-of-helsinki/drupal-php-docker:8.3-alpine

services:
db:
image: mysql:8
env:
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
MYSQL_DATABASE: drupal
MYSQL_ROOT_PASSWORD: drupal
ports:
- 3306:3306

steps:
- uses: actions/checkout@v4

- name: Install and start Stonehenge
run: |
git clone -b 5.x https://github.com/druidfi/stonehenge.git ~/stonehenge
cd ~/stonehenge && make up

# This must be done after we start Stonehenge.
- name: Setup Docker compose environment variables
run: |
echo "COMPOSE_FILE=compose.yaml:compose.ci.yaml" >> $GITHUB_ENV

- name: Start project
run: make up

- name: Build project
run: composer install --no-interaction
run: docker compose exec app bash -c "composer install --no-interaction"

- name: Setup drupal and save database dump
run: |
drush si -y && drush cr
drush si --existing-config -y
drush cim -y
drush sql-dump --result-file=${GITHUB_WORKSPACE}/latest.sql
docker compose exec app bash -c "drush si -y && drush cr"
docker compose exec app bash -c "drush si --existing-config -y"
docker compose exec app bash -c "drush cr"
docker compose exec app bash -c "drush cim -y"
docker compose exec app bash -c "drush sql-dump --result-file=/app/latest.sql"

- name: Upload latest database dump
uses: actions/upload-artifact@v4
Expand Down
70 changes: 32 additions & 38 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,12 @@ on:
push:
branches: ['main', 'dev']
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.3-alpine
options: --hostname app

services:
db:
image: mysql:8
env:
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
MYSQL_DATABASE: drupal
MYSQL_ROOT_PASSWORD: drupal
ports:
- 3306:3306
steps:
- uses: actions/checkout@v4

- name: Set browsertest output folder
run: |
echo "BROWSERTEST_OUTPUT_DIRECTORY=$GITHUB_WORKSPACE/public/sites/simpletest" >> $GITHUB_ENV

- name: Make sure configuration was exported in correct language (en or und)
run: |
OUTPUT=$(grep -oP '^langcode: \b(?!(?:en|und)\b)\w+' conf -R || true)
Expand All @@ -40,22 +19,36 @@ jobs:
exit 1
fi

- name: Install and start Stonehenge
run: |
git clone -b 5.x https://github.com/druidfi/stonehenge.git ~/stonehenge
cd ~/stonehenge && make up

# This must be done after we start Stonehenge.
- name: Setup Docker compose environment variables
run: |
echo "COMPOSE_FILE=compose.yaml:compose.ci.yaml" >> $GITHUB_ENV
echo "COMPOSE_PROFILES=" >> $GITHUB_ENV

- name: Start project
run: make up

- name: Build project
run: composer install --no-interaction
run: docker compose exec app bash -c "composer install --no-interaction"

- name: Scan security updates
run: composer audit
run: docker compose exec app bash -c "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
run: docker compose exec app bash -c "if grep -q 'sourceMappingURL=' -R public/themes/custom/hdbt_subtheme/dist/css; then exit 1; fi"

- name: Run PHPCS
run: |
vendor/bin/phpcs public/modules/custom/
vendor/bin/phpcs public/themes/custom/
docker compose exec app bash -c "vendor/bin/phpcs public/modules/custom/"
docker compose exec app bash -c "vendor/bin/phpcs public/themes/custom/"

- name: Run phpstan
run: vendor/bin/phpstan analyze
run: docker compose exec app bash -c "vendor/bin/phpstan analyze"

- name: Download latest dump
env:
Expand All @@ -64,25 +57,26 @@ jobs:

- name: Install Drupal
run: |
mysql --user=drupal --password=drupal --database=drupal --host=db --port=3306 -A < latest.sql
drush deploy
docker compose exec app bash -c "mysql --user=drupal --password=drupal --database=drupal --host=db --port=3306 -A < latest.sql"
docker compose exec app bash -c "drush deploy"

- name: Start services
- name: Run PHPUnit tests
run: |
drush runserver $SIMPLETEST_BASE_URL --dns > /dev/null 2>&1 &
docker compose exec app bash -c "mkdir -p /app/results"

# 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
if [ -d "tests/" ]; then
docker compose exec app bash -c "composer test-php tests/"
fi
docker compose exec app bash -c "composer test-php public/modules/custom"

- name: Run PHPUnit tests
run: |
composer test-php public/modules/custom
if [ -d "tests/" ]; then composer test-php tests/; else echo "No DTT tests found. Ignoring..."; fi
- name: Export logs
if: always()
run: docker compose logs app > results/service.log

- name: Create an artifact from test report
uses: actions/upload-artifact@v4
if: always()
with:
name: results
path: ${{ env.BROWSERTEST_OUTPUT_DIRECTORY }}
path: results/
retention-days: 1
3 changes: 2 additions & 1 deletion .github/workflows/update-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ jobs:
update-config:
runs-on: ubuntu-latest
container:
image: ghcr.io/city-of-helsinki/drupal-php-docker:8.3-alpine
image: ghcr.io/city-of-helsinki/drupal-web:8.3
options: --hostname app --user 1001
services:
db:
image: mysql:8
Expand Down
2 changes: 1 addition & 1 deletion .platform/schema
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
14
6 changes: 6 additions & 0 deletions compose.ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
app:
user: "1001:1001"
environment:
SYMFONY_DEPRECATIONS_HELPER: disabled
BROWSERTEST_OUTPUT_DIRECTORY: /app/results
20 changes: 15 additions & 5 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
depends_on:
- db
environment:
WEBROOT: /app/public
STAGE_FILE_PROXY_ORIGIN: "${STAGE_FILE_PROXY_ORIGIN}"
STAGE_FILE_PROXY_ORIGIN_DIR: "${STAGE_FILE_PROXY_ORIGIN_DIR}"
APP_ENV: "${APP_ENV:-local}"
Expand All @@ -24,7 +25,6 @@ services:
# DOCKERHOST: host.docker.internal
# 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"
BROWSERTEST_OUTPUT_BASE_URL: "https://${DRUPAL_HOSTNAME}"
BROWSERTEST_OUTPUT_DIRECTORY: "/app/public/sites/default/files/simpletest"
DRUPAL_VARNISH_HOST: "${COMPOSE_PROJECT_NAME}-varnish"
Expand Down Expand Up @@ -87,6 +87,8 @@ 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"
profiles:
- varnish
elastic-proxy:
container_name: "${COMPOSE_PROJECT_NAME}-elastic-proxy"
image: nginxinc/nginx-unprivileged:alpine-perl
Expand Down Expand Up @@ -116,7 +118,7 @@ services:
profiles:
- search
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:8.16.1
image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
container_name: "${COMPOSE_PROJECT_NAME}-elastic"
environment:
- node.name="${COMPOSE_PROJECT_NAME}-elastic"
Expand Down Expand Up @@ -160,13 +162,21 @@ services:
profiles:
- queue
chromium:
# @todo Update this to newer version once minkphp supports Selenium 4.
# @see https://github.com/minkphp/MinkSelenium2Driver/pull/372
image: seleniarm/standalone-chromium:106.0
image: selenium/standalone-chromium
environment:
SE_NODE_OVERRIDE_MAX_SESSIONS: "true"
SE_NODE_MAX_SESSIONS: "16"
SE_START_XVFB: "false"
SE_START_VNC: "false"
SE_SESSION_RETRY_INTERVAL: "1"
SE_SESSION_REQUEST_TIMEOUT: "10"
depends_on:
- app
networks:
- internal
profiles:
- testing

networks:
internal:
external: false
Expand Down
13 changes: 4 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,9 @@
"require-dev": {
"dg/bypass-finals": "^1.5",
"donatj/mock-webserver": "^2.4",
"drupal/coder": "^8.3",
"drupal/core-dev": "^10.0",
"drupal/core-dev": "^10",
"jangregor/phpstan-prophecy": "^1.0",
"mglaman/phpstan-drupal": "^1.2",
"phpspec/prophecy-phpunit": "^2",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpunit/phpunit": "^9.6",
"weitzman/drupal-test-traits": "^2.0"
},
"conflict": {
Expand All @@ -47,12 +41,13 @@
"optimize-autoloader": true,
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/installers": true,
"cweagans/composer-patches": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"drupal/core-composer-scaffold": true,
"php-http/discovery": false,
"phpstan/extension-installer": true,
"php-http/discovery": false
"tbachert/spi": false
},
"audit": {
"abandoned": "report",
Expand Down
Loading
Loading