Commits

Tim Donohue authored and GitHub committed 971c302378b Merge
Merge pull request #2911 from tdonohue/update_actions_7x

[Port dspace-7_x] Update all GitHub Actions & add token for Codecov.io
No tags
gidlmaster

.github/workflows/build.yml

Modified
67 67 wget -q "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb"
68 68 sudo dpkg -i "google-chrome-stable_${CHROME_VERSION}_amd64.deb"
69 69 fi
70 70 google-chrome --version
71 71
72 72 # https://github.com/actions/cache/blob/main/examples.md#node---yarn
73 73 - name: Get Yarn cache directory
74 74 id: yarn-cache-dir-path
75 75 run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
76 76 - name: Cache Yarn dependencies
77 - uses: actions/cache@v3
77 + uses: actions/cache@v4
78 78 with:
79 79 # Cache entire Yarn cache directory (see previous step)
80 80 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
81 81 # Cache key is hash of yarn.lock. Therefore changes to yarn.lock will invalidate cache
82 82 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
83 83 restore-keys: ${{ runner.os }}-yarn-
84 84
85 85 - name: Install Yarn dependencies
86 86 run: yarn install --frozen-lockfile
87 87
94 94 - name: Run build
95 95 run: yarn run build:prod
96 96
97 97 - name: Run specs (unit tests)
98 98 run: yarn run test:headless
99 99
100 100 # Upload code coverage report to artifact (for one version of Node only),
101 101 # so that it can be shared with the 'codecov' job (see below)
102 102 # NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
103 103 - name: Upload code coverage report to Artifact
104 - uses: actions/upload-artifact@v3
104 + uses: actions/upload-artifact@v4
105 105 if: matrix.node-version == '18.x'
106 106 with:
107 - name: dspace-angular coverage report
107 + name: coverage-report-${{ matrix.node-version }}
108 108 path: 'coverage/dspace-angular/lcov.info'
109 109 retention-days: 14
110 110
111 111 # Using docker-compose start backend using CI configuration
112 112 # and load assetstore from a cached copy
113 113 - name: Start DSpace REST Backend via Docker (for e2e tests)
114 114 run: |
115 115 docker-compose -f ./docker/docker-compose-ci.yml up -d
116 116 docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
117 117 docker container ls
128 128 start: yarn run serve:ssr
129 129 # Wait for backend & frontend to be available
130 130 # NOTE: We use the 'sites' REST endpoint to also ensure the database is ready
131 131 wait-on: http://127.0.0.1:8080/server/api/core/sites, http://127.0.0.1:4000
132 132 # Wait for 2 mins max for everything to respond
133 133 wait-on-timeout: 120
134 134
135 135 # Cypress always creates a video of all e2e tests (whether they succeeded or failed)
136 136 # Save those in an Artifact
137 137 - name: Upload e2e test videos to Artifacts
138 - uses: actions/upload-artifact@v3
138 + uses: actions/upload-artifact@v4
139 139 if: always()
140 140 with:
141 - name: e2e-test-videos
141 + name: e2e-test-videos-${{ matrix.node-version }}
142 142 path: cypress/videos
143 143
144 144 # If e2e tests fail, Cypress creates a screenshot of what happened
145 145 # Save those in an Artifact
146 146 - name: Upload e2e test failure screenshots to Artifacts
147 - uses: actions/upload-artifact@v3
147 + uses: actions/upload-artifact@v4
148 148 if: failure()
149 149 with:
150 - name: e2e-test-screenshots
150 + name: e2e-test-screenshots-${{ matrix.node-version }}
151 151 path: cypress/screenshots
152 152
153 153 - name: Stop app (in case it stays up after e2e tests)
154 154 run: |
155 155 app_pid=$(lsof -t -i:4000)
156 156 if [[ ! -z $app_pid ]]; then
157 157 echo "App was still up! (PID: $app_pid)"
158 158 kill -9 $app_pid
159 159 fi
160 160
190 190 codecov:
191 191 # Must run after 'tests' job above
192 192 needs: tests
193 193 runs-on: ubuntu-latest
194 194 steps:
195 195 - name: Checkout
196 196 uses: actions/checkout@v4
197 197
198 198 # Download artifacts from previous 'tests' job
199 199 - name: Download coverage artifacts
200 - uses: actions/download-artifact@v3
200 + uses: actions/download-artifact@v4
201 201
202 202 # Now attempt upload to Codecov using its action.
203 203 # NOTE: We use a retry action to retry the Codecov upload if it fails the first time.
204 204 #
205 205 # Retry action: https://github.com/marketplace/actions/retry-action
206 206 # Codecov action: https://github.com/codecov/codecov-action
207 207 - name: Upload coverage to Codecov.io
208 208 uses: Wandalen/wretry.action@v1.3.0
209 209 with:
210 - action: codecov/codecov-action@v3
210 + action: codecov/codecov-action@v4
211 211 # Ensure codecov-action throws an error when it fails to upload
212 212 # This allows us to auto-restart the action if an error is thrown
213 213 with: |
214 214 fail_ci_if_error: true
215 + token: ${{ secrets.CODECOV_TOKEN }}
215 216 # Try re-running action 5 times max
216 217 attempt_limit: 5
217 218 # Run again in 30 seconds
218 219 attempt_delay: 30000

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut