@@ -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 :
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
0 commit comments