Skip to content

Commit

Permalink
Merge pull request #216 from localgovdrupal/1.x
Browse files Browse the repository at this point in the history
Release 1.4.1
  • Loading branch information
stephen-cox authored Jun 6, 2022
2 parents dccab59 + 9ee9c9b commit 3e8acf2
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 44 deletions.
76 changes: 52 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: Test LocalGov Drupal Alert Banner
##
# Managed by https://github.com/localgovdrupal/github_workflow_manager
---
name: Test localgovdrupal/localgov_alert_banner drupal-module

on:
push:
Expand All @@ -8,6 +11,10 @@ on:
branches:
- '1.x'

env:
LOCALGOV_DRUPAL_PROJECT: localgovdrupal/localgov_alert_banner
LOCALGOV_DRUPAL_PROJECT_PATH: web/modules/contrib/localgov_alert_banner

jobs:

build:
Expand All @@ -17,9 +24,13 @@ jobs:
strategy:
fail-fast: false
matrix:
localgov-version: ["2.x"]
drupal-version: ["~9.1"]
php-version: ["7.4","8.1"]
localgov-version:
- '2.x'
drupal-version:
- '~9.3'
php-version:
- '7.4'
- '8.1'

steps:

Expand All @@ -28,14 +39,15 @@ jobs:
run: |
echo "GIT_BASE=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_REPO=${GITHUB_REPOSITORY}" >> $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
echo "GIT_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $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')
Expand Down Expand Up @@ -75,11 +87,18 @@ jobs:
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 from the repo that triggered this workflow
- name: Obtain the test target using Composer
if: env.HEAD_USER == 'localgovdrupal'
run: |
composer --working-dir=html config repositories.1 vcs git@github.com:${GIT_REPO}.git
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 localgovdrupal/${{ github.event.repository.name }}:"${COMPOSER_REF} as ${LATEST_RELEASE}"
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 }}

phpcs:
name: Coding standards checks
Expand All @@ -89,9 +108,13 @@ jobs:
strategy:
fail-fast: false
matrix:
localgov-version: ["2.x"]
drupal-version: ["~9.1"]
php-version: ["7.4","8.1"]
localgov-version:
- '2.x'
drupal-version:
- '~9.3'
php-version:
- '7.4'
- '8.1'

steps:

Expand All @@ -111,7 +134,7 @@ jobs:
- name: Run coding standards checks
run: |
cd html
./bin/phpcs -p web/modules/contrib/${{ github.event.repository.name }}
./bin/phpcs -p ${LOCALGOV_DRUPAL_PROJECT_PATH}
phpstan:
name: Deprecated code checks
Expand All @@ -121,9 +144,13 @@ jobs:
strategy:
fail-fast: false
matrix:
localgov-version: ["2.x"]
drupal-version: ["~9.1"]
php-version: ["7.4","8.1"]
localgov-version:
- '2.x'
drupal-version:
- '~9.3'
php-version:
- '7.4'
- '8.1'

steps:

Expand All @@ -143,8 +170,7 @@ jobs:
- name: Run deprecated code checks
run: |
cd html
./bin/phpstan analyse -c ./phpstan.neon ./web/modules/contrib/${{ github.event.repository.name }}
./bin/phpstan analyse -c ./phpstan.neon ${LOCALGOV_DRUPAL_PROJECT_PATH}
phpunit:
name: PHPUnit tests
needs: build
Expand All @@ -153,9 +179,13 @@ jobs:
strategy:
fail-fast: false
matrix:
localgov-version: ["2.x"]
drupal-version: ["~9.1"]
php-version: ["7.4","8.1"]
localgov-version:
- '2.x'
drupal-version:
- '~9.3'
php-version:
- '7.4'
- '8.1'

steps:

Expand All @@ -179,8 +209,6 @@ jobs:
- name: Run PHPUnit tests
run: |
mkdir -p ./html/web/sites/simpletest && chmod 777 ./html/web/sites/simpletest
# Older versions of Paratest (the one required by LocalGov 1.x) don't pickup
# environmental variables, so it's necessary to change the config file directly.
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 web/modules/contrib/${{ github.event.repository.name }}"
docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4 ${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }}"
12 changes: 0 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,5 @@
"suggest": {
"drupal/scheduled_transitions": "Gives the ability to schedule the publishing and unpublishing of alert banners",
"localgovdrupal/localgov_core": "^1 || ^2"
},
"extra": {
"enable-patching": true,
"composer-exit-on-patch-failure": true,
"patchLevel": {
"drupal/core": "-p2"
},
"patches": {
"drupal/condition_field": {
"Fix schema #3215202": "https://www.drupal.org/files/issues/2021-05-28/configuration-schema-fix-3215202-6.patch"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ targetEntityType: localgov_alert_banner
bundle: localgov_alert_banner
mode: default
content:
visibility:
weight: 3
label: above
settings: { }
third_party_settings: { }
type: condition_field_string
region: content
link:
weight: 2
label: hidden
Expand Down Expand Up @@ -58,3 +51,4 @@ hidden:
content_moderation_control: true
type_of_alert: true
uid: true
visibility: true
2 changes: 2 additions & 0 deletions config/install/user.role.emergency_publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ dependencies:
enforced:
module:
- localgov_alert_banner
config:
- workflows.workflow.localgov_alert_banners
id: emergency_publisher
label: 'Emergency publisher'
weight: -2
Expand Down
2 changes: 1 addition & 1 deletion localgov_alert_banner.module
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function localgov_alert_banner_configure_scheduled_transitions() {
// Configure scheduled transitions for alert banners.
$scheduled_transitions_config = \Drupal::service('config.factory')->getEditable('scheduled_transitions.settings');
$alert_banner_bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo('localgov_alert_banner');
$bundles = [];
$bundles = $scheduled_transitions_config->get('bundles');
foreach ($alert_banner_bundles as $bundle => $info) {
$bundles[] = [
'entity_type' => 'localgov_alert_banner',
Expand Down

0 comments on commit 3e8acf2

Please sign in to comment.