Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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
  • Loading branch information
souhailaS committed Jul 7, 2025
commit f3a7cb6ed126a5701a86ac53c09a380e0d36226c
178 changes: 69 additions & 109 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,33 +101,7 @@ jobs:
disable_search: true
files: ./coverage/codecov.json

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 'lts/*'
- run: npm ci

- name: Linter
run: npm run lint

knip:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 'lts/*'
- run: npm ci

- name: Unused exports
run: npm run knip

format:
quality-checks:
runs-on: ubuntu-latest

steps:
Expand All @@ -144,6 +118,12 @@ jobs:
restore-keys: |
${{ runner.os }}-dprint-

- name: Linter
run: npm run lint

- name: Unused exports
run: npm run knip

- name: Check formatting
run: npx dprint check

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

typecheck:
build-and-validate:
runs-on: ubuntu-latest

steps:
Expand All @@ -176,6 +156,67 @@ jobs:
- name: Build src
run: npx hereby build-src

- name: Build scripts
run: npx hereby scripts

- name: ESLint tests
run: npx hereby run-eslint-rules-tests

- name: Build tsc
run: npx hereby tsc

- name: Clean
run: npx hereby clean-src

- name: Self build
run: npx hereby build-src --built

baselines:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 'lts/*'
- run: npm ci

- name: Remove all baselines
run: rm -rf tests/baselines/reference

- name: Run tests
run: npm test &> /dev/null || exit 0

- name: Accept baselines
run: |
npx hereby baseline-accept
git add tests/baselines/reference

- name: Check baselines
id: check-baselines
run: |
function print_diff() {
if ! git diff --staged --exit-code --quiet --diff-filter=$1; then
echo "$2:"
git diff --staged --name-only --diff-filter=$1
fi
}

if ! git diff --staged --exit-code --quiet; then
print_diff ACR "Missing baselines"
print_diff MTUXB "Modified baselines"
print_diff D "Unused baselines"
git diff --staged > fix_baselines.patch
exit 1
fi

- name: Upload baseline diff artifact
if: ${{ failure() && steps.check-baselines.conclusion == 'failure' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: fix_baselines.patch
path: fix_baselines.patch

smoke:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -257,84 +298,3 @@ jobs:
- run: |
echo "See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID for more info."
node ./pr/scripts/checkPackageSize.mjs ./base ./pr >> $GITHUB_STEP_SUMMARY

misc:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 'lts/*'
- run: npm ci

- name: Build scripts
run: npx hereby scripts

- name: ESLint tests
run: npx hereby run-eslint-rules-tests

self-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 'lts/*'
- run: npm ci

- name: Build tsc
run: npx hereby tsc

- name: Clean
run: npx hereby clean-src

- name: Self build
run: npx hereby build-src --built

baselines:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 'lts/*'
- run: npm ci

- name: Remove all baselines
run: rm -rf tests/baselines/reference

- name: Run tests
run: npm test &> /dev/null || exit 0

- name: Accept baselines
run: |
npx hereby baseline-accept
git add tests/baselines/reference

- name: Check baselines
id: check-baselines
run: |
function print_diff() {
if ! git diff --staged --exit-code --quiet --diff-filter=$1; then
echo "$2:"
git diff --staged --name-only --diff-filter=$1
fi
}

if ! git diff --staged --exit-code --quiet; then
print_diff ACR "Missing baselines"
print_diff MTUXB "Modified baselines"
print_diff D "Unused baselines"
git diff --staged > fix_baselines.patch
exit 1
fi

- name: Upload baseline diff artifact
if: ${{ failure() && steps.check-baselines.conclusion == 'failure' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: fix_baselines.patch
path: fix_baselines.patch