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

mdt-40224: Added CI environment support. #25

Merged
merged 3 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
71 changes: 71 additions & 0 deletions assets/drupal10/settings.ci.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

/**
* @file
* CI development override configuration feature.
*/

$loc_db_name = "drupal";
$loc_db_user = 'drupal';
$loc_db_pass = 'drupal';
$loc_db_host = "127.0.0.1";
$loc_db_port = '3306';

$databases = [
'default' =>
[
'default' =>
[
'database' => $loc_db_name,
'username' => $loc_db_user,
'password' => $loc_db_pass,
'host' => $loc_db_host,
'port' => $loc_db_port,
'driver' => 'mysql',
'prefix' => '',
],
],
];

/**
* Setup files on local.
*/
$settings['file_public_path'] = "sites/default/files";
$settings['file_private_path'] = "sites/default/files/private";
$settings["file_temp_path"] = 'sites/default/files/tmp';

/**
* Skip file system permissions hardening on local.
*/
$settings['skip_permissions_hardening'] = TRUE;

/**
* Access control for update.php script.
*/
$settings['update_free_access'] = TRUE;

/**
* Enable local development services.
*/
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';

/**
* Disable Drupal caching.
*/
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

/**
* Enable access to rebuild.php.
*
* This setting can be enabled to allow Drupal's php and database cached
* storage to be cleared via the rebuild.php page. Access to this page can also
* be gained by generating a query string from rebuild_token_calculator.sh and
* using these parameters in a request to rebuild.php.
*/
$settings['rebuild_access'] = TRUE;

/**
* Salt for one-time login links, cancel links, form tokens, etc.
*/
$settings['hash_salt'] = 'LOCAL_ONLY';
11 changes: 11 additions & 0 deletions assets/drupal10/settings.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@
}
}

/**
* Github Actions environment settings.
*/
if (getenv('CI') == 'GITHUB_ACTIONS') {
$path = DRUPAL_ROOT . "/sites/$site/settings/settings.ci.php";
// Load settings.
if (!empty($path) && file_exists($path)) {
require $path;
}
}

/**
* Lando environment settings.
*/
Expand Down
12 changes: 6 additions & 6 deletions assets/github-actions/workflows/pantheon_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
name: Pantheon Deploy
# Triggers the workflow on push or delete events
on: [push,delete]

jobs:
validate:
name: Validate Composer
name: Validate Composer Files
runs-on: ubuntu-latest
steps:
- name: checkout
Expand All @@ -29,12 +29,12 @@ jobs:
# - name: Fail if branch name does not match pantheon limitations
# run: TODO

gitsync:
name: Build and push repo
build_deploy:
name: Build and Deploy
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout.
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: '0'
Expand All @@ -44,7 +44,7 @@ jobs:
php-version: '8.3'
tools: composer:v2
extensions: mbstring, gd, intl, yaml, bcmath, curl
- name: Execute build script
- name: Run build script
env:
GIT_REMOTE: ${{ secrets.GIT_REMOTE_HOSTING }}
GIT_SSH_PRIVATE_KEY: ${{ secrets.PANTHEON_DEPLOYER_SSH_PRIVATE }}
Expand Down
10 changes: 10 additions & 0 deletions assets/misc/gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,19 @@ public.key

# Ignore .env files as they are personal
/.env
# Ignore files generated by MacOS
.DS_Store

# Ignore Test and CI artifacts.
/tests/backstop/backstop_data/bitmaps_reference
/tests/backstop/backstop_data/bitmaps_test
/tests/backstop/backstop_data/ci_report
/tests/backstop/backstop_data/html_report

# Cypress folders
/tests/cypress/screenshots/
/tests/cypress/videos/
/tests/backstop/backstop_data/

#Ignore Google Application credentials
google_application_credentials.json
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"[web-root]/sites/default/settings/pantheon-preproduction-services.yml": "assets/pantheon/pantheon-preproduction-services.yml",
"[web-root]/sites/default/settings/pantheon-production-services.yml": "assets/pantheon/pantheon-production-services.yml",
"[web-root]/sites/default/settings/settings.main.php": "assets/drupal10/settings.main.php",
"[web-root]/sites/default/settings/settings.ci.php": "assets/drupal10/settings.ci.php",
"[web-root]/sites/default/settings/settings.dev.php": "assets/drupal10/settings.dev.php",
"[web-root]/sites/default/settings/settings.lando.php": "assets/drupal10/settings.lando.php",
"[web-root]/sites/default/settings/settings.live.php": "assets/drupal10/settings.live.php",
Expand Down