Skip to content

Commit 4449960

Browse files
Merge remote-tracking branch 'upstream/main' into fix-community-page-sorting_contribute-main
2 parents 74cd70d + c914b42 commit 4449960

1,109 files changed

Lines changed: 77370 additions & 46759 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.

.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: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"eslint-plugin-import",
77
"eslint-plugin-jsdoc",
88
"eslint-plugin-deprecation",
9-
"eslint-plugin-unused-imports"
9+
"unused-imports",
10+
"eslint-plugin-lodash",
11+
"eslint-plugin-jsonc"
1012
],
1113
"overrides": [
1214
{
@@ -202,7 +204,13 @@
202204
"deprecation/deprecation": "warn",
203205

204206
"import/order": "off",
205-
"import/no-deprecated": "warn"
207+
"import/no-deprecated": "warn",
208+
"import/no-namespace": "error",
209+
"unused-imports/no-unused-imports": "error",
210+
"lodash/import-scope": [
211+
"error",
212+
"method"
213+
]
206214
}
207215
},
208216
{
@@ -217,6 +225,42 @@
217225
"@angular-eslint/template/no-negated-async": "off",
218226
"@angular-eslint/template/eqeqeq": "off"
219227
}
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+
}
220264
}
221265
]
222266
}

.github/pull_request_template.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## References
22
_Add references/links to any related issues or PRs. These may include:_
3-
* Fixes #[issue-number]
4-
* Requires DSpace/DSpace#[pr-number] (if a REST API PR is required to test this)
3+
* Fixes #`issue-number` (if this fixes an issue ticket)
4+
* Requires DSpace/DSpace#`pr-number` (if a REST API PR is required to test this)
55

66
## Description
77
Short summary of changes (1-2 sentences).
@@ -19,8 +19,10 @@ List of changes in this PR:
1919
_This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!_
2020

2121
- [ ] My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
22-
- [ ] My PR passes [TSLint](https://palantir.github.io/tslint/) validation using `yarn run lint`
23-
- [ ] My PR doesn't introduce circular dependencies
22+
- [ ] My PR passes [ESLint](https://eslint.org/) validation using `yarn lint`
23+
- [ ] My PR doesn't introduce circular dependencies (verified via `yarn check-circ-deps`)
2424
- [ ] My PR includes [TypeDoc](https://typedoc.org/) comments for _all new (or modified) public methods and classes_. It also includes TypeDoc for large or complex private methods.
2525
- [ ] My PR passes all specs/tests and includes new/updated specs or tests based on the [Code Testing Guide](https://wiki.lyrasis.org/display/DSPACE/Code+Testing+Guide).
26-
- [ ] If my PR includes new, third-party dependencies (in `package.json`), I've made sure their licenses align with the [DSpace BSD License](https://github.com/DSpace/DSpace/blob/main/LICENSE) based on the [Licensing of Contributions](https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines#CodeContributionGuidelines-LicensingofContributions) documentation.
26+
- [ ] If my PR includes new libraries/dependencies (in `package.json`), I've made sure their licenses align with the [DSpace BSD License](https://github.com/DSpace/DSpace/blob/main/LICENSE) based on the [Licensing of Contributions](https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines#CodeContributionGuidelines-LicensingofContributions) documentation.
27+
- [ ] If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
28+
- [ ] If my PR fixes an issue ticket, I've [linked them together](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).

.github/workflows/build.yml

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,46 @@ name: Build
66
# Run this Build for all pushes / PRs to current branch
77
on: [push, pull_request]
88

9+
permissions:
10+
contents: read # to fetch code (actions/checkout)
11+
912
jobs:
1013
tests:
1114
runs-on: ubuntu-latest
1215
env:
1316
# The ci step will test the dspace-angular code against DSpace REST.
1417
# Direct that step to utilize a DSpace REST service that has been started in docker.
15-
DSPACE_REST_HOST: localhost
18+
# NOTE: These settings should be kept in sync with those in [src]/docker/docker-compose-ci.yml
19+
DSPACE_REST_HOST: 127.0.0.1
1620
DSPACE_REST_PORT: 8080
1721
DSPACE_REST_NAMESPACE: '/server'
1822
DSPACE_REST_SSL: false
23+
# Spin up UI on 127.0.0.1 to avoid host resolution issues in e2e tests with Node 18+
24+
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
1931
# When Chrome version is specified, we pin to a specific version of Chrome
2032
# Comment this out to use the latest release
2133
#CHROME_VERSION: "90.0.4430.212-1"
2234
strategy:
2335
# Create a matrix of Node versions to test against (in parallel)
2436
matrix:
25-
node-version: [14.x, 16.x]
37+
node-version: [16.x, 18.x]
2638
# Do NOT exit immediately if one matrix job fails
2739
fail-fast: false
2840
# These are the actual CI steps to perform per job
2941
steps:
3042
# https://github.com/actions/checkout
3143
- name: Checkout codebase
32-
uses: actions/checkout@v2
44+
uses: actions/checkout@v3
3345

3446
# https://github.com/actions/setup-node
3547
- name: Install Node.js ${{ matrix.node-version }}
36-
uses: actions/setup-node@v2
48+
uses: actions/setup-node@v3
3749
with:
3850
node-version: ${{ matrix.node-version }}
3951

@@ -56,9 +68,9 @@ jobs:
5668
# https://github.com/actions/cache/blob/main/examples.md#node---yarn
5769
- name: Get Yarn cache directory
5870
id: yarn-cache-dir-path
59-
run: echo "::set-output name=dir::$(yarn cache dir)"
71+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
6072
- name: Cache Yarn dependencies
61-
uses: actions/cache@v2
73+
uses: actions/cache@v3
6274
with:
6375
# Cache entire Yarn cache directory (see previous step)
6476
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -81,12 +93,16 @@ jobs:
8193
- name: Run specs (unit tests)
8294
run: yarn run test:headless
8395

96+
# Upload code coverage report to artifact (for one version of Node only),
97+
# so that it can be shared with the 'codecov' job (see below)
8498
# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
85-
# Upload coverage reports to Codecov (for one version of Node only)
86-
# https://github.com/codecov/codecov-action
87-
- name: Upload coverage to Codecov.io
88-
uses: codecov/codecov-action@v2
89-
if: matrix.node-version == '16.x'
99+
- name: Upload code coverage report to Artifact
100+
uses: actions/upload-artifact@v3
101+
if: matrix.node-version == '18.x'
102+
with:
103+
name: dspace-angular coverage report
104+
path: 'coverage/dspace-angular/lcov.info'
105+
retention-days: 14
90106

91107
# Using docker-compose start backend using CI configuration
92108
# and load assetstore from a cached copy
@@ -100,23 +116,22 @@ jobs:
100116
# https://github.com/cypress-io/github-action
101117
# (NOTE: to run these e2e tests locally, just use 'ng e2e')
102118
- name: Run e2e tests (integration tests)
103-
uses: cypress-io/github-action@v2
119+
uses: cypress-io/github-action@v5
104120
with:
105-
# Run tests in Chrome, headless mode
121+
# Run tests in Chrome, headless mode (default)
106122
browser: chrome
107-
headless: true
108123
# Start app before running tests (will be stopped automatically after tests finish)
109124
start: yarn run serve:ssr
110125
# Wait for backend & frontend to be available
111126
# NOTE: We use the 'sites' REST endpoint to also ensure the database is ready
112-
wait-on: http://localhost:8080/server/api/core/sites, http://localhost:4000
127+
wait-on: http://127.0.0.1:8080/server/api/core/sites, http://127.0.0.1:4000
113128
# Wait for 2 mins max for everything to respond
114129
wait-on-timeout: 120
115130

116131
# Cypress always creates a video of all e2e tests (whether they succeeded or failed)
117132
# Save those in an Artifact
118133
- name: Upload e2e test videos to Artifacts
119-
uses: actions/upload-artifact@v2
134+
uses: actions/upload-artifact@v3
120135
if: always()
121136
with:
122137
name: e2e-test-videos
@@ -125,7 +140,7 @@ jobs:
125140
# If e2e tests fail, Cypress creates a screenshot of what happened
126141
# Save those in an Artifact
127142
- name: Upload e2e test failure screenshots to Artifacts
128-
uses: actions/upload-artifact@v2
143+
uses: actions/upload-artifact@v3
129144
if: failure()
130145
with:
131146
name: e2e-test-screenshots
@@ -144,7 +159,7 @@ jobs:
144159
run: |
145160
nohup yarn run serve:ssr &
146161
printf 'Waiting for app to start'
147-
until curl --output /dev/null --silent --head --fail http://localhost:4000/home; do
162+
until curl --output /dev/null --silent --head --fail http://127.0.0.1:4000/home; do
148163
printf '.'
149164
sleep 2
150165
done
@@ -155,7 +170,7 @@ jobs:
155170
# This step also prints entire HTML of homepage for easier debugging if grep fails.
156171
- name: Verify SSR (server-side rendering)
157172
run: |
158-
result=$(wget -O- -q http://localhost:4000/home)
173+
result=$(wget -O- -q http://127.0.0.1:4000/home)
159174
echo "$result"
160175
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep DSpace
161176
@@ -164,3 +179,32 @@ jobs:
164179

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

.github/workflows/codescan.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# DSpace CodeQL code scanning configuration for GitHub
2+
# https://docs.github.com/en/code-security/code-scanning
3+
#
4+
# NOTE: Code scanning must be run separate from our default build.yml
5+
# because CodeQL requires a fresh build with all tests *disabled*.
6+
name: "Code Scanning"
7+
8+
# Run this code scan for all pushes / PRs to main branch. Also run once a week.
9+
on:
10+
push:
11+
branches: [ main ]
12+
pull_request:
13+
branches: [ main ]
14+
# Don't run if PR is only updating static documentation
15+
paths-ignore:
16+
- '**/*.md'
17+
- '**/*.txt'
18+
schedule:
19+
- cron: "37 0 * * 1"
20+
21+
jobs:
22+
analyze:
23+
name: Analyze Code
24+
runs-on: ubuntu-latest
25+
# Limit permissions of this GitHub action. Can only write to security-events
26+
permissions:
27+
actions: read
28+
contents: read
29+
security-events: write
30+
31+
steps:
32+
# https://github.com/actions/checkout
33+
- name: Checkout repository
34+
uses: actions/checkout@v3
35+
36+
# Initializes the CodeQL tools for scanning.
37+
# https://github.com/github/codeql-action
38+
- name: Initialize CodeQL
39+
uses: github/codeql-action/init@v2
40+
with:
41+
languages: javascript
42+
43+
# Autobuild attempts to build any compiled languages
44+
- name: Autobuild
45+
uses: github/codeql-action/autobuild@v2
46+
47+
# Perform GitHub Code Scanning.
48+
- name: Perform CodeQL Analysis
49+
uses: github/codeql-action/analyze@v2

0 commit comments

Comments
 (0)