Skip to content
Latchkey

Browser Tests workflow (showdownjs/showdown)

The Browser Tests workflow from showdownjs/showdown, 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: showdownjs/showdown.github/workflows/browser.ymlLicense MITView source

What it does

This is the Browser Tests workflow from the showdownjs/showdown 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: Browser Tests

on:
  push:
    branches: [ master, develop ]
  pull_request:
    branches: [ master, develop ]

permissions:
  contents: read

jobs:
  browser:
    name: 'Browser tests (${{ matrix.browser }})'
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        browser: [chromium, firefox, webkit]
    steps:
      - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
      - name: Use Node.js 20.x
        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
        with:
          node-version: 20.x
          cache: 'npm'
      - run: npm ci
      - name: Install Playwright browser
        run: npx playwright install --with-deps ${{ matrix.browser }}
      - name: Run browser tests
        run: npm run test:browser -- --project ${{ matrix.browser }}

The same workflow, on Latchkey

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

name: Browser Tests
 
on:
  push:
    branches: [ master, develop ]
  pull_request:
    branches: [ master, develop ]
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  browser:
    timeout-minutes: 30
    name: 'Browser tests (${{ matrix.browser }})'
    runs-on: latchkey-small
    strategy:
      fail-fast: false
      matrix:
        browser: [chromium, firefox, webkit]
    steps:
      - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
      - name: Use Node.js 20.x
        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
        with:
          node-version: 20.x
          cache: 'npm'
      - run: npm ci
      - name: Install Playwright browser
        run: npx playwright install --with-deps ${{ matrix.browser }}
      - name: Run browser tests
        run: npm run test:browser -- --project ${{ matrix.browser }}
 

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 (3 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