Skip to content
Latchkey

CI workflow (mrdoob/three.js)

The CI workflow from mrdoob/three.js, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: mrdoob/three.js.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the mrdoob/three.js 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

workflow (.yml)
name: CI

on:
  pull_request:
    paths-ignore:
      - 'build/**'
      - 'docs/**'
      - 'files/**'

permissions:
  contents: read

jobs:
  test:
    name: Lint, Unit, Unit addons, Circular dependencies & Examples testing
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - name: Git checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
      - name: Install Node
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
        with:
          node-version: 24
          cache: 'npm'
      - name: Install dependencies
        run: npm ci

      - name: === Lint testing ===
        run: npm run lint

      - name: === Unit testing ===
        run: npm run test-unit

      - name: === Unit addons testing ===
        run: npm run test-unit-addons

      - name: === Examples ready for release ===
        run: npm run test-e2e-cov

  e2e:
    name: E2E testing
    runs-on: ${{ matrix.os }}
    timeout-minutes: 30
    permissions:
      contents: read
    strategy:
      fail-fast: false
      matrix:
        os: [ ubuntu-latest ]
        CI: [ 0, 1, 2, 3, 4 ]
    env:
      CI: ${{ matrix.CI }}
    steps:
      - name: Git checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
      - name: Install Node
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
        with:
          node-version: 24
          cache: 'npm'
      - name: Install Vulkan drivers and xvfb
        run: |
          sudo apt-get update
          sudo apt-get install -y mesa-vulkan-drivers xvfb
      - name: Install dependencies
        run: npm ci
      - name: Build
        run: npm run build

      - name: === E2E testing ===
        run: xvfb-run -a npm run test-e2e
      - name: Upload output screenshots
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
        if: always()
        with:
          name: Output screenshots-${{ matrix.os }}-${{ matrix.CI }}
          path: test/e2e/output-screenshots
          if-no-files-found: ignore

The same workflow, on Latchkey

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

name: CI
 
on:
  pull_request:
    paths-ignore:
      - 'build/**'
      - 'docs/**'
      - 'files/**'
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    name: Lint, Unit, Unit addons, Circular dependencies & Examples testing
    runs-on: latchkey-small
    permissions:
      contents: read
    steps:
      - name: Git checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
      - name: Install Node
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
        with:
          node-version: 24
          cache: 'npm'
      - name: Install dependencies
        run: npm ci
 
      - name: === Lint testing ===
        run: npm run lint
 
      - name: === Unit testing ===
        run: npm run test-unit
 
      - name: === Unit addons testing ===
        run: npm run test-unit-addons
 
      - name: === Examples ready for release ===
        run: npm run test-e2e-cov
 
  e2e:
    name: E2E testing
    runs-on: ${{ matrix.os }}
    timeout-minutes: 30
    permissions:
      contents: read
    strategy:
      fail-fast: false
      matrix:
        os: [ ubuntu-latest ]
        CI: [ 0, 1, 2, 3, 4 ]
    env:
      CI: ${{ matrix.CI }}
    steps:
      - name: Git checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
      - name: Install Node
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
        with:
          node-version: 24
          cache: 'npm'
      - name: Install Vulkan drivers and xvfb
        run: |
          sudo apt-get update
          sudo apt-get install -y mesa-vulkan-drivers xvfb
      - name: Install dependencies
        run: npm ci
      - name: Build
        run: npm run build
 
      - name: === E2E testing ===
        run: xvfb-run -a npm run test-e2e
      - name: Upload output screenshots
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
        if: always()
        with:
          name: Output screenshots-${{ matrix.os }}-${{ matrix.CI }}
          path: test/e2e/output-screenshots
          if-no-files-found: ignore
 

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 2 jobs (6 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