E2E workflow (react/create-react-app)
The E2E workflow from react/create-react-app, explained and optimized by Latchkey.
CI health: A - excellent
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the E2E workflow from the react/create-react-app 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
on:
workflow_call:
inputs:
testScript:
required: true
type: string
name: E2E
jobs:
test:
name: 'Test (${{ matrix.os }}, Node ${{ matrix.node }})'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
node:
- '16'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install
run: npm ci --prefer-offline
- name: Initialize Global Git config
run: |
git config --global core.autocrlf false
git config --global user.name "Create React App"
git config --global user.email "cra@email.com"
- name: Run tests
run: ${{ inputs.testScript }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
on: workflow_call: inputs: testScript: required: true type: string name: E2E jobs: test: timeout-minutes: 30 name: 'Test (${{ matrix.os }}, Node ${{ matrix.node }})' runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: - 'ubuntu-latest' node: - '16' steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} cache: 'npm' - name: Install run: npm ci --prefer-offline - name: Initialize Global Git config run: | git config --global core.autocrlf false git config --global user.name "Create React App" git config --global user.email "cra@email.com" - name: Run tests run: ${{ inputs.testScript }}
What changed
- Add a job timeout so a hung step cannot burn hours of runner time.
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:
- Dependency installs
- End-to-end and browser tests
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.