Skip to content

Commit

Permalink
chore: update branch with changes from develop
Browse files Browse the repository at this point in the history
Refs: OPS-7872
  • Loading branch information
lazysoundsystem committed Jun 25, 2024
1 parent 25eccaf commit 9548a6a
Show file tree
Hide file tree
Showing 309 changed files with 11,374 additions and 25,433 deletions.
2 changes: 1 addition & 1 deletion .docksal/docksal.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DOCKSAL_STACK=default
# This will prevent images from being updated when Docksal is updated
#WEB_IMAGE='docksal/web:x.x-apache2.4'
#DB_IMAGE='docksal/db:x.x-mysql-5.6'
#CLI_IMAGE='docksal/cli:x.x-php7.1'
CLI_IMAGE='docksal/cli:php8.2-build'

# Override virtual host (matches project folder name by default)
#VIRTUAL_HOST=drupal8.docksal
Expand Down
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
*.xml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.yml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2

# PHPStan's baseline uses tabs instead of spaces.
core/.phpstan-baseline.php text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tabwidth=2 diff=php linguist-language=php

# Define binary file attributes.
# - Do not treat them as text.
# - Include binary diff in patches instead of "binary files differ."
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/composer-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
with:
github_access_token: ${{ secrets.PAT }}
patch_branch: 'develop'
patch_packages: 'drupal/*'
patch_maintainers: ${{ secrets.DRUPAL_MAINTAINERS }}
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
slack_channel_name: ${{ secrets.SLACK_CHANNEL }}
flowdock_token: ${{ secrets.FLOWDOCK_TOKEN }}
slack_channel_name: ${{ vars.SLACK_CHANNEL }}
2 changes: 1 addition & 1 deletion .github/workflows/dispatch-site-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: '${{ github.event.client_payload.message.branch }}'
fetch-depth: 0
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/docker-build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- develop
- 'cd-*'
- 'CD-*'
- 'OPS-*'
- 'feature/**'
- main
release:
Expand All @@ -16,7 +18,7 @@ jobs:
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build The Thing
Expand All @@ -32,6 +34,5 @@ jobs:
docker_password: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
ecr_github_token: ${{ secrets.ECR_GITHUB_TOKEN }}
ecr_jenkins_token: ${{ secrets.JENKINS_ECR_TOKEN }}
flowdock_token: ${{ secrets.FLOWDOCK_TOKEN }}
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
slack_channel_name: ${{ secrets.SLACK_CHANNEL }}
slack_channel_name: ${{ vars.SLACK_CHANNEL }}
62 changes: 62 additions & 0 deletions .github/workflows/lighthouse-budget.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{
"path": "/",
"timings": [
{
"metric": "largest-contentful-paint",
"budget": 4000
},
{
"metric": "max-potential-fid",
"budget": 300
},
{
"metric": "interactive",
"budget": 5000
},
{
"metric": "cumulative-layout-shift",
"budget": 0.25
}
],
"resourceSizes": [
{
"resourceType": "document",
"budget": 60
},
{
"resourceType": "script",
"budget": 150
},
{
"resourceType": "stylesheet",
"budget": 30
},
{
"resourceType": "total",
"budget": 700
}
]
},
{
"path": "/demo",
"timings": [
{
"metric": "largest-contentful-paint",
"budget": 5000
},
{
"metric": "max-potential-fid",
"budget": 400
},
{
"metric": "interactive",
"budget": 6000
},
{
"metric": "cumulative-layout-shift",
"budget": 0.35
}
]
}
]
16 changes: 16 additions & 0 deletions .github/workflows/lighthouserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
ci: {
collect: {
startServerCommand: 'docker compose -f tests/docker-compose.yml exec -T drupal drush rs 127.0.0.1:8080'
},
assert: {
preset: "lighthouse:recommended",
assertions: {
"first-contentful-paint": ["error", {"minScore": 0.6}]
}
},
upload: {
target: "temporary-public-storage",
},
},
};
146 changes: 127 additions & 19 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
name: Run tests

on: [pull_request]
on:
pull_request:
types: [labeled, opened, synchronize]

jobs:
tests:
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
pull-requests: write
actions: read
statuses: write

steps:
- name: Checkout Code
id: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Extract PHP Version
id: php
Expand Down Expand Up @@ -58,16 +65,15 @@ jobs:
uses: cafuego/command-output@main
with:
run: |
# Uncomment this if we have custom modules.
# test ! -d ./html/modules/custom || find -L ./html/modules/custom -iregex '.*\.\(php\|module\|inc\|install\)$' -print0 | xargs -0 -n 1 -P 4 php -l
test ! -d ./html/modules/custom || find -L ./html/modules/custom -iregex '.*\.\(php\|module\|inc\|install\)$' -print0 | xargs -0 -n 1 -P 4 php -l
test ! -d ./html/themes/custom || find -L ./html/themes/custom -iregex '.*\.\(php\|theme\)$' -print0 | xargs -0 -n 1 -P 4 php -l
env:
fail-fast: true

- name: Configure AWS Credentials
id: aws
if: ${{ !env.ACT }}
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
Expand All @@ -76,10 +82,10 @@ jobs:
- name: Login to Public ECR
id: aws-login
if: ${{ !env.ACT }}
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3.0.0
with:
registry: public.ecr.aws
username: ${{ secrets.ECR_AWS_ACCESS_KEY_I }}
username: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
password: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
env:
AWS_REGION: us-east-1
Expand All @@ -105,12 +111,19 @@ jobs:
env:
fail-fast: true

- name: Install Subtheme
id: subtheme
uses: cafuego/command-output@main
with:
run: |
docker compose -f tests/docker-compose.yml exec -w /srv/www -T drupal /usr/bin/composer run sub-theme
- name: PHPCS
id: phpcs
uses: cafuego/command-output@main
with:
run: |
docker compose -f tests/docker-compose.yml exec -u appuser -w /srv/www -T drupal phpcs -p --report=full --standard=phpcs.xml ./html/themes/custom
docker compose -f tests/docker-compose.yml exec -u appuser -w /srv/www -T drupal phpcs -p --report=full --standard=phpcs.xml ./html/modules/custom ./html/themes/custom
env:
fail-fast: true

Expand All @@ -119,27 +132,122 @@ jobs:
uses: cafuego/command-output@main
with:
run: |
# This isn't very useful as we're not actually running tests.
docker compose -f tests/docker-compose.yml exec -T drupal drush -y si --existing-config
docker compose -f tests/docker-compose.yml exec -T drupal drush -y si --existing-config minimal install_configure_form.enable_update_status_emails=NULL
env:
fail-fast: true

- name: Run tests
id: tests
uses: cafuego/command-output@main
with:
run: |
docker compose -f tests/docker-compose.yml exec -T drupal drush -y en dblog
docker compose -f tests/docker-compose.yml exec -T drupal chmod -R 777 /srv/www/html/sites/default/files /srv/www/html/sites/default/private
docker compose -f tests/docker-compose.yml exec -T drupal mkdir -p /srv/www/html/build/logs
docker compose -f tests/docker-compose.yml exec -T drupal chmod -R 777 /srv/www/html/build/logs
docker-compose -f tests/docker-compose.yml exec -T drupal mkdir -p /srv/www/html/build/logs /srv/www/html/sites/default/files/browser_output
docker-compose -f tests/docker-compose.yml exec -T drupal chmod -R 777 /srv/www/html/build/logs /srv/www/html/sites/default/files/browser_output
docker compose -f tests/docker-compose.yml exec -T -w /srv/www -e XDEBUG_MODE=coverage -e BROWSERTEST_OUTPUT_DIRECTORY=/srv/www/html/sites/default/files/browser_output -e DTT_BASE_URL=http://127.0.0.1 drupal ./vendor/bin/phpunit --coverage-clover /srv/www/html/build/logs/clover.xml --debug
env:
fail-fast: true

- name: Copy Coveralls
id: copy_coveralls
if: success()
run: docker cp "$(docker compose -f tests/docker-compose.yml ps -q drupal)":/srv/www/html/build/logs/clover.xml . || echo "skip=true" >> "$GITHUB_OUTPUT"

- name: Monitor coverage
id: coveralls
if: ${{ steps.copy_coveralls.outputs.skip != 'true' }}
uses: slavcodev/coverage-monitor-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
coverage_path: "clover.xml"
threshold_alert: 0
threshold_warning: 50
threshold_metric: "lines"
comment_footer: false

- name: Install demo content
# Install Demo content if the PR has the label "e2e" or "performance"
if: contains(github.event.pull_request.labels.*.name, 'e2e') || contains(github.event.pull_request.labels.*.name, 'performance')
id: content
uses: cafuego/command-output@main
with:
run: |
docker-compose -f tests/docker-compose.yml exec -T drupal drush -y en unocha_demo_content
curl -v http://127.0.0.1:8080/demo
env:
fail-fast: true

- name: Set up node
# Run Jest e2e tests if the PR has the label "e2e"
if: contains(github.event.pull_request.labels.*.name, 'e2e')
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install node dependencies
# Run Jest e2e tests if the PR has the label "e2e"
if: contains(github.event.pull_request.labels.*.name, 'e2e')
run: |
docker compose -f tests/docker-compose.yml exec -w /srv/www drupal sh
cd html/themes/custom/common_design_subtheme
npm install
- name: Run e2e tests
# Run Jest e2e tests if the PR has the label "e2e"
if: contains(github.event.pull_request.labels.*.name, 'e2e')
run: |
docker compose -f tests/docker-compose.yml exec -w /srv/www drupal sh
cd html/themes/custom/common_design_subtheme
npm run ci -- -t '^(?!.*Subtheme).*$'
env:
fail-fast: true

# - name: Debug Server
# uses: cafuego/command-output@main
# with:
# run: |
# docker ps -a

- name: Audit URLs using Lighthouse
# Run Lighthouse if the PR has the label "performance"
if: contains(github.event.pull_request.labels.*.name, 'performance')
uses: treosh/[email protected]
with:
urls: |
http://127.0.0.1:8080/
http://127.0.0.1:8080/demo
runs: 3
budgetPath: .github/workflows/lighthouse-budget.json # test performance budgets
configPath: .github/workflows/lighthouserc.js
uploadArtifacts: true # save results as an action artifacts
temporaryPublicStorage: true # upload lighthouse report to the temporary storage

- name: DB Logs
id: dblog
if: failure()
uses: cafuego/command-output@main
with:
run: |
docker compose -f tests/docker-compose.yml exec -T drupal drush watchdog:show
- name: Find Comment
uses: peter-evans/find-comment@v2
uses: peter-evans/find-comment@v3
if: ${{ !env.ACT }}
id: fc
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Build output

- name: Create or update comment
uses: peter-evans/create-or-update-comment@v2
uses: peter-evans/create-or-update-comment@v4
if: ${{ !env.ACT }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Expand All @@ -164,9 +272,9 @@ jobs:
- name: Slack Success Notification
id: slack_success
if: ${{ !env.ACT && success() }}
uses: slackapi/slack-github-action@v1.23.0
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: '${{ secrets.SLACK_CHANNEL }}'
channel-id: '${{ vars.SLACK_CHANNEL }}'
payload: |
{
"text": "Tests passed for a pull request on ${{ github.repository }}",
Expand All @@ -191,9 +299,9 @@ jobs:
- name: Slack Failure Notification
id: slack_failure
if: ${{ !env.ACT && failure() }}
uses: slackapi/slack-github-action@v1.23.0
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: '${{ secrets.SLACK_CHANNEL }}'
channel-id: '${{ vars.SLACK_CHANNEL }}'
payload: |
{
"text": "Tests failed for a pull request on ${{ github.repository }}",
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/html/sites/*/settings.php
/html/sites/*/settings.local.php
/html/sites/development.services.yml
/database/

# Ignore Drupal's file directory
/html/sites/*/files/
Expand Down Expand Up @@ -39,4 +40,4 @@ buildlog.txt
/index.php
/robots.txt
/update.php
/web.config
/web.config
Loading

0 comments on commit 9548a6a

Please sign in to comment.