Skip to content

Commit

Permalink
Merge pull request #423 from UN-OCHA/UNO-762
Browse files Browse the repository at this point in the history
UNO-762 Demo content
  • Loading branch information
Lisa Corcoran authored Jan 29, 2024
2 parents c2e319c + 772a8cd commit 76f2d5c
Show file tree
Hide file tree
Showing 144 changed files with 27,165 additions and 17 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
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,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 Down
94 changes: 86 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions composer.patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"drupal/datetime_range_timezone": {
"Views integration": "PATCHES/datetime_range_timezone-views-integration.patch"
},
"drupal/default_content" : {
"https://www.drupal.org/project/default_content/issues/2885285#comment-15342107": "https://www.drupal.org/files/issues/2023-12-01/i2885285-exporting-menu-link-2.patch"
},
"drupal/imageapi_optimize_webp": {
"Fix derivatives for webp source images": "PATCHES/imageapi_optimize_webp-webp-source-image.patch",
"Support imagemagick toolkit": "PATCHES/imageapi_optimize_webp-imagemagick-toolkit.patch"
Expand Down
Loading

0 comments on commit 76f2d5c

Please sign in to comment.