CI workflow (dwgx/WindsurfAPI)
The CI workflow from dwgx/WindsurfAPI, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, run de-duplication, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the CI workflow from the dwgx/WindsurfAPI repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
syntax:
name: Node syntax check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup Node 24
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Check JS syntax for all src files
run: |
find src -name '*.js' -type f -print0 | xargs -0 -n1 node --check
- name: Validate package.json
run: node -e "JSON.parse(require('fs').readFileSync('package.json'))"
- name: Validate JSON configs
run: |
for f in $(find . -maxdepth 2 -name '*.json' -not -path './node_modules/*' -not -path './.git/*'); do
echo "Checking $f"
node -e "JSON.parse(require('fs').readFileSync('$f'))"
done
test:
name: Unit tests shard ${{ matrix.shard }}
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3]
steps:
- uses: actions/checkout@v4
- name: Setup Node 24
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
# image-resize.test.js imports jimp (the sole runtime dependency), so the
# runner needs node_modules - without this step every shard that touches
# a jimp-importing test fails with ERR_MODULE_NOT_FOUND.
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test:shard -- ${{ matrix.shard }} 4
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: CI on: push: branches: [master] pull_request: branches: [master] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: syntax: name: Node syntax check runs-on: latchkey-small timeout-minutes: 10 steps: - uses: actions/checkout@v4 - name: Setup Node 24 uses: actions/setup-node@v4 with: cache: 'npm' node-version: '24' - name: Check JS syntax for all src files run: | find src -name '*.js' -type f -print0 | xargs -0 -n1 node --check - name: Validate package.json run: node -e "JSON.parse(require('fs').readFileSync('package.json'))" - name: Validate JSON configs run: | for f in $(find . -maxdepth 2 -name '*.json' -not -path './node_modules/*' -not -path './.git/*'); do echo "Checking $f" node -e "JSON.parse(require('fs').readFileSync('$f'))" done test: name: Unit tests shard ${{ matrix.shard }} runs-on: latchkey-small timeout-minutes: 20 strategy: fail-fast: false matrix: shard: [0, 1, 2, 3] steps: - uses: actions/checkout@v4 - name: Setup Node 24 uses: actions/setup-node@v4 with: node-version: '24' cache: 'npm' # image-resize.test.js imports jimp (the sole runtime dependency), so the # runner needs node_modules - without this step every shard that touches # a jimp-importing test fails with ERR_MODULE_NOT_FOUND. - name: Install dependencies run: npm ci - name: Run tests run: npm run test:shard -- ${{ matrix.shard }} 4
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- Cache dependency installs on the setup step so they are served from cache.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 2 jobs (5 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.