Skip to content
Latchkey

Master Build, Test & Deploy workflow (gchq/CyberChef)

The Master Build, Test & Deploy workflow from gchq/CyberChef, 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: gchq/CyberChef.github/workflows/master.ymlLicense Apache-2.0View source

What it does

This is the Master Build, Test & Deploy workflow from the gchq/CyberChef 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)
name: "Master Build, Test & Deploy"

on:
  workflow_dispatch:
  push:
    branches:
      - master

permissions:
  contents: read

jobs:
  main:
    permissions:
      contents: write
      pages: write
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Set node version
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: 24
          registry-url: "https://registry.npmjs.org"

      - name: Install
        run: |
          npm ci
          npm run setheapsize

      - name: Lint
        run: npx grunt lint

      - name: Unit Tests
        run: |
          npm test
          npm run testnodeconsumer

      - name: Production Build
        if: success()
        run: npx grunt prod --msg=""

      - name: Generate sitemap
        run: npx grunt exec:sitemap

      - name: Setup Chrome
        id: setup-chrome
        if: success()
        run: |
          npx @puppeteer/browsers install chrome@148
          echo chromedir=$(dirname $(find `pwd`/chrome/* -name chrome -print -quit)) >> $GITHUB_OUTPUT

      - name: UI Tests
        if: success()
        run: |
          export PATH=${{ steps.setup-chrome.outputs.chromedir }}:$PATH
          sudo apt-get install xvfb
          xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui

      - name: Prepare for GitHub Pages
        if: success()
        run: npx grunt copy:ghPages

      - name: Deploy to GitHub Pages
        if: success() && github.ref == 'refs/heads/master'
        uses: crazy-max/ghaction-github-pages@1d6ee9b181a81033a16bd707a1401afa978daab4 # v5.0.0
        with:
          target_branch: gh-pages
          build_dir: ./build/prod
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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: "Master Build, Test & Deploy"
 
on:
  workflow_dispatch:
  push:
    branches:
      - master
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  main:
    timeout-minutes: 30
    permissions:
      contents: write
      pages: write
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
 
      - name: Set node version
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          cache: 'npm'
          node-version: 24
          registry-url: "https://registry.npmjs.org"
 
      - name: Install
        run: |
          npm ci
          npm run setheapsize
 
      - name: Lint
        run: npx grunt lint
 
      - name: Unit Tests
        run: |
          npm test
          npm run testnodeconsumer
 
      - name: Production Build
        if: success()
        run: npx grunt prod --msg=""
 
      - name: Generate sitemap
        run: npx grunt exec:sitemap
 
      - name: Setup Chrome
        id: setup-chrome
        if: success()
        run: |
          npx @puppeteer/browsers install chrome@148
          echo chromedir=$(dirname $(find `pwd`/chrome/* -name chrome -print -quit)) >> $GITHUB_OUTPUT
 
      - name: UI Tests
        if: success()
        run: |
          export PATH=${{ steps.setup-chrome.outputs.chromedir }}:$PATH
          sudo apt-get install xvfb
          xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui
 
      - name: Prepare for GitHub Pages
        if: success()
        run: npx grunt copy:ghPages
 
      - name: Deploy to GitHub Pages
        if: success() && github.ref == 'refs/heads/master'
        uses: crazy-max/ghaction-github-pages@1d6ee9b181a81033a16bd707a1401afa978daab4 # v5.0.0
        with:
          target_branch: gh-pages
          build_dir: ./build/prod
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 

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