Skip to content
Latchkey

CI workflow (i18next/i18next)

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

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: i18next/i18next.github/workflows/CI.ymlLicense MITView source

What it does

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

on:
  push:
    branches:
      - master
  pull_request:
    # types: [opened, synchronize, reopened, ready_for_review]
    branches:
      - '**'

jobs:
  codeQuality:
    name: Check code quality (lint and format)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version-file: '.nvmrc'
          cache: 'npm'

      - name: Install dependencies
        run: npm install

      - name: Format check
        run: npm run format

      - name: Lint
        run: npm run lint

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version-file: '.nvmrc'
          cache: 'npm'

      - name: Install dependencies
        run: npm install

      - name: Build
        run: npm run build

  test:
    name: Test on node ${{ matrix.node }} and ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node: ['24.x', '22.x', '20.x']
        os: [ubuntu-latest]
        # Collect coverage only for node 22 and ubuntu-latest, no need to run it twice
        # @see https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
        include:
          - collectCoverage: true
            node: '22.x'
            os: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: ${{ matrix.node }}
          cache: 'npm'

      - name: Install dependencies
        run: npm install

      - name: Test
        if: ${{ !matrix.collectCoverage }}
        run: npm test

      - name: Test with coverage
        if: ${{ matrix.collectCoverage }}
        run: npm run test:coverage

      - name: Coveralls
        if: ${{ matrix.collectCoverage }}
        uses: coverallsapp/github-action@v2

  testTypescript:
    name: Test typescript
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version-file: '.nvmrc'
          cache: 'npm'

      - name: Install dependencies
        run: npm install

      - name: Test
        run: npm run test:typescript

The same workflow, on Latchkey

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

name: CI
 
on:
  push:
    branches:
      - master
  pull_request:
    # types: [opened, synchronize, reopened, ready_for_review]
    branches:
      - '**'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  codeQuality:
    timeout-minutes: 30
    name: Check code quality (lint and format)
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v6
 
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version-file: '.nvmrc'
          cache: 'npm'
 
      - name: Install dependencies
        run: npm install
 
      - name: Format check
        run: npm run format
 
      - name: Lint
        run: npm run lint
 
  build:
    timeout-minutes: 30
    name: Build
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v6
 
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version-file: '.nvmrc'
          cache: 'npm'
 
      - name: Install dependencies
        run: npm install
 
      - name: Build
        run: npm run build
 
  test:
    timeout-minutes: 30
    name: Test on node ${{ matrix.node }} and ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node: ['24.x', '22.x', '20.x']
        os: [ubuntu-latest]
        # Collect coverage only for node 22 and ubuntu-latest, no need to run it twice
        # @see https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
        include:
          - collectCoverage: true
            node: '22.x'
            os: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
 
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: ${{ matrix.node }}
          cache: 'npm'
 
      - name: Install dependencies
        run: npm install
 
      - name: Test
        if: ${{ !matrix.collectCoverage }}
        run: npm test
 
      - name: Test with coverage
        if: ${{ matrix.collectCoverage }}
        run: npm run test:coverage
 
      - name: Coveralls
        if: ${{ matrix.collectCoverage }}
        uses: coverallsapp/github-action@v2
 
  testTypescript:
    timeout-minutes: 30
    name: Test typescript
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v6
 
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version-file: '.nvmrc'
          cache: 'npm'
 
      - name: Install dependencies
        run: npm install
 
      - name: Test
        run: npm run test:typescript
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

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 4 jobs (6 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