E2E tests workflow (babel/babel)
The E2E tests workflow from babel/babel, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the E2E tests workflow from the babel/babel 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
name: E2E tests
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e-publish:
name: Publish to local Verdaccio registry
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Use Node.js latest
uses: actions/setup-node@v6
with:
node-version: latest
cache: "yarn"
- name: Publish
run: ./scripts/integration-tests/publish-local.sh
- name: Pack published packages
working-directory: /tmp
run: tar -cvf verdaccio-workspace.tar verdaccio-workspace
- uses: actions/upload-artifact@v7
with:
name: verdaccio-workspace
path: /tmp/verdaccio-workspace.tar
retention-days: 1
e2e-tests:
name: Test
needs: e2e-publish
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project:
- babel
- create-react-app
# - vue-cli
# - react-native
- angular-cli
# - nextjs-10
- prettier
# - jest
# - ember # TODO: https://github.com/ember-cli/babel-remove-types/pull/9
steps:
- name: Get yarn1 cache directory path
id: yarn1-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v6
# Pin node to 22 for create-react-app project.
# The create-react-app e2e breaking test throws
# http fetch GET https://localhost:4873/zwitch/-/zwitch-1.0.5.tgz attempt 3 failed with ERR_SSL_WRONG_VERSION_NUMBER
# when installing on Node.js 24. It might be an npm issue.
- name: Use Node.js ${{ matrix.project == 'create-react-app' && '22' || 'latest' }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.project == 'create-react-app' && '22' || 'latest' }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Use yarn1 cache
uses: actions/cache@v5
id: yarn1-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn1-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn1-e2e-${{ matrix.project }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn1-e2e-${{ matrix.project }}-
- name: Use yarn cache
uses: actions/cache@v5
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-e2e-${{ matrix.project }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-e2e-${{ matrix.project }}-
- name: Clean babel cache
run: |
rm -rf ${{ steps.yarn1-cache-dir-path.outputs.dir }}/*babel*
rm -rf ${{ steps.yarn-cache-dir-path.outputs.dir }}/*babel*
- uses: actions/download-artifact@v8
with:
name: verdaccio-workspace
path: /tmp
- name: Unpack published packages
run: tar -C /tmp -xf /tmp/verdaccio-workspace.tar
- name: Test
run: ./scripts/integration-tests/e2e-${{ matrix.project }}.sh
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: E2E tests on: push: branches: - main pull_request: permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: e2e-publish: timeout-minutes: 30 name: Publish to local Verdaccio registry runs-on: latchkey-small steps: - name: Checkout code uses: actions/checkout@v6 with: fetch-depth: 0 - name: Use Node.js latest uses: actions/setup-node@v6 with: node-version: latest cache: "yarn" - name: Publish run: ./scripts/integration-tests/publish-local.sh - name: Pack published packages working-directory: /tmp run: tar -cvf verdaccio-workspace.tar verdaccio-workspace - uses: actions/upload-artifact@v7 with: name: verdaccio-workspace path: /tmp/verdaccio-workspace.tar retention-days: 1 e2e-tests: timeout-minutes: 30 name: Test needs: e2e-publish runs-on: latchkey-small strategy: fail-fast: false matrix: project: - babel - create-react-app # - vue-cli # - react-native - angular-cli # - nextjs-10 - prettier # - jest # - ember # TODO: https://github.com/ember-cli/babel-remove-types/pull/9 steps: - name: Get yarn1 cache directory path id: yarn1-cache-dir-path run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Checkout code uses: actions/checkout@v6 # Pin node to 22 for create-react-app project. # The create-react-app e2e breaking test throws # http fetch GET https://localhost:4873/zwitch/-/zwitch-1.0.5.tgz attempt 3 failed with ERR_SSL_WRONG_VERSION_NUMBER # when installing on Node.js 24. It might be an npm issue. - name: Use Node.js ${{ matrix.project == 'create-react-app' && '22' || 'latest' }} uses: actions/setup-node@v6 with: cache: 'npm' node-version: ${{ matrix.project == 'create-react-app' && '22' || 'latest' }} - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - name: Use yarn1 cache uses: actions/cache@v5 id: yarn1-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn1-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn1-e2e-${{ matrix.project }}-${{ hashFiles('**/yarn.lock') }} restore-keys: ${{ runner.os }}-yarn1-e2e-${{ matrix.project }}- - name: Use yarn cache uses: actions/cache@v5 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn-e2e-${{ matrix.project }}-${{ hashFiles('**/yarn.lock') }} restore-keys: ${{ runner.os }}-yarn-e2e-${{ matrix.project }}- - name: Clean babel cache run: | rm -rf ${{ steps.yarn1-cache-dir-path.outputs.dir }}/*babel* rm -rf ${{ steps.yarn-cache-dir-path.outputs.dir }}/*babel* - uses: actions/download-artifact@v8 with: name: verdaccio-workspace path: /tmp - name: Unpack published packages run: tar -C /tmp -xf /tmp/verdaccio-workspace.tar - name: Test run: ./scripts/integration-tests/e2e-${{ matrix.project }}.sh
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cache dependency installs on the setup step so they are served from cache.
- 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:
- End-to-end and browser tests
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.