Skip to content

Commit

Permalink
I'll be flabberghasted it this even runs...
Browse files Browse the repository at this point in the history
  • Loading branch information
rachellawson committed Feb 1, 2024
1 parent 2d0ed7d commit d561ea4
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/snippets/settings.local.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* @file
* Settings file to connect to a local mysql.
* Copied into position on GitHub CI runs.
*/

$databases['default']['default']['database'] = "db";
$databases['default']['default']['username'] = "user";
$databases['default']['default']['password'] = "";
$databases['default']['default']['host'] = "localhost";
$databases['default']['default']['port'] = "30123";
$databases['default']['default']['driver'] = "mysql";


// This will prevent Drupal from setting read-only permissions on sites/default.
$settings['skip_permissions_hardening'] = TRUE;

// This will ensure the site can only be accessed through the intended host
// names. Additional host patterns can be added for custom configurations.
$settings['trusted_host_patterns'] = ['.*'];

// Don't use Symfony's APCLoader. ddev includes APCu; Composer's APCu loader has
// better performance.
$settings['class_loader_auto_detect'] = FALSE;

// Set $settings['config_sync_directory'] if not set in settings.php.
if (empty($settings['config_sync_directory'])) {
$settings['config_sync_directory'] = 'sites/default/files/sync';
}

// Enable verbose logging for errors.
// https://www.drupal.org/forum/support/post-installation/2018-07-18/enable-drupal-8-backend-errorlogdebugging-mode
$config['system.logging']['error_level'] = 'verbose';
56 changes: 56 additions & 0 deletions .github/workflows/behaviour.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Behaviour Tests
on: [push]

env:
PLATFORMSH_CLI_TOKEN: ${{ secrets.PLATFORMSH_CLI_TOKEN }}

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: gdate, dom, filter, gd, hash, json, pcre, PDO, session, SimpleXML, SPL, tokenizer, xml

- name: Composer Install
run: |
composer --no-interaction --no-progress --optimize-autoloader install
# Install Psh CLI.
- name: Install Psh CLI
run: curl -sS https://platform.sh/cli/installer | php

# If you need to connect to database.
- name: Load certificate
run: ~/.platformsh/bin/platform ssh-cert:load -y -vvv

- name: Add Psh to trusted keys
run: |
ssh-keyscan ssh.uk-1.platform.sh >> ~/.ssh/known_hosts
ssh-keyscan git.uk-1.platform.sh >> ~/.ssh/known_hosts
# Non-database Psh commands.
- name: Spin up environment
run: ~/.platformsh/bin/platform environment:activate -p XXX -e ${GITHUB_REF#refs/heads/} --yes

- name: connect to psh PR db
run: |
nohup platform tunnel:single --project=nlw7xhb3fyt7y --environment=${GITHUB_REF#refs/heads/} --port=30123 --relationship=database --yes & > phpd.log 2>&1 &
- name: Drupal config to access db
run: |
cp ./.github/snippets/settings.local.php ./web/sites/default/settings.local.php
# Finally, run the tests.
- name: Run Behat tests
run: |
./vendor/bin/behat
- name: Tear it all down
run: |
platform tunnel:close --project=nlw7xhb3fyt7y --environment=${GITHUB_REF#refs/heads/} --yes

0 comments on commit d561ea4

Please sign in to comment.