Skip to content

Commit

Permalink
Merge pull request #436 from UN-OCHA/develop
Browse files Browse the repository at this point in the history
Deploy 30-01-2024
  • Loading branch information
Lisa Corcoran authored Jan 31, 2024
2 parents 6cde663 + 597e1ad commit 875ddaa
Show file tree
Hide file tree
Showing 170 changed files with 27,855 additions and 186 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/lighthouse-budget.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[
{
"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": "/asia-and-pacific",
"timings": [
{
"metric": "largest-contentful-paint",
"budget": 5000
},
{
"metric": "max-potential-fid",
"budget": 400
},
{
"metric": "interactive",
"budget": 6000
},
{
"metric": "cumulative-layout-shift",
"budget": 0.35
},
],
"resourceSizes": [
{
"resourceType": "stylesheet",
"budget": 40
}
]
}
]
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",
},
},
};
61 changes: 60 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Run tests

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

jobs:
tests:
Expand Down Expand Up @@ -116,6 +118,7 @@ jobs:
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
Expand Down Expand Up @@ -166,10 +169,66 @@ jobs:
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
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.16.1'

- 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: 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/asia-and-pacific
http://127.0.0.1:8080/latest/news-and-stories
http://127.0.0.1:8080/news/empowering-afghan-women-glimpse-life-psychosocial-counsellor
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
Expand Down
11 changes: 9 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"composer/installers": "^1.12",
"cweagans/composer-patches": "^1.7",
"drupal/admin_denied": "^2.0",
"drupal/allowed_formats": "^2.0",
"drupal/allowed_formats": "^3",
"drupal/amazon_ses": "^3.0",
"drupal/choices": "^2.1",
"drupal/components": "^3.0@beta",
"drupal/config_split": "^2.0.0@rc",
Expand All @@ -34,6 +35,7 @@
"drupal/core-recommended": "^10",
"drupal/csp": "^1.17",
"drupal/datetime_range_timezone": "^1.0@alpha",
"drupal/default_content": "^2.0@alpha",
"drupal/double_field": "^4.1",
"drupal/entity_browser": "^2.9",
"drupal/entity_usage": "^2.0@beta",
Expand All @@ -46,6 +48,7 @@
"drupal/imagemagick": "^3.4",
"drupal/layout_paragraphs": "^2.0",
"drupal/linkit": "^6.0@RC",
"drupal/mailsystem": "^4.4",
"drupal/maintenance200": "^2",
"drupal/memcache": "^2.5",
"drupal/menu_breadcrumb": "^2.0@alpha",
Expand Down Expand Up @@ -115,7 +118,11 @@
"oomphinc/composer-installers-extender": true,
"orakili/composer-drupal-info-file-patch-helper": true,
"phpstan/extension-installer": true,
"php-http/discovery": true
"php-http/discovery": true,
"drupal-composer/preserve-paths": true
},
"audit": {
"abandoned": "report"
}
},
"extra": {
Expand Down
Loading

0 comments on commit 875ddaa

Please sign in to comment.