Skip to content
Latchkey

CI workflow (postmanlabs/newman)

The CI workflow from postmanlabs/newman, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get 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: postmanlabs/newman.github/workflows/ci.ymlLicense Apache-2.0View source

What it does

This is the CI workflow from the postmanlabs/newman 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: CI

on:
    push:
        paths-ignore:
            - "*.md"
    pull_request:
        branches: [$default-branch]
    schedule:
        - cron: "0 12 * * 0"

concurrency:
    group: ${{ github.workflow }}-${{ github.ref }}
    cancel-in-progress: true

jobs:
    tests:
        name: Tests
        runs-on: ${{ matrix.os }}
        strategy:
            fail-fast: false
            matrix:
                node-version: [16, 18]
                os: [ubuntu-latest, windows-latest]

        steps:
            - name: Checkout repository
              uses: actions/checkout@v3

            - name: Use Node.js ${{ matrix.node-version }}
              uses: actions/setup-node@v3
              with:
                  node-version: ${{ matrix.node-version }}
                  cache: "npm"

            - name: Install
              run: npm ci

            - name: Run tests
              run: npm run test

    coverage:
        name: Coverage
        runs-on: ubuntu-latest

        steps:
            - name: Checkout repository
              uses: actions/checkout@v3

            - name: Use Node.js 20
              uses: actions/setup-node@v3
              with:
                  node-version: 20
                  cache: "npm"

            - name: Install
              run: npm ci

            - name: Run unit tests
              run: |
                  npm run test-unit
                  bash <(curl -s https://codecov.io/bash) -c -Z -f .coverage/coverage-final.json -F unit -t ${{ secrets.CODECOV_TOKEN }}

            - name: Run integration tests
              run: |
                  npm run test-integration
                  bash <(curl -s https://codecov.io/bash) -c -Z -f .coverage/coverage-final.json -F integration -t ${{ secrets.CODECOV_TOKEN }}

            - name: Run CLI tests
              run: |
                  npm run test-cli
                  bash <(curl -s https://codecov.io/bash) -c -Z -f .coverage/coverage-final.json -F cli -t ${{ secrets.CODECOV_TOKEN }}

            - name: Run library tests
              run: |
                  npm run test-library
                  bash <(curl -s https://codecov.io/bash) -c -Z -f .coverage/coverage-final.json -F library -t ${{ secrets.CODECOV_TOKEN }}

The same workflow, on Latchkey

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

name: CI
 
on:
    push:
        paths-ignore:
            - "*.md"
    pull_request:
        branches: [$default-branch]
    schedule:
        - cron: "0 12 * * 0"
 
concurrency:
    group: ${{ github.workflow }}-${{ github.ref }}
    cancel-in-progress: true
 
jobs:
    tests:
        timeout-minutes: 30
        name: Tests
        runs-on: ${{ matrix.os }}
        strategy:
            fail-fast: false
            matrix:
                node-version: [16, 18]
                os: [ubuntu-latest, windows-latest]
 
        steps:
            - name: Checkout repository
              uses: actions/checkout@v3
 
            - name: Use Node.js ${{ matrix.node-version }}
              uses: actions/setup-node@v3
              with:
                  node-version: ${{ matrix.node-version }}
                  cache: "npm"
 
            - name: Install
              run: npm ci
 
            - name: Run tests
              run: npm run test
 
    coverage:
        timeout-minutes: 30
        name: Coverage
        runs-on: latchkey-small
 
        steps:
            - name: Checkout repository
              uses: actions/checkout@v3
 
            - name: Use Node.js 20
              uses: actions/setup-node@v3
              with:
                  node-version: 20
                  cache: "npm"
 
            - name: Install
              run: npm ci
 
            - name: Run unit tests
              run: |
                  npm run test-unit
                  bash <(curl -s https://codecov.io/bash) -c -Z -f .coverage/coverage-final.json -F unit -t ${{ secrets.CODECOV_TOKEN }}
 
            - name: Run integration tests
              run: |
                  npm run test-integration
                  bash <(curl -s https://codecov.io/bash) -c -Z -f .coverage/coverage-final.json -F integration -t ${{ secrets.CODECOV_TOKEN }}
 
            - name: Run CLI tests
              run: |
                  npm run test-cli
                  bash <(curl -s https://codecov.io/bash) -c -Z -f .coverage/coverage-final.json -F cli -t ${{ secrets.CODECOV_TOKEN }}
 
            - name: Run library tests
              run: |
                  npm run test-library
                  bash <(curl -s https://codecov.io/bash) -c -Z -f .coverage/coverage-final.json -F library -t ${{ secrets.CODECOV_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 2 jobs (5 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