Skip to content
Latchkey

npm test workflow (partcad/partcad)

The npm test workflow from partcad/partcad, explained and optimized by Latchkey.

C

CI health: C - fair

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: partcad/partcad.github/workflows/npm-test.ymlLicense Apache-2.0View source

What it does

This is the npm test workflow from the partcad/partcad repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
# Run JavaScript tests for the VS Code extension
# TODO(clairbee): to be integrated into test.yml
name: npm test

on:
  pull_request:
  workflow_dispatch:
  push:
    branches:
      - main
      - devel
    paths:
      - partcad-ide-vscode/**

jobs:
  build:
    strategy:
      matrix:
        os: [macos-latest, ubuntu-latest] # windows-latest for some reason doesn't run test suite.
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 22.x
          cache: "npm"
          cache-dependency-path: partcad-ide-vscode/package-lock.json
      - working-directory: partcad-ide-vscode
        run: npm install
      - working-directory: partcad-ide-vscode
        run: xvfb-run -a npm test
        if: runner.os == 'Linux'
      - working-directory: partcad-ide-vscode
        run: npm test
        if: runner.os != 'Linux'

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

# Run JavaScript tests for the VS Code extension
# TODO(clairbee): to be integrated into test.yml
name: npm test
 
on:
  pull_request:
  workflow_dispatch:
  push:
    branches:
      - main
      - devel
    paths:
      - partcad-ide-vscode/**
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    strategy:
      matrix:
        os: [macos-latest, ubuntu-latest] # windows-latest for some reason doesn't run test suite.
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4
 
      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 22.x
          cache: "npm"
          cache-dependency-path: partcad-ide-vscode/package-lock.json
      - working-directory: partcad-ide-vscode
        run: npm install
      - working-directory: partcad-ide-vscode
        run: xvfb-run -a npm test
        if: runner.os == 'Linux'
      - working-directory: partcad-ide-vscode
        run: npm test
        if: runner.os != 'Linux'
 

What changed

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:

This workflow runs 1 job (2 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow