Skip to content

Commit 749f1ef

Browse files
authored
fix: Switch release workflow to test chromium/firefox only and add sharding (#1329)
1 parent 067b9d9 commit 749f1ef

1 file changed

Lines changed: 96 additions & 18 deletions

File tree

.github/workflows/release.yml

Lines changed: 96 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,126 @@ on:
55
types: [created]
66

77
jobs:
8-
build-and-publish:
8+
build-and-unit:
9+
name: Build & Unit Tests
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
cache: "npm"
24+
25+
- name: Install dependencies
26+
run: npm install
27+
28+
- name: Run unit tests
29+
run: npm run test:min
30+
31+
- name: Build (prod)
32+
run: npm run build:all:prod
33+
34+
- name: Upload build artifacts
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: build-output
38+
path: dist/
39+
retention-days: 1
40+
41+
integration-tests:
42+
name: Integration (${{ matrix.browser }}, Shard ${{ matrix.shard }}/4)
43+
needs: build-and-unit
44+
runs-on: ubuntu-latest
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
browser: [chromium, firefox]
49+
shard: [1, 2, 3, 4]
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: 20
58+
cache: "npm"
59+
60+
- name: Install dependencies
61+
run: npm install
62+
63+
- name: Download build artifacts
64+
uses: actions/download-artifact@v4
65+
with:
66+
name: build-output
67+
path: dist/
68+
69+
- name: Cache Playwright browsers
70+
uses: actions/cache@v4
71+
id: playwright-cache
72+
with:
73+
path: ~/.cache/ms-playwright
74+
key: playwright-${{ runner.os }}-${{ matrix.browser }}-${{ hashFiles('package-lock.json') }}
75+
76+
- name: Install Playwright browser
77+
if: steps.playwright-cache.outputs.cache-hit != 'true'
78+
run: npx playwright install --with-deps ${{ matrix.browser }}
79+
80+
- name: Install Playwright deps only
81+
if: steps.playwright-cache.outputs.cache-hit == 'true'
82+
run: npx playwright install-deps ${{ matrix.browser }}
83+
84+
- name: Run integration tests (${{ matrix.browser }}, shard ${{ matrix.shard }}/4)
85+
run: npx playwright test --project=${{ matrix.browser }} --shard=${{ matrix.shard }}/4 --reporter=list
86+
87+
- name: Upload test results
88+
if: always()
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: playwright-results-${{ matrix.browser }}-shard-${{ matrix.shard }}
92+
path: test-results/
93+
retention-days: 7
94+
if-no-files-found: ignore
95+
96+
publish:
97+
name: Publish to npm
98+
needs: [build-and-unit, integration-tests]
999
runs-on: ubuntu-latest
10100
permissions:
11101
contents: write
12102
id-token: write
13103
steps:
14-
# Checkout repository
15104
- name: Checkout code
16105
uses: actions/checkout@v4
17106
with:
18107
fetch-depth: 0
19108
token: ${{ secrets.GITHUB_TOKEN }}
20109

21-
# Set up Node.js with OIDC
22110
- name: Setup Node.js
23111
uses: actions/setup-node@v4
24112
with:
25113
node-version: 20
26114
registry-url: 'https://registry.npmjs.org'
27115
cache: "npm"
28116

29-
# Ensure latest npm for OIDC support
30117
- name: Update npm
31118
run: npm install -g npm@latest
32119

33-
# Install dependencies
34120
- name: Install dependencies
35121
run: npm install
36122

37-
# Build once (prod) to reuse for integration tests
38-
- name: Build (prod)
39-
run: npm run build:all:prod
40-
41-
# Install Playwright browsers
42-
- name: Install Playwright browsers
43-
run: npx playwright install --with-deps chromium
44-
45-
# Run tests
46-
- name: Run tests
47-
run: |
48-
npm run test:min
49-
npx playwright test --reporter=list
123+
- name: Download build artifacts
124+
uses: actions/download-artifact@v4
125+
with:
126+
name: build-output
127+
path: dist/
50128

51129
# Determine npm tag based on version
52130
- name: Determine npm tag

0 commit comments

Comments
 (0)