Skip to content

Commit be7d9c3

Browse files
committed
ci: add redirect tests to PR preview workflow
Updates the preview workflow to include a new job for testing redirects against the deployed preview URL. Changes: - Adds a `test_redirects` job that runs `npx mocha test-redirects.js` using the `preview_url` from the `build_drafts_on` job. - Configures the redirect tests to run on Node.js 24.x in the `./test/redirects` directory.
1 parent 67a7603 commit be7d9c3

File tree

3 files changed

+64
-42
lines changed

3 files changed

+64
-42
lines changed

.github/workflows/preview.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
paths-ignore:
88
- 'docs/**'
99
- 'adrs/**'
10-
- '.gemini/**'
10+
- '.gemini/**'
1111
- '**/README.md'
1212
workflow_dispatch:
1313

@@ -135,4 +135,23 @@ jobs:
135135
run: |
136136
set -u
137137
npx playwright test --max-failures=1 --shard=${{ matrix.shard }}/${{ strategy.job-total }}
138-
138+
139+
test_redirects:
140+
runs-on: ubuntu-latest
141+
needs: build_drafts_on
142+
defaults:
143+
run:
144+
working-directory: ./test/redirects
145+
steps:
146+
- name: Checkout
147+
uses: actions/checkout@v4
148+
- name: Set up node
149+
uses: actions/setup-node@v6
150+
with:
151+
node-version: '24.x'
152+
- name: Install dependencies
153+
run: npm ci --registry=https://registry.npmjs.org/
154+
- name: Run redirect tests
155+
env:
156+
BASE_URL: ${{ needs.build_drafts_on.outputs.preview_url }}
157+
run: npx mocha test-redirects.js

test/redirects/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ Optionally set a `BASE_URL` environment varilable to test redirects against a di
1515

1616
`BASE_URL=https://staging.dora.dev npx mocha test-redirects.js`
1717
`docker run -it --env BASE_URL=https://staging.dora.dev test-redirects`
18+
19+
These tests are run as part of the preview workflow on GitHub via the `test_redirects` job specified in the `preview.yml` file.
20+

test/redirects/package-lock.json

Lines changed: 40 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)