6868 # https://github.com/actions/cache/blob/main/examples.md#node---yarn
6969 - name : Get Yarn cache directory
7070 id : yarn-cache-dir-path
71- run : echo "::set-output name= dir:: $(yarn cache dir)"
71+ run : echo "dir= $(yarn cache dir)" >> $GITHUB_OUTPUT
7272 - name : Cache Yarn dependencies
7373 uses : actions/cache@v3
7474 with :
@@ -93,12 +93,16 @@ jobs:
9393 - name : Run specs (unit tests)
9494 run : yarn run test:headless
9595
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)
9698 # NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
97- # Upload coverage reports to Codecov (for one version of Node only)
98- # https://github.com/codecov/codecov-action
99- - name : Upload coverage to Codecov.io
100- uses : codecov/codecov-action@v3
101- 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
102106
103107 # Using docker-compose start backend using CI configuration
104108 # and load assetstore from a cached copy
@@ -112,11 +116,10 @@ jobs:
112116 # https://github.com/cypress-io/github-action
113117 # (NOTE: to run these e2e tests locally, just use 'ng e2e')
114118 - name : Run e2e tests (integration tests)
115- uses : cypress-io/github-action@v4
119+ uses : cypress-io/github-action@v5
116120 with :
117- # Run tests in Chrome, headless mode
121+ # Run tests in Chrome, headless mode (default)
118122 browser : chrome
119- headless : true
120123 # Start app before running tests (will be stopped automatically after tests finish)
121124 start : yarn run serve:ssr
122125 # Wait for backend & frontend to be available
@@ -176,3 +179,32 @@ jobs:
176179
177180 - name : Shutdown Docker containers
178181 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
0 commit comments