Skip to content

Commit a5d4d2f

Browse files
committed
Restructure typetests to reduce duplication
- Only run on push on master - Change React matrix to do 18 for edge TS versions, 19 for all - Change portability matrix to do Node for edge TS versions, Bundler for all
1 parent 28bf7f9 commit a5d4d2f

File tree

1 file changed

+58
-34
lines changed

1 file changed

+58
-34
lines changed

.github/workflows/tests.yml

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: CI
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
36
defaults:
47
run:
58
working-directory: ./packages/toolkit
@@ -70,18 +73,15 @@ jobs:
7073
matrix:
7174
node: ['24.x']
7275
react:
73-
[
74-
{
75-
version: '^18',
76-
types: ^18,
77-
react-dom: { version: '^18', types: '^18' },
78-
},
79-
{
80-
version: '^19',
81-
types: '^19',
82-
react-dom: { version: '^19', types: '^19' },
83-
},
84-
]
76+
# Define anchors for reuse throughout the file
77+
- &react18
78+
version: '^18'
79+
types: '^18'
80+
react-dom: { version: '^18', types: '^18' }
81+
- &react19
82+
version: '^19'
83+
types: '^19'
84+
react-dom: { version: '^19', types: '^19' }
8585

8686
steps:
8787
- name: Checkout repo
@@ -138,20 +138,20 @@ jobs:
138138
fail-fast: false
139139
matrix:
140140
node: ['24.x']
141-
ts: ['5.4', '5.5', '5.6', '5.7', '5.8', '5.9', 'next']
142-
react:
143-
[
144-
{
145-
version: '^18',
146-
types: ^18,
147-
react-dom: { version: '^18', types: '^18' },
148-
},
149-
{
150-
version: '^19',
151-
types: '^19',
152-
react-dom: { version: '^19', types: '^19' },
153-
},
154-
]
141+
# Sparse matrix: All TS versions with React 19, boundary TS versions with React 18
142+
include:
143+
# React 19 × all TS versions
144+
- { ts: '5.4', react: *react19 }
145+
- { ts: '5.5', react: *react19 }
146+
- { ts: '5.6', react: *react19 }
147+
- { ts: '5.7', react: *react19 }
148+
- { ts: '5.8', react: *react19 }
149+
- { ts: '5.9', react: *react19 }
150+
- { ts: 'next', react: *react19 }
151+
# React 18 × boundary TS versions only (5.4, 5.8, next)
152+
- { ts: '5.4', react: *react18 }
153+
- { ts: '5.8', react: *react18 }
154+
- { ts: 'next', react: *react18 }
155155

156156
steps:
157157
- name: Checkout repo
@@ -314,13 +314,37 @@ jobs:
314314
fail-fast: false
315315
matrix:
316316
node: ['24.x']
317-
ts: ['5.4', '5.5', '5.6', '5.7', '5.8', '5.9', 'next']
318-
example:
319-
[
320-
{ name: 'bundler', moduleResolution: 'Bundler' },
321-
{ name: 'nodenext-cjs', moduleResolution: 'NodeNext' },
322-
{ name: 'nodenext-esm', moduleResolution: 'NodeNext' },
323-
]
317+
# Sparse matrix: All TS versions with bundler, boundary TS versions with nodenext
318+
include:
319+
# bundler × all TS versions
320+
- ts: '5.4'
321+
example: { name: 'bundler', moduleResolution: 'Bundler' }
322+
- ts: '5.5'
323+
example: { name: 'bundler', moduleResolution: 'Bundler' }
324+
- ts: '5.6'
325+
example: { name: 'bundler', moduleResolution: 'Bundler' }
326+
- ts: '5.7'
327+
example: { name: 'bundler', moduleResolution: 'Bundler' }
328+
- ts: '5.8'
329+
example: { name: 'bundler', moduleResolution: 'Bundler' }
330+
- ts: '5.9'
331+
example: { name: 'bundler', moduleResolution: 'Bundler' }
332+
- ts: 'next'
333+
example: { name: 'bundler', moduleResolution: 'Bundler' }
334+
# nodenext-cjs × boundary TS versions only (5.4, 5.8, next)
335+
- ts: '5.4'
336+
example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' }
337+
- ts: '5.8'
338+
example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' }
339+
- ts: 'next'
340+
example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' }
341+
# nodenext-esm × boundary TS versions only (5.4, 5.8, next)
342+
- ts: '5.4'
343+
example: { name: 'nodenext-esm', moduleResolution: 'NodeNext' }
344+
- ts: '5.8'
345+
example: { name: 'nodenext-esm', moduleResolution: 'NodeNext' }
346+
- ts: 'next'
347+
example: { name: 'nodenext-esm', moduleResolution: 'NodeNext' }
324348
steps:
325349
- name: Checkout repo
326350
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5

0 commit comments

Comments
 (0)