Skip to content

Commit f3a7cb6

Browse files
committed
Optimize CI workflow by consolidating redundant jobs
- Merged lint, knip, and format into quality-checks job - Merged typecheck, misc, and self-check into build-and-validate job - Reduced from 12 to 8 jobs while preserving all functionality - Eliminated 12 redundant setup steps (checkout + node setup + npm ci) Jobs consolidated: - quality-checks: lint + knip + format (saved 6 steps) - build-and-validate: typecheck + misc + self-check (saved 6 steps) Total savings: 12 step executions per CI run
1 parent 833a8d4 commit f3a7cb6

1 file changed

Lines changed: 69 additions & 109 deletions

File tree

.github/workflows/ci.yml

Lines changed: 69 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -101,33 +101,7 @@ jobs:
101101
disable_search: true
102102
files: ./coverage/codecov.json
103103

104-
lint:
105-
runs-on: ubuntu-latest
106-
107-
steps:
108-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
109-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
110-
with:
111-
node-version: 'lts/*'
112-
- run: npm ci
113-
114-
- name: Linter
115-
run: npm run lint
116-
117-
knip:
118-
runs-on: ubuntu-latest
119-
120-
steps:
121-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
122-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
123-
with:
124-
node-version: 'lts/*'
125-
- run: npm ci
126-
127-
- name: Unused exports
128-
run: npm run knip
129-
130-
format:
104+
quality-checks:
131105
runs-on: ubuntu-latest
132106

133107
steps:
@@ -144,6 +118,12 @@ jobs:
144118
restore-keys: |
145119
${{ runner.os }}-dprint-
146120
121+
- name: Linter
122+
run: npm run lint
123+
124+
- name: Unused exports
125+
run: npm run knip
126+
147127
- name: Check formatting
148128
run: npx dprint check
149129

@@ -163,7 +143,7 @@ jobs:
163143
- name: Validate the browser can import TypeScript
164144
run: npx hereby test-browser-integration
165145

166-
typecheck:
146+
build-and-validate:
167147
runs-on: ubuntu-latest
168148

169149
steps:
@@ -176,6 +156,67 @@ jobs:
176156
- name: Build src
177157
run: npx hereby build-src
178158

159+
- name: Build scripts
160+
run: npx hereby scripts
161+
162+
- name: ESLint tests
163+
run: npx hereby run-eslint-rules-tests
164+
165+
- name: Build tsc
166+
run: npx hereby tsc
167+
168+
- name: Clean
169+
run: npx hereby clean-src
170+
171+
- name: Self build
172+
run: npx hereby build-src --built
173+
174+
baselines:
175+
runs-on: ubuntu-latest
176+
177+
steps:
178+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
179+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
180+
with:
181+
node-version: 'lts/*'
182+
- run: npm ci
183+
184+
- name: Remove all baselines
185+
run: rm -rf tests/baselines/reference
186+
187+
- name: Run tests
188+
run: npm test &> /dev/null || exit 0
189+
190+
- name: Accept baselines
191+
run: |
192+
npx hereby baseline-accept
193+
git add tests/baselines/reference
194+
195+
- name: Check baselines
196+
id: check-baselines
197+
run: |
198+
function print_diff() {
199+
if ! git diff --staged --exit-code --quiet --diff-filter=$1; then
200+
echo "$2:"
201+
git diff --staged --name-only --diff-filter=$1
202+
fi
203+
}
204+
205+
if ! git diff --staged --exit-code --quiet; then
206+
print_diff ACR "Missing baselines"
207+
print_diff MTUXB "Modified baselines"
208+
print_diff D "Unused baselines"
209+
git diff --staged > fix_baselines.patch
210+
exit 1
211+
fi
212+
213+
- name: Upload baseline diff artifact
214+
if: ${{ failure() && steps.check-baselines.conclusion == 'failure' }}
215+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
216+
with:
217+
name: fix_baselines.patch
218+
path: fix_baselines.patch
219+
179220
smoke:
180221
runs-on: ubuntu-latest
181222

@@ -257,84 +298,3 @@ jobs:
257298
- run: |
258299
echo "See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID for more info."
259300
node ./pr/scripts/checkPackageSize.mjs ./base ./pr >> $GITHUB_STEP_SUMMARY
260-
261-
misc:
262-
runs-on: ubuntu-latest
263-
264-
steps:
265-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
266-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
267-
with:
268-
node-version: 'lts/*'
269-
- run: npm ci
270-
271-
- name: Build scripts
272-
run: npx hereby scripts
273-
274-
- name: ESLint tests
275-
run: npx hereby run-eslint-rules-tests
276-
277-
self-check:
278-
runs-on: ubuntu-latest
279-
280-
steps:
281-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
282-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
283-
with:
284-
node-version: 'lts/*'
285-
- run: npm ci
286-
287-
- name: Build tsc
288-
run: npx hereby tsc
289-
290-
- name: Clean
291-
run: npx hereby clean-src
292-
293-
- name: Self build
294-
run: npx hereby build-src --built
295-
296-
baselines:
297-
runs-on: ubuntu-latest
298-
299-
steps:
300-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
301-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
302-
with:
303-
node-version: 'lts/*'
304-
- run: npm ci
305-
306-
- name: Remove all baselines
307-
run: rm -rf tests/baselines/reference
308-
309-
- name: Run tests
310-
run: npm test &> /dev/null || exit 0
311-
312-
- name: Accept baselines
313-
run: |
314-
npx hereby baseline-accept
315-
git add tests/baselines/reference
316-
317-
- name: Check baselines
318-
id: check-baselines
319-
run: |
320-
function print_diff() {
321-
if ! git diff --staged --exit-code --quiet --diff-filter=$1; then
322-
echo "$2:"
323-
git diff --staged --name-only --diff-filter=$1
324-
fi
325-
}
326-
327-
if ! git diff --staged --exit-code --quiet; then
328-
print_diff ACR "Missing baselines"
329-
print_diff MTUXB "Modified baselines"
330-
print_diff D "Unused baselines"
331-
git diff --staged > fix_baselines.patch
332-
exit 1
333-
fi
334-
335-
- name: Upload baseline diff artifact
336-
if: ${{ failure() && steps.check-baselines.conclusion == 'failure' }}
337-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
338-
with:
339-
name: fix_baselines.patch
340-
path: fix_baselines.patch

0 commit comments

Comments
 (0)