Skip to content
Latchkey

GitHub Actions Workflow for Matrix Across Operating Systems

Run your tests on Linux, macOS, and Windows together.

This workflow uses an OS matrix so platform-specific bugs surface in CI rather than in production.

The workflow

.github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: npm }
      - run: npm ci
      - run: npm test

Notes

  • macOS and Windows minutes cost more than Linux -- keep heavy jobs on Linux.
  • fail-fast: false surfaces every platform failure.
  • Use bash shell explicitly for cross-platform scripts.

Run it cheaper

Point runs-on: at a Latchkey label to run this workflow at roughly 69% lower per-minute cost, with self-healing for transient failures.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →