Skip to content

Commit 4b83649

Browse files
committed
fix: test should preview and use new port
1 parent a5a09ea commit 4b83649

File tree

2 files changed

+51
-30
lines changed

2 files changed

+51
-30
lines changed

.github/workflows/deploy.yml

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ permissions:
1111
id-token: write
1212

1313
jobs:
14-
test:
14+
build:
1515
runs-on: ubuntu-latest
1616
env:
1717
GITHUB_TOKEN: ${{github.token}}
18-
timeout-minutes: 60
1918
steps:
20-
- uses: actions/checkout@v3
21-
- uses: actions/setup-node@v3
19+
- name: Checkout
20+
uses: actions/checkout@v3
2221
with:
23-
node-version: 18
22+
fetch-depth: 0
23+
2424
- name: Cache dependencies
2525
uses: actions/cache@v3
2626
id: npm-cache
@@ -29,30 +29,45 @@ jobs:
2929
with:
3030
path: "**/node_modules"
3131
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
32+
3233
- name: Install dependencies
3334
if: steps.npm-cache.outputs.cache-hit != 'true'
3435
run: npm ci
35-
- name: Install Playwright Browsers
36-
run: npx playwright install --with-deps chromium firefox
37-
- name: Run Playwright tests
38-
run: npx playwright test
39-
- uses: actions/upload-artifact@v3
40-
if: always()
36+
37+
- name: Install Playwright (for MermaidJS)
38+
run: npx playwright install --with-deps chromium
39+
40+
- name: Build Website
41+
run: npm run build
42+
43+
- name: Upload Built Website
44+
uses: actions/upload-pages-artifact@v1
4145
with:
42-
name: playwright-report
43-
path: playwright-report/
44-
retention-days: 30
46+
path: ./dist/
4547

46-
build:
47-
needs: test
48+
test:
49+
needs: build
4850
runs-on: ubuntu-latest
4951
env:
5052
GITHUB_TOKEN: ${{github.token}}
53+
timeout-minutes: 60
5154
steps:
52-
- name: Checkout
53-
uses: actions/checkout@v3
55+
- uses: actions/checkout@v3
56+
57+
- uses: actions/setup-node@v3
5458
with:
55-
fetch-depth: 0
59+
node-version: 18
60+
61+
- uses: actions/download-artifact@v3
62+
name: Retrieve output from build step
63+
with:
64+
name: github-pages
65+
path: ./website-build
66+
67+
- run: |
68+
mkdir -p ./dist
69+
tar -xf ./website-build/artifact.tar -C ./dist/ --strip-components=1
70+
name: Decompress build step output
5671
5772
- name: Cache dependencies
5873
uses: actions/cache@v3
@@ -62,20 +77,26 @@ jobs:
6277
with:
6378
path: "**/node_modules"
6479
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
80+
6581
- name: Install dependencies
6682
if: steps.npm-cache.outputs.cache-hit != 'true'
6783
run: npm ci
68-
- name: Install Playwright (for MermaidJS)
69-
run: npx playwright install --with-deps chromium
70-
- name: Build Website
71-
run: npm run build
72-
- name: Upload Built Website
73-
uses: actions/upload-pages-artifact@v1
84+
85+
- name: Install Playwright Browsers
86+
run: npx playwright install --with-deps chromium firefox
87+
88+
- name: Run Playwright tests
89+
run: npx playwright test
90+
91+
- uses: actions/upload-artifact@v3
92+
if: always()
7493
with:
75-
path: ./dist/
94+
name: playwright-report
95+
path: playwright-report/
96+
retention-days: 30
7697

7798
deploy:
78-
needs: build
99+
needs: test
79100
runs-on: ubuntu-latest
80101
environment:
81102
name: github-pages

playwright.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default defineConfig({
2424
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2525
use: {
2626
/* Base URL to use in actions like `await page.goto('/')`. */
27-
baseURL: "http://localhost:3000/",
27+
baseURL: "http://localhost:4321/",
2828

2929
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3030
trace: "on-first-retry",
@@ -70,8 +70,8 @@ export default defineConfig({
7070

7171
/* Run your local dev server before starting the tests */
7272
webServer: {
73-
command: "npm run dev",
74-
url: "http://localhost:3000/",
73+
command: "npm run preview",
74+
url: "http://localhost:4321/",
7575
timeout: 60 * 1000,
7676
reuseExistingServer: !process.env.CI,
7777
},

0 commit comments

Comments
 (0)