Skip to content

Commit bf585e7

Browse files
author
Joran De Braekeleer
committed
Merge remote-tracking branch 'upstream/dspace-7_x' into w2p-131442_backport-4335-to-dspace-7_x
2 parents c58b398 + a226502 commit bf585e7

File tree

1,099 files changed

+53277
-22286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,099 files changed

+53277
-22286
lines changed

.eslintrc.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,13 @@
231231
"*.json5"
232232
],
233233
"extends": [
234-
"plugin:jsonc/recommended-with-jsonc"
234+
"plugin:jsonc/recommended-with-json5"
235235
],
236236
"rules": {
237-
"no-irregular-whitespace": "error",
237+
// The ESLint core no-irregular-whitespace rule doesn't work well in JSON
238+
// See: https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-irregular-whitespace.html
239+
"no-irregular-whitespace": "off",
240+
"jsonc/no-irregular-whitespace": "error",
238241
"no-trailing-spaces": "error",
239242
"jsonc/comma-dangle": [
240243
"error",

.github/disabled-workflows/pull_request_opened.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 144 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ name: Build
77
on: [push, pull_request]
88

99
permissions:
10-
contents: read # to fetch code (actions/checkout)
10+
contents: read # to fetch code (actions/checkout)
11+
packages: read # to fetch private images from GitHub Container Registry (GHCR)
1112

1213
jobs:
1314
tests:
@@ -33,21 +34,26 @@ jobs:
3334
#CHROME_VERSION: "90.0.4430.212-1"
3435
# Bump Node heap size (OOM in CI after upgrading to Angular 15)
3536
NODE_OPTIONS: '--max-old-space-size=4096'
37+
# Project name to use when running "docker compose" prior to e2e tests
38+
COMPOSE_PROJECT_NAME: 'ci'
39+
# Docker Registry to use for Docker compose scripts below.
40+
# We use GitHub's Container Registry to avoid aggressive rate limits at DockerHub.
41+
DOCKER_REGISTRY: ghcr.io
3642
strategy:
3743
# Create a matrix of Node versions to test against (in parallel)
3844
matrix:
39-
node-version: [16.x, 18.x]
45+
node-version: [18.x, 20.x]
4046
# Do NOT exit immediately if one matrix job fails
4147
fail-fast: false
4248
# These are the actual CI steps to perform per job
4349
steps:
4450
# https://github.com/actions/checkout
4551
- name: Checkout codebase
46-
uses: actions/checkout@v3
52+
uses: actions/checkout@v4
4753

4854
# https://github.com/actions/setup-node
4955
- name: Install Node.js ${{ matrix.node-version }}
50-
uses: actions/setup-node@v3
56+
uses: actions/setup-node@v4
5157
with:
5258
node-version: ${{ matrix.node-version }}
5359

@@ -72,7 +78,7 @@ jobs:
7278
id: yarn-cache-dir-path
7379
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
7480
- name: Cache Yarn dependencies
75-
uses: actions/cache@v3
81+
uses: actions/cache@v4
7682
with:
7783
# Cache entire Yarn cache directory (see previous step)
7884
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -99,26 +105,34 @@ jobs:
99105
# so that it can be shared with the 'codecov' job (see below)
100106
# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
101107
- name: Upload code coverage report to Artifact
102-
uses: actions/upload-artifact@v3
108+
uses: actions/upload-artifact@v4
103109
if: matrix.node-version == '18.x'
104110
with:
105-
name: dspace-angular coverage report
111+
name: coverage-report-${{ matrix.node-version }}
106112
path: 'coverage/dspace-angular/lcov.info'
107113
retention-days: 14
108114

109-
# Using docker-compose start backend using CI configuration
115+
# Login to our Docker registry, so that we can access private Docker images using "docker compose" below.
116+
- name: Login to ${{ env.DOCKER_REGISTRY }}
117+
uses: docker/login-action@v3
118+
with:
119+
registry: ${{ env.DOCKER_REGISTRY }}
120+
username: ${{ github.repository_owner }}
121+
password: ${{ secrets.GITHUB_TOKEN }}
122+
123+
# Using "docker compose" start backend using CI configuration
110124
# and load assetstore from a cached copy
111125
- name: Start DSpace REST Backend via Docker (for e2e tests)
112126
run: |
113-
docker-compose -f ./docker/docker-compose-ci.yml up -d
114-
docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
127+
docker compose -f ./docker/docker-compose-ci.yml up -d
128+
docker compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
115129
docker container ls
116130
117131
# Run integration tests via Cypress.io
118132
# https://github.com/cypress-io/github-action
119133
# (NOTE: to run these e2e tests locally, just use 'ng e2e')
120134
- name: Run e2e tests (integration tests)
121-
uses: cypress-io/github-action@v5
135+
uses: cypress-io/github-action@v6
122136
with:
123137
# Run tests in Chrome, headless mode (default)
124138
browser: chrome
@@ -133,19 +147,19 @@ jobs:
133147
# Cypress always creates a video of all e2e tests (whether they succeeded or failed)
134148
# Save those in an Artifact
135149
- name: Upload e2e test videos to Artifacts
136-
uses: actions/upload-artifact@v3
150+
uses: actions/upload-artifact@v4
137151
if: always()
138152
with:
139-
name: e2e-test-videos
153+
name: e2e-test-videos-${{ matrix.node-version }}
140154
path: cypress/videos
141155

142156
# If e2e tests fail, Cypress creates a screenshot of what happened
143157
# Save those in an Artifact
144158
- name: Upload e2e test failure screenshots to Artifacts
145-
uses: actions/upload-artifact@v3
159+
uses: actions/upload-artifact@v4
146160
if: failure()
147161
with:
148-
name: e2e-test-screenshots
162+
name: e2e-test-screenshots-${{ matrix.node-version }}
149163
path: cypress/screenshots
150164

151165
- name: Stop app (in case it stays up after e2e tests)
@@ -170,17 +184,120 @@ jobs:
170184
# Get homepage and verify that the <meta name="title"> tag includes "DSpace".
171185
# If it does, then SSR is working, as this tag is created by our MetadataService.
172186
# This step also prints entire HTML of homepage for easier debugging if grep fails.
173-
- name: Verify SSR (server-side rendering)
187+
- name: Verify SSR (server-side rendering) on Homepage
174188
run: |
175189
result=$(wget -O- -q http://127.0.0.1:4000/home)
176190
echo "$result"
177191
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep DSpace
178192
193+
# Get a specific community in our test data and verify that the "<h1>" tag includes "Publications" (the community name).
194+
# If it does, then SSR is working.
195+
- name: Verify SSR on a Community page
196+
run: |
197+
result=$(wget -O- -q http://127.0.0.1:4000/communities/0958c910-2037-42a9-81c7-dca80e3892b4)
198+
echo "$result"
199+
echo "$result" | grep -oE "<h1 [^>]*>[^><]*</h1>" | grep Publications
200+
201+
# Get a specific collection in our test data and verify that the "<h1>" tag includes "Articles" (the collection name).
202+
# If it does, then SSR is working.
203+
- name: Verify SSR on a Collection page
204+
run: |
205+
result=$(wget -O- -q http://127.0.0.1:4000/collections/282164f5-d325-4740-8dd1-fa4d6d3e7200)
206+
echo "$result"
207+
echo "$result" | grep -oE "<h1 [^>]*>[^><]*</h1>" | grep Articles
208+
209+
# Get a specific publication in our test data and verify that the <meta name="title"> tag includes
210+
# the title of this publication. If it does, then SSR is working.
211+
- name: Verify SSR on a Publication page
212+
run: |
213+
result=$(wget -O- -q http://127.0.0.1:4000/entities/publication/6160810f-1e53-40db-81ef-f6621a727398)
214+
echo "$result"
215+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "An Economic Model of Mortality Salience"
216+
217+
# Get a specific person in our test data and verify that the <meta name="title"> tag includes
218+
# the name of the person. If it does, then SSR is working.
219+
- name: Verify SSR on a Person page
220+
run: |
221+
result=$(wget -O- -q http://127.0.0.1:4000/entities/person/b1b2c768-bda1-448a-a073-fc541e8b24d9)
222+
echo "$result"
223+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Simmons, Cameron"
224+
225+
# Get a specific project in our test data and verify that the <meta name="title"> tag includes
226+
# the name of the project. If it does, then SSR is working.
227+
- name: Verify SSR on a Project page
228+
run: |
229+
result=$(wget -O- -q http://127.0.0.1:4000/entities/project/46ccb608-a74c-4bf6-bc7a-e29cc7defea9)
230+
echo "$result"
231+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "University Research Fellowship"
232+
233+
# Get a specific orgunit in our test data and verify that the <meta name="title"> tag includes
234+
# the name of the orgunit. If it does, then SSR is working.
235+
- name: Verify SSR on an OrgUnit page
236+
run: |
237+
result=$(wget -O- -q http://127.0.0.1:4000/entities/orgunit/9851674d-bd9a-467b-8d84-068deb568ccf)
238+
echo "$result"
239+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Law and Development"
240+
241+
# Get a specific journal in our test data and verify that the <meta name="title"> tag includes
242+
# the name of the journal. If it does, then SSR is working.
243+
- name: Verify SSR on a Journal page
244+
run: |
245+
result=$(wget -O- -q http://127.0.0.1:4000/entities/journal/d4af6c3e-53d0-4757-81eb-566f3b45d63a)
246+
echo "$result"
247+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Environmental &amp; Architectural Phenomenology"
248+
249+
# Get a specific journal volume in our test data and verify that the <meta name="title"> tag includes
250+
# the name of the volume. If it does, then SSR is working.
251+
- name: Verify SSR on a Journal Volume page
252+
run: |
253+
result=$(wget -O- -q http://127.0.0.1:4000/entities/journalvolume/07c6249f-4bf7-494d-9ce3-6ffdb2aed538)
254+
echo "$result"
255+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Environmental &amp; Architectural Phenomenology Volume 28 (2017)"
256+
257+
# Get a specific journal issue in our test data and verify that the <meta name="title"> tag includes
258+
# the name of the issue. If it does, then SSR is working.
259+
- name: Verify SSR on a Journal Issue page
260+
run: |
261+
result=$(wget -O- -q http://127.0.0.1:4000/entities/journalissue/44c29473-5de2-48fa-b005-e5029aa1a50b)
262+
echo "$result"
263+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Environmental &amp; Architectural Phenomenology Vol. 28, No. 1"
264+
265+
# Verify 301 Handle redirect behavior
266+
# Note: /handle/123456789/260 is the same test Publication used by our e2e tests
267+
- name: Verify 301 redirect from '/handle' URLs
268+
run: |
269+
result=$(wget --server-response --quiet http://127.0.0.1:4000/handle/123456789/260 2>&1 | head -1 | awk '{print $2}')
270+
echo "$result"
271+
[[ "$result" -eq "301" ]]
272+
273+
# Verify 403 error code behavior
274+
- name: Verify 403 error code from '/403'
275+
run: |
276+
result=$(wget --server-response --quiet http://127.0.0.1:4000/403 2>&1 | head -1 | awk '{print $2}')
277+
echo "$result"
278+
[[ "$result" -eq "403" ]]
279+
280+
# Verify 404 error code behavior
281+
- name: Verify 404 error code from '/404' and on invalid pages
282+
run: |
283+
result=$(wget --server-response --quiet http://127.0.0.1:4000/404 2>&1 | head -1 | awk '{print $2}')
284+
echo "$result"
285+
result2=$(wget --server-response --quiet http://127.0.0.1:4000/invalidurl 2>&1 | head -1 | awk '{print $2}')
286+
echo "$result2"
287+
[[ "$result" -eq "404" && "$result2" -eq "404" ]]
288+
289+
# Verify 500 error code behavior
290+
- name: Verify 500 error code from '/500'
291+
run: |
292+
result=$(wget --server-response --quiet http://127.0.0.1:4000/500 2>&1 | head -1 | awk '{print $2}')
293+
echo "$result"
294+
[[ "$result" -eq "500" ]]
295+
179296
- name: Stop running app
180297
run: kill -9 $(lsof -t -i:4000)
181298

182299
- name: Shutdown Docker containers
183-
run: docker-compose -f ./docker/docker-compose-ci.yml down
300+
run: docker compose -f ./docker/docker-compose-ci.yml down
184301

185302
# Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test
186303
# job above. This is necessary because Codecov uploads seem to randomly fail at times.
@@ -191,22 +308,27 @@ jobs:
191308
runs-on: ubuntu-latest
192309
steps:
193310
- name: Checkout
194-
uses: actions/checkout@v3
311+
uses: actions/checkout@v4
195312

196313
# Download artifacts from previous 'tests' job
197314
- name: Download coverage artifacts
198-
uses: actions/download-artifact@v3
315+
uses: actions/download-artifact@v4
199316

200317
# Now attempt upload to Codecov using its action.
201318
# NOTE: We use a retry action to retry the Codecov upload if it fails the first time.
202319
#
203320
# Retry action: https://github.com/marketplace/actions/retry-action
204321
# Codecov action: https://github.com/codecov/codecov-action
205322
- name: Upload coverage to Codecov.io
206-
uses: Wandalen/wretry.action@v1.0.36
323+
uses: Wandalen/wretry.action@v1.3.0
207324
with:
208-
action: codecov/codecov-action@v3
209-
# Try upload 5 times max
325+
action: codecov/codecov-action@v4
326+
# Ensure codecov-action throws an error when it fails to upload
327+
# This allows us to auto-restart the action if an error is thrown
328+
with: |
329+
fail_ci_if_error: true
330+
token: ${{ secrets.CODECOV_TOKEN }}
331+
# Try re-running action 5 times max
210332
attempt_limit: 5
211333
# Run again in 30 seconds
212334
attempt_delay: 30000

.github/workflows/codescan.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55
# because CodeQL requires a fresh build with all tests *disabled*.
66
name: "Code Scanning"
77

8-
# Run this code scan for all pushes / PRs to main branch. Also run once a week.
8+
# Run this code scan for all pushes / PRs to main or maintenance branches. Also run once a week.
99
on:
1010
push:
11-
branches: [ main ]
11+
branches:
12+
- main
13+
- 'dspace-**'
1214
pull_request:
13-
branches: [ main ]
15+
branches:
16+
- main
17+
- 'dspace-**'
1418
# Don't run if PR is only updating static documentation
1519
paths-ignore:
1620
- '**/*.md'
@@ -31,7 +35,7 @@ jobs:
3135
steps:
3236
# https://github.com/actions/checkout
3337
- name: Checkout repository
34-
uses: actions/checkout@v3
38+
uses: actions/checkout@v4
3539

3640
# Initializes the CodeQL tools for scanning.
3741
# https://github.com/github/codeql-action

0 commit comments

Comments
 (0)