Skip to content

Commit 3da0107

Browse files
committed
[DSC-1429] Merge branch 'main-cris' into DSC-1429
# Conflicts: # src/app/breadcrumbs/breadcrumb/breadcrumb-tooltip.pipe.ts # src/app/breadcrumbs/breadcrumb/truncate-breadcrumb-item-characters.pipe.ts # src/config/default-app-config.ts
2 parents b3b433c + 1505e24 commit 3da0107

4,221 files changed

Lines changed: 331951 additions & 209415 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.

.eslintrc.json

Lines changed: 84 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,7 +162,6 @@
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",
@@ -183,7 +205,7 @@
183205
],
184206
"@typescript-eslint/type-annotation-spacing": "error",
185207
"@typescript-eslint/unified-signatures": "error",
186-
"@typescript-eslint/ban-types": "warn", // todo: deal with {} type issues & re-enable
208+
"@typescript-eslint/ban-types": "error",
187209
"@typescript-eslint/no-floating-promises": "warn",
188210
"@typescript-eslint/no-misused-promises": "warn",
189211
"@typescript-eslint/restrict-plus-operands": "warn",
@@ -200,17 +222,65 @@
200222
"@typescript-eslint/no-unsafe-return": "off",
201223
"@typescript-eslint/restrict-template-expressions": "off",
202224
"@typescript-eslint/require-await": "off",
225+
"@typescript-eslint/no-base-to-string": [
226+
"error",
227+
{
228+
"ignoredTypeNames": [
229+
"ResourceType",
230+
"Error"
231+
]
232+
}
233+
],
203234

204235
"deprecation/deprecation": "warn",
205236

237+
"simple-import-sort/imports": "error",
238+
"simple-import-sort/exports": "error",
206239
"import/order": "off",
240+
"import/first": "error",
241+
"import/newline-after-import": "error",
242+
"import/no-duplicates": "error",
207243
"import/no-deprecated": "warn",
208244
"import/no-namespace": "error",
245+
"import-newlines/enforce": [
246+
"error",
247+
{
248+
"items": 1,
249+
"semi": true,
250+
"forceSingleLine": true
251+
}
252+
],
253+
209254
"unused-imports/no-unused-imports": "error",
210255
"lodash/import-scope": [
211256
"error",
212257
"method"
213-
]
258+
],
259+
260+
"rxjs/no-nested-subscribe": "off", // todo: go over _all_ cases
261+
262+
// Custom DSpace Angular rules
263+
"dspace-angular-ts/themed-component-classes": "error",
264+
"dspace-angular-ts/themed-component-selectors": "error",
265+
"dspace-angular-ts/themed-component-usages": "error"
266+
}
267+
},
268+
{
269+
"files": [
270+
"*.spec.ts"
271+
],
272+
"parserOptions": {
273+
"project": [
274+
"./tsconfig.json",
275+
"./cypress/tsconfig.json"
276+
],
277+
"createDefaultProgram": true
278+
},
279+
"rules": {
280+
"prefer-const": "off",
281+
282+
// Custom DSpace Angular rules
283+
"dspace-angular-ts/themed-component-usages": "error"
214284
}
215285
},
216286
{
@@ -221,9 +291,8 @@
221291
"plugin:@angular-eslint/template/recommended"
222292
],
223293
"rules": {
224-
// todo: re-enable & fix errors
225-
"@angular-eslint/template/no-negated-async": "off",
226-
"@angular-eslint/template/eqeqeq": "off"
294+
// Custom DSpace Angular rules
295+
"dspace-angular-html/themed-component-usages": "error"
227296
}
228297
},
229298
{

.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/workflows/build.yml

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,26 @@ jobs:
3030
CYPRESS_BASE_URL: http://127.0.0.1:4000
3131
# When Chrome version is specified, we pin to a specific version of Chrome
3232
# Comment this out to use the latest release
33-
CHROME_VERSION: "116.0.5845.187-1"
33+
#CHROME_VERSION: "116.0.5845.187-1"
3434
# Bump Node heap size (OOM in CI after upgrading to Angular 15)
3535
NODE_OPTIONS: '--max-old-space-size=4096'
36+
# Project name to use when running "docker compose" prior to e2e tests
37+
COMPOSE_PROJECT_NAME: 'ci'
3638
strategy:
3739
# Create a matrix of Node versions to test against (in parallel)
3840
matrix:
39-
node-version: [16.x, 18.x]
41+
node-version: [18.x, 20.x]
4042
# Do NOT exit immediately if one matrix job fails
4143
fail-fast: false
4244
# These are the actual CI steps to perform per job
4345
steps:
4446
# https://github.com/actions/checkout
4547
- name: Checkout codebase
46-
uses: actions/checkout@v3
48+
uses: actions/checkout@v4
4749

4850
# https://github.com/actions/setup-node
4951
- name: Install Node.js ${{ matrix.node-version }}
50-
uses: actions/setup-node@v3
52+
uses: actions/setup-node@v4
5153
with:
5254
node-version: ${{ matrix.node-version }}
5355

@@ -72,7 +74,7 @@ jobs:
7274
id: yarn-cache-dir-path
7375
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
7476
- name: Cache Yarn dependencies
75-
uses: actions/cache@v3
77+
uses: actions/cache@v4
7678
with:
7779
# Cache entire Yarn cache directory (see previous step)
7880
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -83,8 +85,14 @@ jobs:
8385
- name: Install Yarn dependencies
8486
run: yarn install --frozen-lockfile
8587

88+
- name: Build lint plugins
89+
run: yarn run build:lint
90+
91+
- name: Run lint plugin tests
92+
run: yarn run test:lint:nobuild
93+
8694
- name: Run lint
87-
run: yarn run lint --quiet
95+
run: yarn run lint:nobuild --quiet
8896

8997
- name: Check for circular dependencies
9098
run: yarn run check-circ-deps
@@ -99,26 +107,26 @@ jobs:
99107
# so that it can be shared with the 'codecov' job (see below)
100108
# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
101109
- name: Upload code coverage report to Artifact
102-
uses: actions/upload-artifact@v3
110+
uses: actions/upload-artifact@v4
103111
if: matrix.node-version == '18.x'
104112
with:
105-
name: dspace-angular coverage report
113+
name: coverage-report-${{ matrix.node-version }}
106114
path: 'coverage/dspace-angular/lcov.info'
107115
retention-days: 14
108116

109-
# Using docker-compose start backend using CI configuration
117+
# Using "docker compose" start backend using CI configuration
110118
# and load assetstore from a cached copy
111119
- name: Start DSpace REST Backend via Docker (for e2e tests)
112120
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
121+
docker compose -f ./docker/docker-compose-ci.yml up -d
122+
docker compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
115123
docker container ls
116124
117125
# Run integration tests via Cypress.io
118126
# https://github.com/cypress-io/github-action
119127
# (NOTE: to run these e2e tests locally, just use 'ng e2e')
120128
- name: Run e2e tests (integration tests)
121-
uses: cypress-io/github-action@v5
129+
uses: cypress-io/github-action@v6
122130
with:
123131
# Run tests in Chrome, headless mode (default)
124132
browser: chrome
@@ -133,19 +141,19 @@ jobs:
133141
# Cypress always creates a video of all e2e tests (whether they succeeded or failed)
134142
# Save those in an Artifact
135143
- name: Upload e2e test videos to Artifacts
136-
uses: actions/upload-artifact@v3
144+
uses: actions/upload-artifact@v4
137145
if: always()
138146
with:
139-
name: e2e-test-videos
147+
name: e2e-test-videos-${{ matrix.node-version }}
140148
path: cypress/videos
141149

142150
# If e2e tests fail, Cypress creates a screenshot of what happened
143151
# Save those in an Artifact
144152
- name: Upload e2e test failure screenshots to Artifacts
145-
uses: actions/upload-artifact@v3
153+
uses: actions/upload-artifact@v4
146154
if: failure()
147155
with:
148-
name: e2e-test-screenshots
156+
name: e2e-test-screenshots-${{ matrix.node-version }}
149157
path: cypress/screenshots
150158

151159
- name: Stop app (in case it stays up after e2e tests)
@@ -170,17 +178,18 @@ jobs:
170178
# Get homepage and verify that the <meta name="title"> tag includes "DSpace".
171179
# If it does, then SSR is working, as this tag is created by our MetadataService.
172180
# This step also prints entire HTML of homepage for easier debugging if grep fails.
173-
- name: Verify SSR (server-side rendering)
174-
run: |
175-
result=$(wget -O- -q http://127.0.0.1:4000/home)
176-
echo "$result"
177-
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep DSpace
181+
# TODO: enable this step once we have a CRIS back end to test against
182+
# - name: Verify SSR (server-side rendering)
183+
# run: |
184+
# result=$(wget -O- -q http://127.0.0.1:4000/home)
185+
# echo "$result"
186+
# echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep DSpace
178187

179188
- name: Stop running app
180189
run: kill -9 $(lsof -t -i:4000)
181190

182191
- name: Shutdown Docker containers
183-
run: docker-compose -f ./docker/docker-compose-ci.yml down
192+
run: docker compose -f ./docker/docker-compose-ci.yml down
184193

185194
# Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test
186195
# job above. This is necessary because Codecov uploads seem to randomly fail at times.
@@ -191,22 +200,27 @@ jobs:
191200
runs-on: ubuntu-latest
192201
steps:
193202
- name: Checkout
194-
uses: actions/checkout@v3
203+
uses: actions/checkout@v4
195204

196205
# Download artifacts from previous 'tests' job
197206
- name: Download coverage artifacts
198-
uses: actions/download-artifact@v3
207+
uses: actions/download-artifact@v4
199208

200209
# Now attempt upload to Codecov using its action.
201210
# NOTE: We use a retry action to retry the Codecov upload if it fails the first time.
202211
#
203212
# Retry action: https://github.com/marketplace/actions/retry-action
204213
# Codecov action: https://github.com/codecov/codecov-action
205214
- name: Upload coverage to Codecov.io
206-
uses: Wandalen/wretry.action@v1.0.36
215+
uses: Wandalen/wretry.action@v1.3.0
207216
with:
208-
action: codecov/codecov-action@v3
209-
# Try upload 5 times max
217+
action: codecov/codecov-action@v4
218+
# Ensure codecov-action throws an error when it fails to upload
219+
# This allows us to auto-restart the action if an error is thrown
220+
with: |
221+
fail_ci_if_error: true
222+
token: ${{ secrets.CODECOV_TOKEN }}
223+
# Try re-running action 5 times max
210224
attempt_limit: 5
211225
# Run again in 30 seconds
212226
attempt_delay: 30000

.github/workflows/codescan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
steps:
3636
# https://github.com/actions/checkout
3737
- name: Checkout repository
38-
uses: actions/checkout@v3
38+
uses: actions/checkout@v4
3939

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

0 commit comments

Comments
 (0)