Skip to content

Commit

Permalink
Merge pull request #35 from localgovdrupal/1.x
Browse files Browse the repository at this point in the history
PR for 1.0.0-beta6
  • Loading branch information
markconroy authored Aug 27, 2024
2 parents 9faa6b0 + 55476ea commit bdf748c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 208 deletions.
209 changes: 6 additions & 203 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
##
# Managed by https://github.com/localgovdrupal/github_workflow_manager
---
name: Test localgovdrupal/localgov_sa11y drupal-module

on:
Expand All @@ -10,205 +7,11 @@ on:
pull_request:
branches:
- '1.x'

env:
LOCALGOV_DRUPAL_PROJECT: localgovdrupal/localgov_sa11y
LOCALGOV_DRUPAL_PROJECT_PATH: web/modules/contrib/localgov_sa11y
workflow_dispatch:

jobs:

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

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

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 }}

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

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

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:
include:
- localgov-version: '2.x'
drupal-version: '~9.4'
php-version: '8.1'
- localgov-version: '3.x'
drupal-version: '~10.0'
php-version: '8.1'

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:
include:
- localgov-version: '2.x'
drupal-version: '~9.4'
php-version: '8.1'
- localgov-version: '3.x'
drupal-version: '~10.0'
php-version: '8.1'

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 ${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }}"
tests:
uses: localgovdrupal/localgov_shared_workflows/.github/workflows/test-module.yml@1.x
with:
project: 'localgovdrupal/localgov_sa11y'
project_path: 'web/modules/contrib/localgov_sa11y'
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@

Integrates the [Sa11y accessibility checker](https://sa11y.netlify.app/) into LocalGov Drupal.

## Maintainers
## Using
Enbale the module like any other Drupal module.
Set what roles can use the Sa11y widget via the `use_localgov_sa11y` permission.

The module is set to only work on pages that are not using the admin theme.

This project is currently maintained by:
Now when you visit any page on your site using your frontend theme, you should see the Sa11y widget in the bottom right corner.

## Maintainers
This project is currently maintained by:

- Mark Conroy https://github.com/markconroy
- Maria Young https://github.com/msayoung
4 changes: 2 additions & 2 deletions localgov_sa11y.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ localgov_sa11y:

sa11y-files:
js:
https://cdn.jsdelivr.net/combine/gh/ryersondmp/sa11y@3.0.0/dist/js/lang/en.umd.js,gh/ryersondmp/sa11y@3.0.0/dist/js/sa11y.umd.min.js: { type: external, minified: true}
https://cdn.jsdelivr.net/combine/gh/ryersondmp/sa11y@3.2.2/dist/js/lang/en.umd.js,gh/ryersondmp/sa11y@3.2.2/dist/js/sa11y.umd.min.js: { type: external, minified: true}
css:
theme:
https://cdn.jsdelivr.net/gh/ryersondmp/sa11y@3.0.0/dist/css/sa11y.min.css: { type: external, minified: true}
https://cdn.jsdelivr.net/gh/ryersondmp/sa11y@3.2.2/dist/css/sa11y.min.css: { type: external, minified: true}
2 changes: 1 addition & 1 deletion localgov_sa11y.permissions.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
use_localgov_sa11y:
title: 'Use localgov_sa11y'
title: 'Use LocalGov Sa11y'
restrict access: true

0 comments on commit bdf748c

Please sign in to comment.