Skip to content
Latchkey

CI workflow (jhen0409/react-native-debugger)

The CI workflow from jhen0409/react-native-debugger, 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: jhen0409/react-native-debugger.github/workflows/main.ymlLicense MITView source

What it does

This is the CI workflow from the jhen0409/react-native-debugger 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, pull_request]

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  build-test-linux:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3.7.0
        with:
          node-version: 18.x
          cache: 'yarn'
      - name: Setup
        run: sudo apt-get install -y libgbm-dev
      - name: Test
        id: test
        run: |
          yarn
          cd npm-package && yarn && cd ..
          yarn test
          yarn build
          xvfb-run --auto-servernum yarn test-e2e
      - name: Upload artifacts on failure
        if: ${{ failure() && steps.test.conclusion == 'failure' }}
        uses: actions/upload-artifact@v3
        with:
          name: artifacts
          path: artifacts
          retention-days: 1
  build-test-macos:
    runs-on: macOS-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3.7.0
        with:
          node-version: 18.x
          cache: 'yarn'
      - name: Test
        id: test
        run: |
          yarn
          cd npm-package && yarn && cd ..
          yarn test
          yarn build
          yarn test-e2e
      - name: Upload artifacts on failure
        if: ${{ failure() && steps.test.conclusion == 'failure' }}
        uses: actions/upload-artifact@v3
        with:
          name: artifacts
          path: artifacts
          retention-days: 1
  build-test-windows:
    runs-on: windows-2022
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3.7.0
        with:
          node-version: 18.x
          cache: 'yarn'
      - name: Test
        id: test
        shell: bash
        run: |
          yarn config set network-timeout 500000 -g
          yarn
          cd npm-package && yarn && cd ..
          yarn build
          yarn test
          yarn test-e2e
      - name: Upload artifacts on failure
        if: ${{ failure() && steps.test.conclusion == 'failure' }}
        uses: actions/upload-artifact@v3
        with:
          name: artifacts
          path: artifacts
          retention-days: 1

The same workflow, on Latchkey

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

name: CI
 
on: [push, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true
 
jobs:
  build-test-linux:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3.7.0
        with:
          node-version: 18.x
          cache: 'yarn'
      - name: Setup
        run: sudo apt-get install -y libgbm-dev
      - name: Test
        id: test
        run: |
          yarn
          cd npm-package && yarn && cd ..
          yarn test
          yarn build
          xvfb-run --auto-servernum yarn test-e2e
      - name: Upload artifacts on failure
        if: ${{ failure() && steps.test.conclusion == 'failure' }}
        uses: actions/upload-artifact@v3
        with:
          name: artifacts
          path: artifacts
          retention-days: 1
  build-test-macos:
    timeout-minutes: 30
    runs-on: macOS-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3.7.0
        with:
          node-version: 18.x
          cache: 'yarn'
      - name: Test
        id: test
        run: |
          yarn
          cd npm-package && yarn && cd ..
          yarn test
          yarn build
          yarn test-e2e
      - name: Upload artifacts on failure
        if: ${{ failure() && steps.test.conclusion == 'failure' }}
        uses: actions/upload-artifact@v3
        with:
          name: artifacts
          path: artifacts
          retention-days: 1
  build-test-windows:
    timeout-minutes: 30
    runs-on: windows-2022
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3.7.0
        with:
          node-version: 18.x
          cache: 'yarn'
      - name: Test
        id: test
        shell: bash
        run: |
          yarn config set network-timeout 500000 -g
          yarn
          cd npm-package && yarn && cd ..
          yarn build
          yarn test
          yarn test-e2e
      - name: Upload artifacts on failure
        if: ${{ failure() && steps.test.conclusion == 'failure' }}
        uses: actions/upload-artifact@v3
        with:
          name: artifacts
          path: artifacts
          retention-days: 1

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 per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow