|
3 | 3 | # https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-nodejs |
4 | 4 | name: Build |
5 | 5 |
|
6 | | -# Run this Build for all pushes / PRs to current branch |
7 | | -on: [push, pull_request] |
| 6 | +# Run this Build for pushes to our main and all PRs |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - dtq-dev |
| 11 | + - customer/* |
| 12 | + pull_request: |
| 13 | + workflow_dispatch: |
8 | 14 |
|
9 | 15 | permissions: |
10 | 16 | contents: read # to fetch code (actions/checkout) |
|
24 | 30 | # Spin up UI on 127.0.0.1 to avoid host resolution issues in e2e tests with Node 20+ |
25 | 31 | DSPACE_UI_HOST: 127.0.0.1 |
26 | 32 | DSPACE_UI_PORT: 4000 |
| 33 | + # SSR only renders when the request Host matches ui.baseUrl's host. Set it explicitly to |
| 34 | + # the 127.0.0.1 host the e2e/SSR checks use; otherwise SSR falls back to CSR. |
27 | 35 | DSPACE_UI_BASEURL: http://127.0.0.1:4000 |
28 | 36 | # Ensure all SSR caching is disabled in test environment |
29 | 37 | DSPACE_CACHE_SERVERSIDE_BOTCACHE_MAX: 0 |
|
40 | 48 | # Project name to use when running "docker compose" prior to e2e tests |
41 | 49 | COMPOSE_PROJECT_NAME: 'ci' |
42 | 50 | # Docker Registry to use for Docker compose scripts below. |
43 | | - # On the upstream dspace/dspace-angular repository we use GitHub's Container Registry |
44 | | - # (ghcr.io) to avoid aggressive rate limits at DockerHub. Forks cannot authenticate |
45 | | - # against ghcr.io/dspace/* with their own GITHUB_TOKEN (and the images there require |
46 | | - # auth), so on forks we fall back to docker.io where the same images are public. |
47 | | - DOCKER_REGISTRY: ${{ github.repository == 'dspace/dspace-angular' && 'ghcr.io' || 'docker.io' }} |
| 51 | + # Using DockerHub as the images are publicly available there |
| 52 | + DOCKER_REGISTRY: docker.io |
48 | 53 | strategy: |
49 | 54 | # Create a matrix of Node versions to test against (in parallel) |
50 | 55 | matrix: |
@@ -124,18 +129,14 @@ jobs: |
124 | 129 | path: 'coverage/dspace-angular/lcov.info' |
125 | 130 | retention-days: 14 |
126 | 131 |
|
127 | | - # Login to our Docker registry, so that we can access Docker images using "docker compose" below. |
128 | | - # This login is required on the upstream repository because DOCKER_REGISTRY is set to ghcr.io |
129 | | - # and pulling ghcr.io/dspace/* requires authentication. On forks, DOCKER_REGISTRY falls back to |
130 | | - # docker.io (see env block above) where the same images are publicly pullable without a login, |
131 | | - # and forks cannot authenticate against ghcr.io/dspace/* with their own GITHUB_TOKEN anyway. |
132 | | - - name: Login to ${{ env.DOCKER_REGISTRY }} |
133 | | - uses: docker/login-action@v4 |
134 | | - if: github.repository == 'dspace/dspace-angular' |
135 | | - with: |
136 | | - registry: ${{ env.DOCKER_REGISTRY }} |
137 | | - username: ${{ github.repository_owner }} |
138 | | - password: ${{ secrets.GITHUB_TOKEN }} |
| 132 | + # Note: Docker login not required for public images from docker.io |
| 133 | + # If you need to use ghcr.io images, uncomment the login step below: |
| 134 | + # - name: Login to ${{ env.DOCKER_REGISTRY }} |
| 135 | + # uses: docker/login-action@v3 |
| 136 | + # with: |
| 137 | + # registry: ${{ env.DOCKER_REGISTRY }} |
| 138 | + # username: ${{ github.repository_owner }} |
| 139 | + # password: ${{ secrets.GITHUB_TOKEN }} |
139 | 140 |
|
140 | 141 | # Using "docker compose" start backend using CI configuration |
141 | 142 | # and load assetstore from a cached copy |
@@ -315,40 +316,3 @@ jobs: |
315 | 316 |
|
316 | 317 | - name: Shutdown Docker containers |
317 | 318 | run: docker compose -f ./docker/docker-compose-ci.yml down |
318 | | - |
319 | | - # Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test |
320 | | - # job above. This is necessary because Codecov uploads seem to randomly fail at times. |
321 | | - # See https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 |
322 | | - codecov: |
323 | | - # Must run after 'tests' job above |
324 | | - needs: tests |
325 | | - # Only run on the upstream repository: forks do not have the CODECOV_TOKEN secret, |
326 | | - # and Codecov refuses to create a commit on a protected branch without a token. |
327 | | - if: github.repository == 'dspace/dspace-angular' |
328 | | - runs-on: ubuntu-latest |
329 | | - steps: |
330 | | - - name: Checkout |
331 | | - uses: actions/checkout@v6 |
332 | | - |
333 | | - # Download artifacts from previous 'tests' job |
334 | | - - name: Download coverage artifacts |
335 | | - uses: actions/download-artifact@v8 |
336 | | - |
337 | | - # Now attempt upload to Codecov using its action. |
338 | | - # NOTE: We use a retry action to retry the Codecov upload if it fails the first time. |
339 | | - # |
340 | | - # Retry action: https://github.com/marketplace/actions/retry-action |
341 | | - # Codecov action: https://github.com/codecov/codecov-action |
342 | | - - name: Upload coverage to Codecov.io |
343 | | - uses: Wandalen/wretry.action@v3.8.0 |
344 | | - with: |
345 | | - action: codecov/codecov-action@v4 |
346 | | - # Ensure codecov-action throws an error when it fails to upload |
347 | | - # This allows us to auto-restart the action if an error is thrown |
348 | | - with: | |
349 | | - fail_ci_if_error: true |
350 | | - token: ${{ secrets.CODECOV_TOKEN }} |
351 | | - # Try re-running action 5 times max |
352 | | - attempt_limit: 5 |
353 | | - # Run again in 30 seconds |
354 | | - attempt_delay: 30000 |
0 commit comments