Skip to content
Latchkey

Test workflow (karma-runner/karma)

The Test workflow from karma-runner/karma, 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: karma-runner/karma.github/workflows/test.ymlLicense MITView source

What it does

This is the Test workflow from the karma-runner/karma 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: Test

on:
  pull_request:
    branches:
      - master

jobs:
  main:
    name: Unit (Client and Server), E2E and Integration Test
    runs-on: ubuntu-latest
    env:
      BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
      BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
      SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
      SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v2
        with:
          node-version: 16
          cache: npm
      - run: npm ci
      - run: npm run build:check
      - run: npm run test:unit
      - run: npm run test:e2e
      - run: npm run test:client
      - run: npm run test:integration
  linux:
    name: "Node ${{ matrix.node }} on Linux: Server Unit and E2E Test"
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: [10, 12, 14, 18]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node }}
          cache: npm
      - run: npm ci
      - run: npm run test:unit
      - run: npm run test:e2e
  windows:
    name: "Node ${{ matrix.node }} on Windows: Server Unit and Client Unit Test"
    runs-on: windows-latest
    strategy:
      matrix:
        node: [10, 12, 14, 16, 18]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node }}
          cache: npm
      - run: npm ci
      - run: npm run test:unit

The same workflow, on Latchkey

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

name: Test
 
on:
  pull_request:
    branches:
      - master
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  main:
    timeout-minutes: 30
    name: Unit (Client and Server), E2E and Integration Test
    runs-on: latchkey-small
    env:
      BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
      BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
      SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
      SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v2
        with:
          node-version: 16
          cache: npm
      - run: npm ci
      - run: npm run build:check
      - run: npm run test:unit
      - run: npm run test:e2e
      - run: npm run test:client
      - run: npm run test:integration
  linux:
    timeout-minutes: 30
    name: "Node ${{ matrix.node }} on Linux: Server Unit and E2E Test"
    runs-on: latchkey-small
    strategy:
      matrix:
        node: [10, 12, 14, 18]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node }}
          cache: npm
      - run: npm ci
      - run: npm run test:unit
      - run: npm run test:e2e
  windows:
    timeout-minutes: 30
    name: "Node ${{ matrix.node }} on Windows: Server Unit and Client Unit Test"
    runs-on: windows-latest
    strategy:
      matrix:
        node: [10, 12, 14, 16, 18]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node }}
          cache: npm
      - run: npm ci
      - run: npm run test:unit
 

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