Skip to content
Latchkey

CI workflow (microsoft/monaco-editor)

The CI workflow from microsoft/monaco-editor, explained and optimized by Latchkey.

D

CI health: D - needs work

Point runs-on at Latchkey and get caching, 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: microsoft/monaco-editor.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the microsoft/monaco-editor 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:
  push:
    branches:
      - main
  pull_request:

jobs:
  build:
    name: CI
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          persist-credentials: false

      - uses: actions/setup-node@v6
        with:
          node-version-file: .nvmrc

      - name: Cache node modules
        id: cacheNodeModules
        uses: actions/cache@v5
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules2-${{ hashFiles('**/package-lock.json', '**/package.json') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules2-

      - name: Install build tools
        if: steps.cache-node-modules.outputs.cache-hit != 'true'
        run: |
          sudo apt update -y
          sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev

      - name: execute `npm ci` (1)
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
          ELECTRON_SKIP_BINARY_DOWNLOAD: 1
        run: |
          npm ci

      - name: Download Playwright
        run: npx playwright install --with-deps

      - name: execute `npm ci` (2)
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
        run: npm ci --prefix webpack-plugin

      # # <building-from-source>
      # - name: Setup, Build & Test monaco-editor-core
      #   run: yarn ts-node ./scripts/ci/build-monaco-editor-core-pkg nightly
      #   env:
      #     VSCODE_REF: 'main'
      #     PRERELEASE_VERSION: 'dev-${today}'

      # - name: Link monaco-editor-core
      #   run: npm link
      #   working-directory: ./dependencies/vscode/out-monaco-editor-core

      # - name: Link monaco-editor-core
      #   run: npm link monaco-editor-core
      # # </building-from-source>

      # TODO: prettier formatting
      # - name: Check prettier
      #   run: npm run prettier-check

      - name: Build
        run: npm run build

      - name: Run unit tests
        run: npm test

      - name: Compile webpack plugin
        run: npm run compile --prefix webpack-plugin

      - name: Package using webpack plugin
        run: npm run package-for-smoketest

      #      - name: Package using parcel
      #        run: npm run package-for-smoketest-parcel --prefix test/smoke/parcel
      # Disabled for now, as the parcel bundler cannot deal with VS Code process variable

      - name: Run smoke test
        run: npm run smoketest

      - name: Install website node modules
        working-directory: website
        run: npm ci

      - name: Install most recent version of monaco-editor
        working-directory: website
        run: npm install monaco-editor

      - name: Build website
        working-directory: website
        run: npm run build

      - name: Test website
        working-directory: website
        run: npm run test

      - name: Upload website artifact
        uses: actions/upload-artifact@v6
        with:
          name: website
          path: ./website/dist

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:
      - main
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    name: CI
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v6
        with:
          persist-credentials: false
 
      - uses: actions/setup-node@v6
        with:
          cache: 'npm'
          node-version-file: .nvmrc
 
      - name: Cache node modules
        id: cacheNodeModules
        uses: actions/cache@v5
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules2-${{ hashFiles('**/package-lock.json', '**/package.json') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules2-
 
      - name: Install build tools
        if: steps.cache-node-modules.outputs.cache-hit != 'true'
        run: |
          sudo apt update -y
          sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev
 
      - name: execute `npm ci` (1)
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
          ELECTRON_SKIP_BINARY_DOWNLOAD: 1
        run: |
          npm ci
 
      - name: Download Playwright
        run: npx playwright install --with-deps
 
      - name: execute `npm ci` (2)
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
        run: npm ci --prefix webpack-plugin
 
      # # <building-from-source>
      # - name: Setup, Build & Test monaco-editor-core
      #   run: yarn ts-node ./scripts/ci/build-monaco-editor-core-pkg nightly
      #   env:
      #     VSCODE_REF: 'main'
      #     PRERELEASE_VERSION: 'dev-${today}'
 
      # - name: Link monaco-editor-core
      #   run: npm link
      #   working-directory: ./dependencies/vscode/out-monaco-editor-core
 
      # - name: Link monaco-editor-core
      #   run: npm link monaco-editor-core
      # # </building-from-source>
 
      # TODO: prettier formatting
      # - name: Check prettier
      #   run: npm run prettier-check
 
      - name: Build
        run: npm run build
 
      - name: Run unit tests
        run: npm test
 
      - name: Compile webpack plugin
        run: npm run compile --prefix webpack-plugin
 
      - name: Package using webpack plugin
        run: npm run package-for-smoketest
 
      #      - name: Package using parcel
      #        run: npm run package-for-smoketest-parcel --prefix test/smoke/parcel
      # Disabled for now, as the parcel bundler cannot deal with VS Code process variable
 
      - name: Run smoke test
        run: npm run smoketest
 
      - name: Install website node modules
        working-directory: website
        run: npm ci
 
      - name: Install most recent version of monaco-editor
        working-directory: website
        run: npm install monaco-editor
 
      - name: Build website
        working-directory: website
        run: npm run build
 
      - name: Test website
        working-directory: website
        run: npm run test
 
      - name: Upload website artifact
        uses: actions/upload-artifact@v6
        with:
          name: website
          path: ./website/dist
 

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 per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow