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

3.0.9 release #757

Merged
merged 13 commits into from
Aug 13, 2024
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
209 changes: 6 additions & 203 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,208 +7,11 @@ on:
pull_request:
branches:
- '3.x'

env:
LOCALGOV_DRUPAL_PROJECT: localgovdrupal/localgov
LOCALGOV_DRUPAL_PROJECT_PATH: web/profiles/contrib/localgov
workflow_dispatch:

jobs:

build:
name: Install LocalGov Drupal
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
localgov-version:
- '3.x'
drupal-version:
- '~10.0'
php-version:
- '8.1'
- '8.2'

steps:

- name: Save git branch and git repo names to env if this is not a pull request
if: github.event_name != 'pull_request'
run: |
echo "GIT_BASE=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "HEAD_USER=localgovdrupal" >> $GITHUB_ENV
- name: Save git branch and git repo names to env if this is a pull request
if: github.event_name == 'pull_request'
run: |
echo "GIT_BASE=${GITHUB_BASE_REF}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
export HEAD="${{ github.event.pull_request.head.label }}"
echo "HEAD_USER=${HEAD%%:*}" >> $GITHUB_ENV
- name: Set composer branch reference for version branches
if: endsWith(github.ref, '.x')
run: echo "COMPOSER_REF=${GIT_BRANCH}-dev" >> $GITHUB_ENV

- name: Set composer branch reference for non-version branches
if: endsWith(github.ref, '.x') == false
run: echo "COMPOSER_REF=dev-${GIT_BRANCH}" >> $GITHUB_ENV

- name: Get the latest tagged release for branch version
run: |
LATEST_RELEASE=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${GITHUB_REPOSITORY}/git/matching-refs/tags/${GIT_BASE%'.x'} | grep -Po '(?<=refs/tags/)[^"]+' | tail -1)
if [ -z $LATEST_RELEASE ]; then LATEST_RELEASE=1; fi
echo "LATEST_RELEASE=${LATEST_RELEASE}" >> $GITHUB_ENV
- name: Cached workspace
uses: actions/cache@v2
with:
path: ./html
key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}

- name: Clone drupal_container
uses: actions/checkout@v2
with:
repository: localgovdrupal/drupal-container
ref: php${{ matrix.php-version }}

- name: Create LocalGov Drupal project
run: |
composer create-project --stability dev --no-install localgovdrupal/localgov-project ./html "${{ matrix.localgov-version }}"
composer --working-dir=./html require --no-install localgovdrupal/localgov:${{ matrix.localgov-version }}-dev
composer --working-dir=./html require --no-install drupal/core-recommended:${{ matrix.drupal-version }} drupal/core-composer-scaffold:${{ matrix.drupal-version }} drupal/core-project-message:${{ matrix.drupal-version }} drupal/core-dev:${{ matrix.drupal-version }}
composer --working-dir=./html install
- name: Obtain the test target using Composer
if: env.HEAD_USER == 'localgovdrupal'
run: |
composer --working-dir=html config repositories.1 vcs git@github.com:${LOCALGOV_DRUPAL_PROJECT}.git
composer global config github-oauth.github.com ${{ github.token }}
composer --working-dir=./html require --with-all-dependencies ${LOCALGOV_DRUPAL_PROJECT}:"${COMPOSER_REF} as ${LATEST_RELEASE}"
- name: Obtain the test target using Git
if: env.HEAD_USER != 'localgovdrupal'
uses: actions/checkout@v2
with:
path: ${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }}

- name: Obtain dev dependencies
run: jq --raw-output '.["require-dev"] | values | to_entries[] | @sh "\(.key):\(.value)"' ./html/web/profiles/contrib/localgov/composer.json | xargs composer --working-dir=./html require

phpcs:
name: Coding standards checks
needs: build
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
localgov-version:
- '3.x'
drupal-version:
- '~10.0'
php-version:
- '8.1'
- '8.2'

steps:

- name: Cached workspace
uses: actions/cache@v2
with:
path: ./html
key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }}
restore-keys: |
localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}

- name: Run coding standards checks
run: |
cd html
./bin/phpcs -p ${LOCALGOV_DRUPAL_PROJECT_PATH}
phpstan:
name: Deprecated code checks
needs: build
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
localgov-version:
- '3.x'
drupal-version:
- '~10.0'
php-version:
- '8.1'
- '8.2'

steps:

- name: Cached workspace
uses: actions/cache@v2
with:
path: ./html
key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }}
restore-keys: |
localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}

- name: Run deprecated code checks
run: |
cd html
./bin/phpstan analyse -c ./phpstan.neon ${LOCALGOV_DRUPAL_PROJECT_PATH}
phpunit:
name: PHPUnit tests
needs: build
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
localgov-version:
- '3.x'
drupal-version:
- '~10.0'
php-version:
- '8.1'
- '8.2'

steps:

- name: Clone Drupal container
uses: actions/checkout@v2
with:
repository: localgovdrupal/drupal-container
ref: php${{ matrix.php-version }}

- name: Cached workspace
uses: actions/cache@v2
with:
path: ./html
key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }}
restore-keys: |
localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-
- name: Start Docker environment
run: docker-compose -f docker-compose.yml up -d

- name: Run PHPUnit tests
run: |
mkdir -p ./html/web/sites/simpletest && chmod 777 ./html/web/sites/simpletest
sed -i "s#http://localgov.lndo.site#http://drupal#" ./html/phpunit.xml.dist
docker exec -t drupal bash -c 'chown docker:docker -R /var/www/html'
docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4 /var/www/html/${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }}"
tests:
uses: localgovdrupal/localgov_shared_workflows/.github/workflows/test-module.yml@1.x
with:
project: 'localgovdrupal/localgov'
project_path: 'web/profiles/contrib/localgov'
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"drupal/gin_toolbar": "^1.0@beta",
"drupal/entity_browser": "^2.9",
"drupal/preview_link": "^2.1@alpha",
"drupal/redirect": "^1.6",
"drupal/redirect": "^1.10",
"drupal/simple_sitemap": "^4.1",
"drupal/search_api": "^1.21",
"drush/drush": ">=10",
Expand Down Expand Up @@ -59,14 +59,19 @@
},
"patches": {
"drupal/core": {
"Users can't reference unpublished content even when they have access to it. See https://www.drupal.org/project/drupal/issues/2845144": "https://www.drupal.org/files/issues/2024-02-13/2845144-87.patch"
"Users can't reference unpublished content even when they have access to it. See https://www.drupal.org/project/drupal/issues/2845144": "https://www.drupal.org/files/issues/2024-02-13/2845144-87.patch",
"Content moderation and Workspaces https://www.drupal.org/project/drupal/issues/3179199#comment-15711680": "https://www.drupal.org/files/issues/2024-08-11/3179199-3132022-content-moderation-workspaces-query.patch"
},
"drupal/preview_link": {
"Automatically populating multiple preview link entities #3439968": "https://www.drupal.org/files/issues/2024-05-22/3439968-4.diff",
"Add a 'copy to clipboard' feature for preview_link": "https://www.drupal.org/files/issues/2024-05-28/3449121-9.patch"
},
"drupal/pathauto": {
"Allow path generation inside of a workspace - and importantly don't regenerate when publishing space https://www.drupal.org/project/pathauto/issues/3283769": "https://www.drupal.org/files/issues/2024-04-08/3283769-10.patch"
},
"drupal/redirect": {
"Validation issue on adding url redirect: https://www.drupal.org/project/redirect/issues/3057250": "https://www.drupal.org/files/issues/2022-09-01/3057250-53.patch"
"Create redirect from path alias change and workspaces https://www.drupal.org/project/redirect/issues/3431260": "https://www.drupal.org/files/issues/2024-03-18/3431260.patch",
"Validation issue on adding url redirect: https://www.drupal.org/project/redirect/issues/3057250": "https://www.drupal.org/files/issues/2024-08-11/redirect--2024-08-11--3057250-79.patch"
}
}
}
Expand Down
30 changes: 30 additions & 0 deletions localgov.api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/**
* @file
* Hooks provided by the LocalGov install profile.
*/

/**
* @addtogroup hooks
* @{
*/

/**
* Run a task during the site installation process.
*
* This is intended for work that needs to happen when installing a localgov
* site, that can't happen in a module's hook_install(). This hook is invoked
* later in the install process, when everything bar the importing of
* translations is done.
*
* It can also be used to only run code during a site install, and not when a
* module is installed in an existing site.
*/
function hook_localgov_post_install(): void {
// Whatever your module needs to do goes here.
}

/**
* @} End of "addtogroup hooks".
*/
4 changes: 2 additions & 2 deletions localgov.install
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function localgov_install() {
// Enable entity_usage for media by default.
$entity_usage_config = $config_factory->getEditable('entity_usage.settings');
$local_task_enabled_entity_types = $entity_usage_config->get('local_task_enabled_entity_types');
if (!in_array('media', $local_task_enabled_entity_types)) {
if (!in_array('media', $local_task_enabled_entity_types, TRUE)) {
$local_task_enabled_entity_types[] = 'media';
$entity_usage_config->set('local_task_enabled_entity_types', $local_task_enabled_entity_types);
$entity_usage_config->save(TRUE);
Expand Down Expand Up @@ -94,7 +94,7 @@ function localgov_update_9503() {
$config_factory = \Drupal::configFactory();
$entity_usage_config = $config_factory->getEditable('entity_usage.settings');
$local_task_enabled_entity_types = $entity_usage_config->get('local_task_enabled_entity_types');
if (!in_array('media', $local_task_enabled_entity_types)) {
if (!in_array('media', $local_task_enabled_entity_types, TRUE)) {
$local_task_enabled_entity_types[] = 'media';
$entity_usage_config->set('local_task_enabled_entity_types', $local_task_enabled_entity_types);
$entity_usage_config->save(TRUE);
Expand Down
25 changes: 25 additions & 0 deletions localgov.profile
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,28 @@ function localgov_page_attachments(array &$attachments): void {
}
}
}

/**
* Implements hook_install_tasks().
*/
function localgov_install_tasks(array &$install_state): array {
return [
'localgov_post_install_task' => [
'display_name' => t('Localgov post install'),
'display' => TRUE,
],
];
}

/**
* This is an install step, added by localgov_install_tasks().
*
* We use this step to call a hook to allow other localgov modules to set things
* up as part of the site installation process that they can't do in their
* install hooks.
*/
function localgov_post_install_task(): void {
\Drupal::moduleHandler()->invokeAllWith('localgov_post_install', function (callable $hook, string $module) {
$hook();
});
}