Skip to content

Commit 48896fd

Browse files
Merge branch 'main' into w2p-98422_Thumbnail-uploader_contribute-7.2
2 parents 35a9e7c + 37d9b5b commit 48896fd

1,167 files changed

Lines changed: 80965 additions & 40214 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.

.browserslistrc

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

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ trim_trailing_whitespace = false
1515

1616
[*.ts]
1717
quote_type = single
18+
19+
[*.json5]
20+
ij_json_keep_blank_lines_in_code = 3

.eslintrc.json

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"eslint-plugin-jsdoc",
88
"eslint-plugin-deprecation",
99
"unused-imports",
10-
"eslint-plugin-lodash"
10+
"eslint-plugin-lodash",
11+
"eslint-plugin-jsonc"
1112
],
1213
"overrides": [
1314
{
@@ -224,6 +225,42 @@
224225
"@angular-eslint/template/no-negated-async": "off",
225226
"@angular-eslint/template/eqeqeq": "off"
226227
}
228+
},
229+
{
230+
"files": [
231+
"*.json5"
232+
],
233+
"extends": [
234+
"plugin:jsonc/recommended-with-jsonc"
235+
],
236+
"rules": {
237+
"no-irregular-whitespace": "error",
238+
"no-trailing-spaces": "error",
239+
"jsonc/comma-dangle": [
240+
"error",
241+
"always-multiline"
242+
],
243+
"jsonc/indent": [
244+
"error",
245+
2
246+
],
247+
"jsonc/key-spacing": [
248+
"error",
249+
{
250+
"beforeColon": false,
251+
"afterColon": true,
252+
"mode": "strict"
253+
}
254+
],
255+
"jsonc/no-dupe-keys": "off",
256+
"jsonc/quotes": [
257+
"error",
258+
"double",
259+
{
260+
"avoidEscape": false
261+
}
262+
]
263+
}
227264
}
228265
]
229266
}

.github/workflows/build.yml

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,24 @@ jobs:
1515
env:
1616
# The ci step will test the dspace-angular code against DSpace REST.
1717
# Direct that step to utilize a DSpace REST service that has been started in docker.
18+
# NOTE: These settings should be kept in sync with those in [src]/docker/docker-compose-ci.yml
1819
DSPACE_REST_HOST: 127.0.0.1
1920
DSPACE_REST_PORT: 8080
2021
DSPACE_REST_NAMESPACE: '/server'
2122
DSPACE_REST_SSL: false
2223
# Spin up UI on 127.0.0.1 to avoid host resolution issues in e2e tests with Node 18+
2324
DSPACE_UI_HOST: 127.0.0.1
25+
DSPACE_UI_PORT: 4000
26+
# Ensure all SSR caching is disabled in test environment
27+
DSPACE_CACHE_SERVERSIDE_BOTCACHE_MAX: 0
28+
DSPACE_CACHE_SERVERSIDE_ANONYMOUSCACHE_MAX: 0
29+
# Tell Cypress to run e2e tests using the same UI URL
30+
CYPRESS_BASE_URL: http://127.0.0.1:4000
2431
# When Chrome version is specified, we pin to a specific version of Chrome
2532
# Comment this out to use the latest release
2633
#CHROME_VERSION: "90.0.4430.212-1"
34+
# Bump Node heap size (OOM in CI after upgrading to Angular 15)
35+
NODE_OPTIONS: '--max-old-space-size=4096'
2736
strategy:
2837
# Create a matrix of Node versions to test against (in parallel)
2938
matrix:
@@ -61,7 +70,7 @@ jobs:
6170
# https://github.com/actions/cache/blob/main/examples.md#node---yarn
6271
- name: Get Yarn cache directory
6372
id: yarn-cache-dir-path
64-
run: echo "::set-output name=dir::$(yarn cache dir)"
73+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
6574
- name: Cache Yarn dependencies
6675
uses: actions/cache@v3
6776
with:
@@ -86,12 +95,16 @@ jobs:
8695
- name: Run specs (unit tests)
8796
run: yarn run test:headless
8897

98+
# Upload code coverage report to artifact (for one version of Node only),
99+
# so that it can be shared with the 'codecov' job (see below)
89100
# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
90-
# Upload coverage reports to Codecov (for one version of Node only)
91-
# https://github.com/codecov/codecov-action
92-
- name: Upload coverage to Codecov.io
93-
uses: codecov/codecov-action@v3
94-
if: matrix.node-version == '16.x'
101+
- name: Upload code coverage report to Artifact
102+
uses: actions/upload-artifact@v3
103+
if: matrix.node-version == '18.x'
104+
with:
105+
name: dspace-angular coverage report
106+
path: 'coverage/dspace-angular/lcov.info'
107+
retention-days: 14
95108

96109
# Using docker-compose start backend using CI configuration
97110
# and load assetstore from a cached copy
@@ -105,11 +118,10 @@ jobs:
105118
# https://github.com/cypress-io/github-action
106119
# (NOTE: to run these e2e tests locally, just use 'ng e2e')
107120
- name: Run e2e tests (integration tests)
108-
uses: cypress-io/github-action@v4
121+
uses: cypress-io/github-action@v5
109122
with:
110-
# Run tests in Chrome, headless mode
123+
# Run tests in Chrome, headless mode (default)
111124
browser: chrome
112-
headless: true
113125
# Start app before running tests (will be stopped automatically after tests finish)
114126
start: yarn run serve:ssr
115127
# Wait for backend & frontend to be available
@@ -169,3 +181,32 @@ jobs:
169181

170182
- name: Shutdown Docker containers
171183
run: docker-compose -f ./docker/docker-compose-ci.yml down
184+
185+
# Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test
186+
# job above. This is necessary because Codecov uploads seem to randomly fail at times.
187+
# See https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
188+
codecov:
189+
# Must run after 'tests' job above
190+
needs: tests
191+
runs-on: ubuntu-latest
192+
steps:
193+
- name: Checkout
194+
uses: actions/checkout@v3
195+
196+
# Download artifacts from previous 'tests' job
197+
- name: Download coverage artifacts
198+
uses: actions/download-artifact@v3
199+
200+
# Now attempt upload to Codecov using its action.
201+
# NOTE: We use a retry action to retry the Codecov upload if it fails the first time.
202+
#
203+
# Retry action: https://github.com/marketplace/actions/retry-action
204+
# Codecov action: https://github.com/codecov/codecov-action
205+
- name: Upload coverage to Codecov.io
206+
uses: Wandalen/wretry.action@v1.0.36
207+
with:
208+
action: codecov/codecov-action@v3
209+
# Try upload 5 times max
210+
attempt_limit: 5
211+
# Run again in 30 seconds
212+
attempt_delay: 30000

.github/workflows/docker.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,33 @@ jobs:
8888
# Use tags / labels provided by 'docker/metadata-action' above
8989
tags: ${{ steps.meta_build.outputs.tags }}
9090
labels: ${{ steps.meta_build.outputs.labels }}
91+
92+
#####################################################
93+
# Build/Push the 'dspace/dspace-angular' image ('-dist' tag)
94+
#####################################################
95+
# https://github.com/docker/metadata-action
96+
# Get Metadata for docker_build_dist step below
97+
- name: Sync metadata (tags, labels) from GitHub to Docker for 'dspace-angular-dist' image
98+
id: meta_build_dist
99+
uses: docker/metadata-action@v4
100+
with:
101+
images: dspace/dspace-angular
102+
tags: ${{ env.IMAGE_TAGS }}
103+
# As this is a "dist" image, its tags are all suffixed with "-dist". Otherwise, it uses the same
104+
# tagging logic as the primary 'dspace/dspace-angular' image above.
105+
flavor: ${{ env.TAGS_FLAVOR }}
106+
suffix=-dist
107+
108+
- name: Build and push 'dspace-angular-dist' image
109+
id: docker_build_dist
110+
uses: docker/build-push-action@v3
111+
with:
112+
context: .
113+
file: ./Dockerfile.dist
114+
platforms: ${{ env.PLATFORMS }}
115+
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
116+
# but we ONLY do an image push to DockerHub if it's NOT a PR
117+
push: ${{ github.event_name != 'pull_request' }}
118+
# Use tags / labels provided by 'docker/metadata-action' above
119+
tags: ${{ steps.meta_build_dist.outputs.tags }}
120+
labels: ${{ steps.meta_build_dist.outputs.labels }}

.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@v0.3.0
19+
uses: actions/add-to-project@v0.5.0
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/label_merge_conflicts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424
# See: https://github.com/prince-chrismc/label-merge-conflicts-action
2525
- name: Auto-label PRs with merge conflicts
26-
uses: prince-chrismc/label-merge-conflicts-action@v2
26+
uses: prince-chrismc/label-merge-conflicts-action@v3
2727
# Add "merge conflict" label if a merge conflict is detected. Remove it when resolved.
2828
# Note, the authentication token is created automatically
2929
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token

Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,27 @@
22
# See https://github.com/DSpace/dspace-angular/tree/main/docker for usage details
33

44
FROM node:18-alpine
5-
WORKDIR /app
6-
ADD . /app/
7-
EXPOSE 4000
85

96
# Ensure Python and other build tools are available
107
# These are needed to install some node modules, especially on linux/arm64
118
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*
129

10+
WORKDIR /app
11+
ADD . /app/
12+
EXPOSE 4000
13+
1314
# We run yarn install with an increased network timeout (5min) to avoid "ESOCKETTIMEDOUT" errors from hub.docker.com
1415
# See, for example https://github.com/yarnpkg/yarn/issues/5540
1516
RUN yarn install --network-timeout 300000
1617

18+
# When running in dev mode, 4GB of memory is required to build & launch the app.
19+
# This default setting can be overridden as needed in your shell, via an env file or in docker-compose.
20+
# See Docker environment var precedence: https://docs.docker.com/compose/environment-variables/envvars-precedence/
21+
ENV NODE_OPTIONS="--max_old_space_size=4096"
22+
1723
# On startup, run in DEVELOPMENT mode (this defaults to live reloading enabled, etc).
1824
# Listen / accept connections from all IP addresses.
1925
# NOTE: At this time it is only possible to run Docker container in Production mode
20-
# if you have a public IP. See https://github.com/DSpace/dspace-angular/issues/1485
26+
# if you have a public URL. See https://github.com/DSpace/dspace-angular/issues/1485
27+
ENV NODE_ENV development
2128
CMD yarn serve --host 0.0.0.0

Dockerfile.dist

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This image will be published as dspace/dspace-angular:$DSPACE_VERSION-dist
2+
# See https://github.com/DSpace/dspace-angular/tree/main/docker for usage details
3+
4+
# Test build:
5+
# docker build -f Dockerfile.dist -t dspace/dspace-angular:dspace-7_x-dist .
6+
7+
FROM node:18-alpine as build
8+
9+
# Ensure Python and other build tools are available
10+
# These are needed to install some node modules, especially on linux/arm64
11+
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*
12+
13+
WORKDIR /app
14+
COPY package.json yarn.lock ./
15+
RUN yarn install --network-timeout 300000
16+
17+
ADD . /app/
18+
RUN yarn build:prod
19+
20+
FROM node:18-alpine
21+
RUN npm install --global pm2
22+
23+
COPY --chown=node:node --from=build /app/dist /app/dist
24+
COPY --chown=node:node config /app/config
25+
COPY --chown=node:node docker/dspace-ui.json /app/dspace-ui.json
26+
27+
WORKDIR /app
28+
USER node
29+
ENV NODE_ENV production
30+
EXPOSE 4000
31+
CMD pm2-runtime start dspace-ui.json --json

angular.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,16 +266,26 @@
266266
"options": {
267267
"lintFilePatterns": [
268268
"src/**/*.ts",
269-
"src/**/*.html"
269+
"src/**/*.html",
270+
"src/**/*.json5"
270271
]
271272
}
272273
}
273274
}
274275
}
275276
},
276-
"defaultProject": "dspace-angular",
277277
"cli": {
278278
"analytics": false,
279-
"defaultCollection": "@angular-eslint/schematics"
279+
"schematicCollections": [
280+
"@angular-eslint/schematics"
281+
]
282+
},
283+
"schematics": {
284+
"@angular-eslint/schematics:application": {
285+
"setParserOptionsProject": true
286+
},
287+
"@angular-eslint/schematics:library": {
288+
"setParserOptionsProject": true
289+
}
280290
}
281291
}

0 commit comments

Comments
 (0)