Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.
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
70 changes: 0 additions & 70 deletions .github/workflows/localgov-drupal-ci.yml

This file was deleted.

159 changes: 159 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Test LocalGov Drupal Alert Banner

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

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

steps:

- name: Cached workspace
uses: actions/cache@v2
with:
path: ./html
key: ${{ runner.os }}-localgov-build-${{ github.run_id }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- name: Clone drupal_container
uses: actions/checkout@v2
with:
repository: localgovdrupal/drupal-container
ref: master

- name: Create LocalGov Drupal project
run: composer create-project --stability dev localgovdrupal/localgov-project ./html

- 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_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_REPO=${GITHUB_REPOSITORY}" >> $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_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
echo "GIT_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV

- name: Setup package source and authentication for the test target
run: |
composer --working-dir=html config repositories.1 vcs git@github.com:${GIT_REPO}.git
composer global config github-oauth.github.com ${{ github.token }}

- name: Obtain the test target from the repo that triggered this workflow
run: composer --working-dir=html require --with-all-dependencies localgovdrupal/${{ github.event.repository.name }}:"dev-${GIT_BRANCH} as 1.0.x-dev"

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

steps:

- name: Cached workspace
uses: actions/cache@v2
with:
path: ./html
key: ${{ runner.os }}-localgov-build-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-localgov-build-

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- name: Run coding standards checks
run: |
cd html
./bin/phpcs -p

phpstan:
name: Deprecated code checks
needs: build
runs-on: ubuntu-latest

steps:

- name: Cached workspace
uses: actions/cache@v2
with:
path: ./html
key: ${{ runner.os }}-localgov-build-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-localgov-build-

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- name: Run deprecated code checks
run: |
cd html
./bin/phpstan analyse -c ./phpstan.neon ./web/profiles/contrib/localgov/ ./web/modules/contrib/localgov_*

phpunit:
name: PHPUnit tests
needs: build
runs-on: ubuntu-latest

steps:

- name: Clone drupal_container
uses: actions/checkout@v2
with:
repository: localgovdrupal/drupal-container
ref: master

- name: Cached workspace
uses: actions/cache@v2
with:
path: ./html
key: ${{ runner.os }}-localgov-build-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-localgov-build-

- 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#; s#mysql://database:database@database/database#sqlite://localhost//dev/shm/test.sqlite#" ./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/phpunit --testdox"
docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4"

mocha:
name: Mocha theme tests
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x]

steps:

- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Node dependencies
run: npm install

- run: npm run health-check
2 changes: 1 addition & 1 deletion assets/css/lib/main.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/lib/main.css.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion assets/scss/lib/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ $blue: #398bcb;
// General colours
$orange: #ed7522;
$green: #1ba11b;
$viridian: #00856a;
$purple: #652c95;
$magenta: #880088;
$tan: #f2ba41;
Expand Down Expand Up @@ -83,7 +84,7 @@ $yellow-tint: lighten( $yellow, 15% );
$theme-colors: ( // Bootstrap colours
'primary': $primary, 'secondary': $secondary, 'success': $success, 'info': $carbon, 'warning': $warning, 'danger': $red, 'light': $light, 'dark': $dark, // Map additional colours to 'theme colours'
'carbon': $carbon, 'graphite': $graphite, 'stonewash': $stonewash, 'gray-tint': $gray-tint, 'purple-tint': $purple-tint, 'green-tint': $green-tint, 'indigo-tint': $indigo-tint, // Map additional colours to 'theme colours' - can be used for backgrounds for example '.bg-green'
'blue': $blue, 'indigo': $indigo, 'pink': $pink, 'red': $red, 'orange': $orange, 'yellow': $yellow, 'green': $green, 'teal': $teal, 'cyan': $cyan, 'gray': $gray, 'gray-dark': $gray-dark, 'white': $white, 'visited': $visited, );
'blue': $blue, 'indigo': $indigo, 'pink': $pink, 'red': $red, 'orange': $orange, 'yellow': $yellow, 'green': $green, 'viridian': $viridian, 'teal': $teal, 'cyan': $cyan, 'gray': $gray, 'gray-dark': $gray-dark, 'white': $white, 'visited': $visited, );

// Breadcrumb navigation
$breadcrumb: $gray-tertiary;
Expand All @@ -99,6 +100,7 @@ $link-hover-color: $secondary;
$body-bg: $white;
$body-color: $secondary;
$breadcrumb-bg: $white;
$alert-bar-announcement: $viridian;
$alert-bar-minor: $yellow;
$alert-bar-major: $red;
$alert-bar-notable: $carbon;
Expand Down
30 changes: 25 additions & 5 deletions assets/scss/lib/partials/_alert.scss
Original file line number Diff line number Diff line change
@@ -1,28 +1,47 @@
.alert-bar {
// Alert banner modifiers
.localgov-alert-banner {
&.alert-banner--notable-person {
background: $alert-bar-notable;

p,
a,
div > div a,
i {
color: $white;
}
}

&.alert-banner--major {
&.localgov-alert-banner--major {
background: $alert-bar-major;

p,
a,
div > div a,
i {
color: $white;
}
}

&.alert-banner--minor {
&.localgov-alert-banner--minor {
background: $alert-bar-minor;
}

&.localgov-alert-banner--announcement {
background: $alert-bar-announcement;

p,
a,
div > div a,
i {
color: $white;
}
}
}

// General alert banner styles
.alert-bar,
.localgov-alert-banner {

div > div {
> div {
p {
Expand Down Expand Up @@ -120,7 +139,8 @@
}
}

.localgov_alert_banner {
// Alert banner button.
.localgov-alert-banner {
button { // default form button styling
background-color: $alert-button-background;
color: $alert-button-color;
Expand All @@ -141,7 +161,7 @@
}
}

.localgov_alert_banner--dismiss {
.localgov-alert-banner__close {
a {
// alternative styling for link button
color: $alert-button-color;
Expand Down
12 changes: 10 additions & 2 deletions localgov_theme.theme
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,28 @@ function localgov_theme_preprocess_office_hours(&$variables) {
function localgov_theme_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
// Allow page template to be overridden by content type.
if ($hook == 'page' && $node = \Drupal::routeMatch()->getParameter('node')) {

// Load the node if its not already, as revisions return the nid.
if (!$node instanceof NodeInterface) {
$node = Node::load((int) $node);
}
// For the frontpage, ensure that *page__front* is always the final
// suggestion.
$is_front_page = end($suggestions) === 'page__front';
if ($is_front_page) {
$front_page_tpl_suggestion_key = key($suggestions);
unset($suggestions[$front_page_tpl_suggestion_key]);

$suggestions[] = 'page__' . $node->bundle();
if ($node instanceof NodeInterface) {
$suggestions[] = 'page__' . $node->bundle();
}
$suggestions[] = 'page__front';
}
else {
elseif ($node instanceof NodeInterface) {
$suggestions[] = 'page__' . $node->bundle();
}
}

// Fields to be rendered through the field--clean.html.twig template.
$clean_fields = [
'localgov_addressfield',
Expand Down
Loading