Skip to content

Commit 9fdb823

Browse files
committed
Merge remote-tracking branch 'origin/dspace-8_x' into cache-bust-dynamic-configuration-8.x
2 parents c6bf2b7 + 70e6e51 commit 9fdb823

File tree

3,538 files changed

+185671
-76081
lines changed

Some content is hidden

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

3,538 files changed

+185671
-76081
lines changed

.eslintrc.json

Lines changed: 86 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@
88
"eslint-plugin-deprecation",
99
"unused-imports",
1010
"eslint-plugin-lodash",
11-
"eslint-plugin-jsonc"
11+
"eslint-plugin-jsonc",
12+
"eslint-plugin-rxjs",
13+
"eslint-plugin-simple-import-sort",
14+
"eslint-plugin-import-newlines",
15+
"eslint-plugin-jsonc",
16+
"dspace-angular-ts",
17+
"dspace-angular-html"
18+
],
19+
"ignorePatterns": [
20+
"lint/test/fixture"
1221
],
1322
"overrides": [
1423
{
@@ -18,7 +27,8 @@
1827
"parserOptions": {
1928
"project": [
2029
"./tsconfig.json",
21-
"./cypress/tsconfig.json"
30+
"./cypress/tsconfig.json",
31+
"./lint/tsconfig.json"
2232
],
2333
"createDefaultProgram": true
2434
},
@@ -27,17 +37,32 @@
2737
"plugin:@typescript-eslint/recommended",
2838
"plugin:@typescript-eslint/recommended-requiring-type-checking",
2939
"plugin:@angular-eslint/recommended",
30-
"plugin:@angular-eslint/template/process-inline-templates"
40+
"plugin:@angular-eslint/template/process-inline-templates",
41+
"plugin:rxjs/recommended"
3142
],
3243
"rules": {
44+
"indent": [
45+
"error",
46+
2,
47+
{
48+
"SwitchCase": 1,
49+
"ignoredNodes": [
50+
"ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
51+
]
52+
}
53+
],
3354
"max-classes-per-file": [
3455
"error",
3556
1
3657
],
3758
"comma-dangle": [
38-
"off",
59+
"error",
3960
"always-multiline"
4061
],
62+
"object-curly-spacing": [
63+
"error",
64+
"always"
65+
],
4166
"eol-last": [
4267
"error",
4368
"always"
@@ -104,15 +129,13 @@
104129
"allowTernary": true
105130
}
106131
],
107-
"prefer-const": "off", // todo: re-enable & fix errors (more strict than it used to be in TSLint)
132+
"prefer-const": "error",
133+
"no-case-declarations": "error",
134+
"no-extra-boolean-cast": "error",
108135
"prefer-spread": "off",
109136
"no-underscore-dangle": "off",
110-
111-
// todo: disabled rules from eslint:recommended, consider re-enabling & fixing
112137
"no-prototype-builtins": "off",
113138
"no-useless-escape": "off",
114-
"no-case-declarations": "off",
115-
"no-extra-boolean-cast": "off",
116139

117140
"@angular-eslint/directive-selector": [
118141
"error",
@@ -139,10 +162,10 @@
139162
}
140163
],
141164
"@angular-eslint/no-attribute-decorator": "error",
142-
"@angular-eslint/no-forward-ref": "error",
143165
"@angular-eslint/no-output-native": "warn",
144166
"@angular-eslint/no-output-on-prefix": "warn",
145167
"@angular-eslint/no-conflicting-lifecycle": "warn",
168+
"@angular-eslint/use-lifecycle-interface": "error",
146169

147170
"@typescript-eslint/no-inferrable-types":[
148171
"error",
@@ -183,7 +206,7 @@
183206
],
184207
"@typescript-eslint/type-annotation-spacing": "error",
185208
"@typescript-eslint/unified-signatures": "error",
186-
"@typescript-eslint/ban-types": "warn", // todo: deal with {} type issues & re-enable
209+
"@typescript-eslint/ban-types": "error",
187210
"@typescript-eslint/no-floating-promises": "warn",
188211
"@typescript-eslint/no-misused-promises": "warn",
189212
"@typescript-eslint/restrict-plus-operands": "warn",
@@ -200,17 +223,65 @@
200223
"@typescript-eslint/no-unsafe-return": "off",
201224
"@typescript-eslint/restrict-template-expressions": "off",
202225
"@typescript-eslint/require-await": "off",
226+
"@typescript-eslint/no-base-to-string": [
227+
"error",
228+
{
229+
"ignoredTypeNames": [
230+
"ResourceType",
231+
"Error"
232+
]
233+
}
234+
],
203235

204236
"deprecation/deprecation": "warn",
205237

238+
"simple-import-sort/imports": "error",
239+
"simple-import-sort/exports": "error",
206240
"import/order": "off",
241+
"import/first": "error",
242+
"import/newline-after-import": "error",
243+
"import/no-duplicates": "error",
207244
"import/no-deprecated": "warn",
208245
"import/no-namespace": "error",
246+
"import-newlines/enforce": [
247+
"error",
248+
{
249+
"items": 1,
250+
"semi": true,
251+
"forceSingleLine": true
252+
}
253+
],
254+
209255
"unused-imports/no-unused-imports": "error",
210256
"lodash/import-scope": [
211257
"error",
212258
"method"
213-
]
259+
],
260+
261+
"rxjs/no-nested-subscribe": "off", // todo: go over _all_ cases
262+
263+
// Custom DSpace Angular rules
264+
"dspace-angular-ts/themed-component-classes": "error",
265+
"dspace-angular-ts/themed-component-selectors": "error",
266+
"dspace-angular-ts/themed-component-usages": "error"
267+
}
268+
},
269+
{
270+
"files": [
271+
"*.spec.ts"
272+
],
273+
"parserOptions": {
274+
"project": [
275+
"./tsconfig.json",
276+
"./cypress/tsconfig.json"
277+
],
278+
"createDefaultProgram": true
279+
},
280+
"rules": {
281+
"prefer-const": "off",
282+
283+
// Custom DSpace Angular rules
284+
"dspace-angular-ts/themed-component-usages": "error"
214285
}
215286
},
216287
{
@@ -221,9 +292,9 @@
221292
"plugin:@angular-eslint/template/recommended"
222293
],
223294
"rules": {
224-
// todo: re-enable & fix errors
225-
"@angular-eslint/template/no-negated-async": "off",
226-
"@angular-eslint/template/eqeqeq": "off"
295+
// Custom DSpace Angular rules
296+
"dspace-angular-html/themed-component-usages": "error",
297+
"dspace-angular-html/no-disabled-attribute-on-button": "error"
227298
}
228299
},
229300
{

.gitattributes

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
*.css eol=lf
1414
*.scss eol=lf
1515
*.html eol=lf
16-
*.svg eol=lf
16+
*.svg eol=lf
17+
18+
# Generated documentation should have LF line endings to reduce git noise
19+
docs/lint/**/*.md eol=lf

.github/disabled-workflows/pull_request_opened.yml

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

.github/workflows/build.yml

Lines changed: 47 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 }}
@@ -83,8 +89,14 @@ jobs:
8389
- name: Install Yarn dependencies
8490
run: yarn install --frozen-lockfile
8591

92+
- name: Build lint plugins
93+
run: yarn run build:lint
94+
95+
- name: Run lint plugin tests
96+
run: yarn run test:lint:nobuild
97+
8698
- name: Run lint
87-
run: yarn run lint --quiet
99+
run: yarn run lint:nobuild --quiet
88100

89101
- name: Check for circular dependencies
90102
run: yarn run check-circ-deps
@@ -99,26 +111,34 @@ jobs:
99111
# so that it can be shared with the 'codecov' job (see below)
100112
# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
101113
- name: Upload code coverage report to Artifact
102-
uses: actions/upload-artifact@v3
114+
uses: actions/upload-artifact@v4
103115
if: matrix.node-version == '18.x'
104116
with:
105-
name: dspace-angular coverage report
117+
name: coverage-report-${{ matrix.node-version }}
106118
path: 'coverage/dspace-angular/lcov.info'
107119
retention-days: 14
108120

109-
# Using docker-compose start backend using CI configuration
121+
# Login to our Docker registry, so that we can access private Docker images using "docker compose" below.
122+
- name: Login to ${{ env.DOCKER_REGISTRY }}
123+
uses: docker/login-action@v3
124+
with:
125+
registry: ${{ env.DOCKER_REGISTRY }}
126+
username: ${{ github.repository_owner }}
127+
password: ${{ secrets.GITHUB_TOKEN }}
128+
129+
# Using "docker compose" start backend using CI configuration
110130
# and load assetstore from a cached copy
111131
- name: Start DSpace REST Backend via Docker (for e2e tests)
112132
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
133+
docker compose -f ./docker/docker-compose-ci.yml up -d
134+
docker compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
115135
docker container ls
116136
117137
# Run integration tests via Cypress.io
118138
# https://github.com/cypress-io/github-action
119139
# (NOTE: to run these e2e tests locally, just use 'ng e2e')
120140
- name: Run e2e tests (integration tests)
121-
uses: cypress-io/github-action@v5
141+
uses: cypress-io/github-action@v6
122142
with:
123143
# Run tests in Chrome, headless mode (default)
124144
browser: chrome
@@ -133,19 +153,19 @@ jobs:
133153
# Cypress always creates a video of all e2e tests (whether they succeeded or failed)
134154
# Save those in an Artifact
135155
- name: Upload e2e test videos to Artifacts
136-
uses: actions/upload-artifact@v3
156+
uses: actions/upload-artifact@v4
137157
if: always()
138158
with:
139-
name: e2e-test-videos
159+
name: e2e-test-videos-${{ matrix.node-version }}
140160
path: cypress/videos
141161

142162
# If e2e tests fail, Cypress creates a screenshot of what happened
143163
# Save those in an Artifact
144164
- name: Upload e2e test failure screenshots to Artifacts
145-
uses: actions/upload-artifact@v3
165+
uses: actions/upload-artifact@v4
146166
if: failure()
147167
with:
148-
name: e2e-test-screenshots
168+
name: e2e-test-screenshots-${{ matrix.node-version }}
149169
path: cypress/screenshots
150170

151171
- name: Stop app (in case it stays up after e2e tests)
@@ -180,7 +200,7 @@ jobs:
180200
run: kill -9 $(lsof -t -i:4000)
181201

182202
- name: Shutdown Docker containers
183-
run: docker-compose -f ./docker/docker-compose-ci.yml down
203+
run: docker compose -f ./docker/docker-compose-ci.yml down
184204

185205
# Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test
186206
# job above. This is necessary because Codecov uploads seem to randomly fail at times.
@@ -191,22 +211,27 @@ jobs:
191211
runs-on: ubuntu-latest
192212
steps:
193213
- name: Checkout
194-
uses: actions/checkout@v3
214+
uses: actions/checkout@v4
195215

196216
# Download artifacts from previous 'tests' job
197217
- name: Download coverage artifacts
198-
uses: actions/download-artifact@v3
218+
uses: actions/download-artifact@v4
199219

200220
# Now attempt upload to Codecov using its action.
201221
# NOTE: We use a retry action to retry the Codecov upload if it fails the first time.
202222
#
203223
# Retry action: https://github.com/marketplace/actions/retry-action
204224
# Codecov action: https://github.com/codecov/codecov-action
205225
- name: Upload coverage to Codecov.io
206-
uses: Wandalen/wretry.action@v1.0.36
226+
uses: Wandalen/wretry.action@v1.3.0
207227
with:
208-
action: codecov/codecov-action@v3
209-
# Try upload 5 times max
228+
action: codecov/codecov-action@v4
229+
# Ensure codecov-action throws an error when it fails to upload
230+
# This allows us to auto-restart the action if an error is thrown
231+
with: |
232+
fail_ci_if_error: true
233+
token: ${{ secrets.CODECOV_TOKEN }}
234+
# Try re-running action 5 times max
210235
attempt_limit: 5
211236
# Run again in 30 seconds
212237
attempt_delay: 30000

0 commit comments

Comments
 (0)