Skip to content

Commit 5d48703

Browse files
Merged dspace-cris-2025_02_x into task/dspace-cris-2025_02_x/DSC-1504
2 parents 6819677 + 9e90732 commit 5d48703

361 files changed

Lines changed: 27239 additions & 19828 deletions

File tree

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
# Spin up UI on 127.0.0.1 to avoid host resolution issues in e2e tests with Node 20+
2525
DSPACE_UI_HOST: 127.0.0.1
2626
DSPACE_UI_PORT: 4000
27+
DSPACE_UI_BASEURL: http://127.0.0.1:4000
2728
# Ensure all SSR caching is disabled in test environment
2829
DSPACE_CACHE_SERVERSIDE_BOTCACHE_MAX: 0
2930
DSPACE_CACHE_SERVERSIDE_ANONYMOUSCACHE_MAX: 0
@@ -39,8 +40,11 @@ jobs:
3940
# Project name to use when running "docker compose" prior to e2e tests
4041
COMPOSE_PROJECT_NAME: "ci"
4142
# Docker Registry to use for Docker compose scripts below.
42-
# We use GitHub's Container Registry to avoid aggressive rate limits at DockerHub.
43-
DOCKER_REGISTRY: ghcr.io
43+
# On the upstream dspace/dspace-angular repository we use GitHub's Container Registry
44+
# (ghcr.io) to avoid aggressive rate limits at DockerHub. Forks cannot authenticate
45+
# against ghcr.io/dspace/* with their own GITHUB_TOKEN (and the images there require
46+
# auth), so on forks we fall back to docker.io where the same images are public.
47+
DOCKER_REGISTRY: ${{ github.repository == 'dspace/dspace-angular' && 'ghcr.io' || 'docker.io' }}
4448
strategy:
4549
# Create a matrix of Node versions to test against (in parallel)
4650
matrix:
@@ -51,11 +55,11 @@ jobs:
5155
steps:
5256
# https://github.com/actions/checkout
5357
- name: Checkout codebase
54-
uses: actions/checkout@v4
58+
uses: actions/checkout@v6
5559

5660
# https://github.com/actions/setup-node
5761
- name: Install Node.js ${{ matrix.node-version }}
58-
uses: actions/setup-node@v4
62+
uses: actions/setup-node@v6
5963
with:
6064
node-version: ${{ matrix.node-version }}
6165

@@ -80,7 +84,7 @@ jobs:
8084
id: npm-cache-dir
8185
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
8286
- name: Cache NPM dependencies
83-
uses: actions/cache@v4
87+
uses: actions/cache@v5
8488
with:
8589
# Cache entire NPM cache directory (see previous step)
8690
path: ${{ steps.npm-cache-dir.outputs.dir }}
@@ -113,16 +117,21 @@ jobs:
113117
# so that it can be shared with the 'codecov' job (see below)
114118
# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
115119
- name: Upload code coverage report to Artifact
116-
uses: actions/upload-artifact@v4
120+
uses: actions/upload-artifact@v7
117121
if: matrix.node-version == '20.x'
118122
with:
119123
name: coverage-report-${{ matrix.node-version }}
120124
path: "coverage/dspace-angular/lcov.info"
121125
retention-days: 14
122126

123-
# Login to our Docker registry, so that we can access private Docker images using "docker compose" below.
127+
# Login to our Docker registry, so that we can access Docker images using "docker compose" below.
128+
# This login is required on the upstream repository because DOCKER_REGISTRY is set to ghcr.io
129+
# and pulling ghcr.io/dspace/* requires authentication. On forks, DOCKER_REGISTRY falls back to
130+
# docker.io (see env block above) where the same images are publicly pullable without a login,
131+
# and forks cannot authenticate against ghcr.io/dspace/* with their own GITHUB_TOKEN anyway.
124132
- name: Login to ${{ env.DOCKER_REGISTRY }}
125-
uses: docker/login-action@v3
133+
uses: docker/login-action@v4
134+
if: github.repository == 'dspace/dspace-angular'
126135
with:
127136
registry: ${{ env.DOCKER_REGISTRY }}
128137
username: ${{ github.repository_owner }}
@@ -140,7 +149,7 @@ jobs:
140149
# https://github.com/cypress-io/github-action
141150
# (NOTE: to run these e2e tests locally, just use 'ng e2e')
142151
- name: Run e2e tests (integration tests)
143-
uses: cypress-io/github-action@v6
152+
uses: cypress-io/github-action@v7.1.9
144153
with:
145154
install-command: npm ci
146155
# Run tests in Chrome, headless mode (default)
@@ -156,7 +165,7 @@ jobs:
156165
# Cypress always creates a video of all e2e tests (whether they succeeded or failed)
157166
# Save those in an Artifact
158167
- name: Upload e2e test videos to Artifacts
159-
uses: actions/upload-artifact@v4
168+
uses: actions/upload-artifact@v7
160169
if: always()
161170
with:
162171
name: e2e-test-videos-${{ matrix.node-version }}
@@ -165,7 +174,7 @@ jobs:
165174
# If e2e tests fail, Cypress creates a screenshot of what happened
166175
# Save those in an Artifact
167176
- name: Upload e2e test failure screenshots to Artifacts
168-
uses: actions/upload-artifact@v4
177+
uses: actions/upload-artifact@v7
169178
if: failure()
170179
with:
171180
name: e2e-test-screenshots-${{ matrix.node-version }}
@@ -306,22 +315,25 @@ jobs:
306315
codecov:
307316
# Must run after 'tests' job above
308317
needs: tests
318+
# Only run on the upstream repository: forks do not have the CODECOV_TOKEN secret,
319+
# and Codecov refuses to create a commit on a protected branch without a token.
320+
if: github.repository == 'dspace/dspace-angular'
309321
runs-on: ubuntu-latest
310322
steps:
311323
- name: Checkout
312-
uses: actions/checkout@v4
324+
uses: actions/checkout@v6
313325

314326
# Download artifacts from previous 'tests' job
315327
- name: Download coverage artifacts
316-
uses: actions/download-artifact@v4
328+
uses: actions/download-artifact@v8
317329

318330
# Now attempt upload to Codecov using its action.
319331
# NOTE: We use a retry action to retry the Codecov upload if it fails the first time.
320332
#
321333
# Retry action: https://github.com/marketplace/actions/retry-action
322334
# Codecov action: https://github.com/codecov/codecov-action
323335
- name: Upload coverage to Codecov.io
324-
uses: Wandalen/wretry.action@v1.3.0
336+
uses: Wandalen/wretry.action@v3.8.0
325337
with:
326338
action: codecov/codecov-action@v4
327339
# Ensure codecov-action throws an error when it fails to upload

.github/workflows/codescan.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ jobs:
3535
steps:
3636
# https://github.com/actions/checkout
3737
- name: Checkout repository
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@v6
3939

4040
# Initializes the CodeQL tools for scanning.
4141
# https://github.com/github/codeql-action
4242
- name: Initialize CodeQL
43-
uses: github/codeql-action/init@v3
43+
uses: github/codeql-action/init@v4
4444
with:
4545
languages: javascript
4646

4747
# Autobuild attempts to build any compiled languages
4848
- name: Autobuild
49-
uses: github/codeql-action/autobuild@v3
49+
uses: github/codeql-action/autobuild@v4
5050

5151
# Perform GitHub Code Scanning.
5252
- name: Perform CodeQL Analysis
53-
uses: github/codeql-action/analyze@v3
53+
uses: github/codeql-action/analyze@v4

.github/workflows/issue_opened.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
# Only add to project board if issue is flagged as "needs triage" or has no labels
1717
# NOTE: By default we flag new issues as "needs triage" in our issue template
1818
if: (contains(github.event.issue.labels.*.name, 'needs triage') || join(github.event.issue.labels.*.name) == '')
19-
uses: actions/add-to-project@v1.0.0
19+
uses: actions/add-to-project@v1.0.2
2020
# Note, the authentication token below is an ORG level Secret.
2121
# It must be created/recreated manually via a personal access token with admin:org, project, public_repo permissions
2222
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#permissions-for-the-github_token

.github/workflows/port_merged_pull_request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
if: github.event.pull_request.merged
2424
steps:
2525
# Checkout code
26-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@v6
2727
# Port PR to other branch (ONLY if labeled with "port to")
2828
# See https://github.com/korthout/backport-action
2929
- name: Create backport pull requests
30-
uses: korthout/backport-action@v2
30+
uses: korthout/backport-action@v4
3131
with:
3232
# Trigger based on a "port to [branch]" label on PR
3333
# (This label must specify the branch name to port to)

.github/workflows/pull_request_opened.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
# Assign the PR to whomever created it. This is useful for visualizing assignments on project boards
2222
# See https://github.com/toshimaru/auto-author-assign
2323
- name: Assign PR to creator
24-
uses: toshimaru/auto-author-assign@v2.1.0
24+
uses: toshimaru/auto-author-assign@v3.0.1

Dockerfile

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,34 @@ ARG DOCKER_REGISTRY=docker.io
77

88
FROM ${DOCKER_REGISTRY:-docker.io}/4science/dspace-cris-angular-dependencies:${DSPACE_VERSION:-dspace-cris-2025_02_x} AS dev
99

10+
# Ensure Python and other build tools are available
11+
# These are needed to install some node modules, especially on linux/arm64
12+
RUN apk --no-cache add python3 make g++
13+
1014
WORKDIR /app
11-
ADD . /app/
12-
EXPOSE 4000
15+
16+
# Copy over package files first, so this layer will only be rebuilt if those files change.
17+
COPY package.json package-lock.json ./
18+
# NOTE: "ci" = clean install from package files
19+
RUN npm ci
20+
21+
# Add the rest of the source code
22+
COPY . /app/
1323

1424
# When running in dev mode, 4GB of memory is required to build & launch the app.
1525
# This default setting can be overridden as needed in your shell, via an env file or in docker-compose.
1626
# See Docker environment var precedence: https://docs.docker.com/compose/environment-variables/envvars-precedence/
1727
ENV NODE_OPTIONS="--max_old_space_size=4096"
1828

1929
# On startup, run in DEVELOPMENT mode (this defaults to live reloading enabled, etc).
20-
# Listen / accept connections from all IP addresses.
21-
# NOTE: At this time it is only possible to run Docker container in Production mode
22-
# if you have a public URL. See https://github.com/DSpace/dspace-angular/issues/1485
2330
ENV NODE_ENV=development
2431
ENV CI=true
2532
ENV NO_COLOR=1
26-
CMD npm run serve -- --host 0.0.0.0
33+
34+
EXPOSE 4000
35+
36+
# On startup, run this command to start application in dev mode
37+
ENTRYPOINT [ "npm", "run", "serve" ]
38+
# By default set host to 0.0.0.0 to listen/accept connections from all IP addresses.
39+
# Poll for changes every 5 seconds (if any detected, app will rebuild/restart)
40+
CMD ["--", "--host 0.0.0.0", "--poll 5000"]

Dockerfile.dist

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,17 @@ ARG DOCKER_REGISTRY=docker.io
1313

1414
FROM ${DOCKER_REGISTRY:-docker.io}/4science/dspace-cris-angular-dependencies:${DSPACE_VERSION:-dspace-cris-2025_02_x} AS build
1515

16+
# Ensure Python and other build tools are available
17+
# These are needed to install some node modules, especially on linux/arm64
18+
RUN apk --no-cache add python3 make g++
19+
1620
COPY . /app/
1721

1822
WORKDIR /app
23+
# Copy over package files first, so this layer will only be rebuilt if those files change.
24+
COPY package.json package-lock.json ./
25+
# NOTE: "ci" = clean install from package files
26+
RUN npm ci
1927

2028
# Build Angular app
2129
RUN --mount=type=cache,target=/root/.npm \
@@ -30,6 +38,13 @@ FROM docker.io/node:${NODE_VERSION-22}-alpine AS prod
3038
RUN --mount=type=cache,target=/root/.npm \
3139
npm install --global pm2 && npm cache clean --force
3240

41+
# Copy pre-built code from build image
42+
COPY --chown=node:node --from=build /app/dist /app/dist
43+
# Copy configs and PM2 startup script from local machine
44+
COPY --chown=node:node config /app/config
45+
COPY --chown=node:node docker/dspace-ui.json /app/dspace-ui.json
46+
47+
# Start up UI in PM2 in production mode
3348
WORKDIR /app
3449

3550
# Only copy built files and config

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ If you run into odd test errors, see the Angular guide to debugging tests: https
263263

264264
E2E tests (aka integration tests) use [Cypress.io](https://www.cypress.io/). Configuration for cypress can be found in the `cypress.json` file in the root directory.
265265

266-
The test files can be found in the `./cypress/integration/` folder.
266+
The test files can be found in the `./cypress/e2e/` folder.
267267

268268
Before you can run e2e tests, two things are REQUIRED:
269269
1. You MUST be running the DSpace backend (i.e. REST API) locally. The e2e tests will *NOT* succeed if run against our demo/sandbox REST API (https://demo.dspace.org/server/ or https://sandbox.dspace.org/server/), as those sites may have content added/removed at any time.
@@ -291,7 +291,7 @@ The `ng e2e` command will start Cypress and allow you to select the browser you
291291
292292
#### Writing E2E Tests
293293
294-
All E2E tests must be created under the `./cypress/integration/` folder, and must end in `.spec.ts`. Subfolders are allowed.
294+
All E2E tests must be created under the `./cypress/e2e/` folder, and must end in `.spec.ts`. Subfolders are allowed.
295295
296296
* The easiest way to start creating new tests is by running `ng e2e`. This builds the app and brings up Cypress.
297297
* From here, if you are editing an existing test file, you can either open it in your IDE or run it first to see what it already does.
@@ -370,9 +370,9 @@ dspace-angular
370370
├── config *
371371
│ └── config.yml * Default app config
372372
├── cypress * Folder for Cypress (https://cypress.io/) / e2e tests
373-
│ ├── downloads *
374-
│ ├── fixtures * Folder for e2e/integration test files
375-
│ ├── integration * Folder for any fixtures needed by e2e tests
373+
│ ├── downloads * (Optional) Folder for files downloaded during e2e tests
374+
│ ├── e2e * Folder for e2e/integration test files
375+
│ ├── fixtures * Folder for reusable static test data (JSON, images, etc.)
376376
│ ├── plugins * Folder for Cypress plugins (if any)
377377
│ ├── support * Folder for global e2e test actions/commands (run for all tests)
378378
│ └── tsconfig.json * TypeScript configuration file for e2e tests

bitbucket-pipelines.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ definitions:
278278
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
279279
- git clone https://${BB_USER}:${BB_USER_TOKEN}@${DSPACE_VALUES_REPO}
280280
- cd dspace-values
281-
- '[ -f */test/"${BRANCH_FILE}" ] && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "staging/${BRANCH_FILE}"'
281+
- '[ -f */test/"${BRANCH_FILE}" ] && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" */test/"${BRANCH_FILE}"'
282282
- git config --global user.email "${BB_USER}"
283283
- git config --global user.name "${BB_EMAIL}"
284284
- git commit -am "Enable test environment for ${BRANCH_NAME}" || echo "No changes to commit"
@@ -401,6 +401,10 @@ pipelines:
401401
- step: *turn-on-staging
402402
turn-on-test:
403403
- step: *turn-on-test
404+
build-images:
405+
- step: *check-branch-name-allowed
406+
- step: *angular-build
407+
- step: *build-and-push
404408
branches:
405409
'main-cris':
406410
- step: *check-branch-name-allowed

config/config.example.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ ui:
88
ssl: false
99
host: localhost
1010
port: 4000
11+
# Specify the public URL that this user interface responds to. This corresponds to the "dspace.ui.url" property in your backend's local.cfg.
12+
# SSR is only enabled when the client's "Host" HTTP header matches this baseUrl. The baseUrl is also used for redirects and SEO links (in robots.txt).
13+
baseUrl: http://localhost:4000
1114
# NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript
1215
nameSpace: /
1316
# The rateLimiter settings limit each IP to a 'max' of 500 requests per 'windowMs' (1 minute).
@@ -87,6 +90,9 @@ cache:
8790
# NOTE: When updates are made to compiled *.js files, it will automatically bypass this browser cache, because
8891
# all compiled *.js files include a unique hash in their name which updates when content is modified.
8992
control: max-age=604800 # revalidate browser
93+
# These static files should not be cached (paths relative to dist/browser, including the leading slash)
94+
noCacheFiles:
95+
- '/index.html'
9096
autoSync:
9197
defaultTime: 0
9298
maxBufferSize: 100
@@ -359,6 +365,10 @@ languages:
359365
- code: vi
360366
label: Tiếng Việt
361367
active: true
368+
- code: zh-TW
369+
label: 繁體中文
370+
active: true
371+
362372

363373

364374
# Browse-By Pages
@@ -479,6 +489,7 @@ themes:
479489
# - name: BASE_THEME_NAME
480490
#
481491
- name: dspace
492+
prefetch: true
482493
headTags:
483494
- tagName: link
484495
attributes:

0 commit comments

Comments
 (0)