1515 workflow_dispatch :
1616
1717permissions :
18- contents : read # to fetch code (actions/checkout)
18+ contents : read # to fetch code (actions/checkout)
19+ packages : read # to fetch private images from GitHub Container Registry (GHCR)
1920
2021jobs :
2122 tests :
@@ -39,17 +40,22 @@ jobs:
3940 DSPACE_CACHE_SERVERSIDE_ANONYMOUSCACHE_MAX : 0
4041 # Tell Cypress to run e2e tests using the same UI URL
4142 CYPRESS_BASE_URL : http://127.0.0.1:4000
43+ # Disable the cookie consent banner in e2e tests to avoid errors because of elements hidden by it
44+ DSPACE_INFO_ENABLECOOKIECONSENTPOPUP : false
4245 # When Chrome version is specified, we pin to a specific version of Chrome
4346 # Comment this out to use the latest release
4447 # CHROME_VERSION: "90.0.4430.212-1"
4548 # Bump Node heap size (OOM in CI after upgrading to Angular 15)
4649 NODE_OPTIONS : ' --max-old-space-size=4096'
47- # Project name to use when running docker compose prior to e2e tests
50+ # Project name to use when running " docker compose" prior to e2e tests
4851 COMPOSE_PROJECT_NAME : ' ci'
52+ # Docker Registry to use for Docker compose scripts below.
53+ # We use GitHub's Container Registry to avoid aggressive rate limits at DockerHub.
54+ DOCKER_REGISTRY : ghcr.io
4955 strategy :
5056 # Create a matrix of Node versions to test against (in parallel)
5157 matrix :
52- node-version : [16 .x, 18 .x]
58+ node-version : [18 .x, 20 .x]
5359 # Do NOT exit immediately if one matrix job fails
5460 fail-fast : false
5561 # These are the actual CI steps to perform per job
@@ -96,17 +102,17 @@ jobs:
96102 - name : Install Yarn dependencies
97103 run : yarn install --frozen-lockfile
98104
99- - name : Run lint
100- run : yarn run lint --quiet
105+ # - name: Run lint
106+ # run: yarn run lint --quiet
101107
102- - name : Check for circular dependencies
103- run : yarn run check-circ-deps
108+ # - name: Check for circular dependencies
109+ # run: yarn run check-circ-deps
104110
105111 - name : Run build
106112 run : yarn run build:prod
107113
108- - name : Run specs (unit tests)
109- run : yarn run test:headless
114+ # - name: Run specs (unit tests)
115+ # run: yarn run test:headless
110116
111117 # Upload code coverage report to artifact (for one version of Node only),
112118 # so that it can be shared with the 'codecov' job (see below)
@@ -119,7 +125,15 @@ jobs:
119125 path : ' coverage/dspace-angular/lcov.info'
120126 retention-days : 14
121127
122- # Using docker compose start backend using CI configuration
128+ # Login to our Docker registry, so that we can access private Docker images using "docker compose" below.
129+ - name : Login to ${{ env.DOCKER_REGISTRY }}
130+ uses : docker/login-action@v3
131+ with :
132+ registry : ${{ env.DOCKER_REGISTRY }}
133+ username : ${{ github.repository_owner }}
134+ password : ${{ secrets.GITHUB_TOKEN }}
135+
136+ # Using "docker compose" start backend using CI configuration
123137 # and load assetstore from a cached copy
124138 - name : Start DSpace REST Backend via Docker (for e2e tests)
125139 run : |
@@ -183,21 +197,124 @@ jobs:
183197 # Get homepage and verify that the <meta name="title"> tag includes "DSpace".
184198 # If it does, then SSR is working, as this tag is created by our MetadataService.
185199 # This step also prints entire HTML of homepage for easier debugging if grep fails.
186- - name : Verify SSR (server-side rendering)
200+ - name : Verify SSR (server-side rendering) on Homepage
187201 run : |
188202 result=$(wget -O- -q http://127.0.0.1:4000/home)
189203 echo "$result"
190204 echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep Home
191205
206+ # Get a specific community in our test data and verify that the "<h1>" tag includes "Publications" (the community name).
207+ # If it does, then SSR is working.
208+ - name : Verify SSR on a Community page
209+ run : |
210+ result=$(wget -O- -q http://127.0.0.1:4000/communities/0958c910-2037-42a9-81c7-dca80e3892b4)
211+ echo "$result"
212+ echo "$result" | grep -oE "<h1 [^>]*>[^><]*</h1>" | grep Publications
213+
214+ # Get a specific collection in our test data and verify that the "<h1>" tag includes "Articles" (the collection name).
215+ # If it does, then SSR is working.
216+ - name : Verify SSR on a Collection page
217+ run : |
218+ result=$(wget -O- -q http://127.0.0.1:4000/collections/282164f5-d325-4740-8dd1-fa4d6d3e7200)
219+ echo "$result"
220+ echo "$result" | grep -oE "<h1 [^>]*>[^><]*</h1>" | grep Articles
221+
222+ # Get a specific publication in our test data and verify that the <meta name="title"> tag includes
223+ # the title of this publication. If it does, then SSR is working.
224+ - name : Verify SSR on a Publication page
225+ run : |
226+ result=$(wget -O- -q http://127.0.0.1:4000/entities/publication/6160810f-1e53-40db-81ef-f6621a727398)
227+ echo "$result"
228+ echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "An Economic Model of Mortality Salience"
229+
230+ # Get a specific person in our test data and verify that the <meta name="title"> tag includes
231+ # the name of the person. If it does, then SSR is working.
232+ - name : Verify SSR on a Person page
233+ run : |
234+ result=$(wget -O- -q http://127.0.0.1:4000/entities/person/b1b2c768-bda1-448a-a073-fc541e8b24d9)
235+ echo "$result"
236+ echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Simmons, Cameron"
237+
238+ # Get a specific project in our test data and verify that the <meta name="title"> tag includes
239+ # the name of the project. If it does, then SSR is working.
240+ - name : Verify SSR on a Project page
241+ run : |
242+ result=$(wget -O- -q http://127.0.0.1:4000/entities/project/46ccb608-a74c-4bf6-bc7a-e29cc7defea9)
243+ echo "$result"
244+ echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "University Research Fellowship"
245+
246+ # Get a specific orgunit in our test data and verify that the <meta name="title"> tag includes
247+ # the name of the orgunit. If it does, then SSR is working.
248+ - name : Verify SSR on an OrgUnit page
249+ run : |
250+ result=$(wget -O- -q http://127.0.0.1:4000/entities/orgunit/9851674d-bd9a-467b-8d84-068deb568ccf)
251+ echo "$result"
252+ echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Law and Development"
253+
254+ # Get a specific journal in our test data and verify that the <meta name="title"> tag includes
255+ # the name of the journal. If it does, then SSR is working.
256+ - name : Verify SSR on a Journal page
257+ run : |
258+ result=$(wget -O- -q http://127.0.0.1:4000/entities/journal/d4af6c3e-53d0-4757-81eb-566f3b45d63a)
259+ echo "$result"
260+ echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Environmental & Architectural Phenomenology"
261+
262+ # Get a specific journal volume in our test data and verify that the <meta name="title"> tag includes
263+ # the name of the volume. If it does, then SSR is working.
264+ - name : Verify SSR on a Journal Volume page
265+ run : |
266+ result=$(wget -O- -q http://127.0.0.1:4000/entities/journalvolume/07c6249f-4bf7-494d-9ce3-6ffdb2aed538)
267+ echo "$result"
268+ echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Environmental & Architectural Phenomenology Volume 28 (2017)"
269+
270+ # Get a specific journal issue in our test data and verify that the <meta name="title"> tag includes
271+ # the name of the issue. If it does, then SSR is working.
272+ - name : Verify SSR on a Journal Issue page
273+ run : |
274+ result=$(wget -O- -q http://127.0.0.1:4000/entities/journalissue/44c29473-5de2-48fa-b005-e5029aa1a50b)
275+ echo "$result"
276+ echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Environmental & Architectural Phenomenology Vol. 28, No. 1"
277+
278+ # Verify 301 Handle redirect behavior
279+ # Note: /handle/123456789/260 is the same test Publication used by our e2e tests
280+ - name : Verify 301 redirect from '/handle' URLs
281+ run : |
282+ result=$(wget --server-response --quiet http://127.0.0.1:4000/handle/123456789/260 2>&1 | head -1 | awk '{print $2}')
283+ echo "$result"
284+ [[ "$result" -eq "301" ]]
285+
286+ # Verify 403 error code behavior
287+ - name : Verify 403 error code from '/403'
288+ run : |
289+ result=$(wget --server-response --quiet http://127.0.0.1:4000/403 2>&1 | head -1 | awk '{print $2}')
290+ echo "$result"
291+ [[ "$result" -eq "403" ]]
292+
293+ # Verify 404 error code behavior
294+ - name : Verify 404 error code from '/404' and on invalid pages
295+ run : |
296+ result=$(wget --server-response --quiet http://127.0.0.1:4000/404 2>&1 | head -1 | awk '{print $2}')
297+ echo "$result"
298+ result2=$(wget --server-response --quiet http://127.0.0.1:4000/invalidurl 2>&1 | head -1 | awk '{print $2}')
299+ echo "$result2"
300+ [[ "$result" -eq "404" && "$result2" -eq "404" ]]
301+
302+ # Verify 500 error code behavior
303+ - name : Verify 500 error code from '/500'
304+ run : |
305+ result=$(wget --server-response --quiet http://127.0.0.1:4000/500 2>&1 | head -1 | awk '{print $2}')
306+ echo "$result"
307+ [[ "$result" -eq "500" ]]
308+
192309 - name : Stop running app
193310 run : kill -9 $(lsof -t -i:4000)
194311
195312 - name : Shutdown Docker containers
196313 run : docker compose -f ./docker/docker-compose-ci.yml down
197314
198- # Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test
199- # job above. This is necessary because Codecov uploads seem to randomly fail at times.
200- # See https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
315+ # # Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test
316+ # # job above. This is necessary because Codecov uploads seem to randomly fail at times.
317+ # # See https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
201318# codecov:
202319# # Must run after 'tests' job above
203320# needs: tests
0 commit comments