E2E tests workflow (babel/babel)
The E2E tests workflow from babel/babel, explained and optimized by Latchkey.
- C
- CI health grade
- 69/100
- Health score
- 2
- Jobs per trigger
- 3
- Fixes in the optimized version
In short
- CI health: C (fair)
- The optimized version below points runs-on at Latchkey managed runners and adds caching and job timeouts.
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 }}.shThe 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: ubuntu-latest
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: ubuntu-latest
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. Each Linux x64 job moves to the Latchkey size matching its vCPU count,latchkey-smallfor a standard 2 vCPU runner; macOS, Windows and arm64 jobs stay as written. - 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. All of them run on a standard GitHub-hosted Linux x64 runner, which in a private repository bills $0.006 a minute against $0.0025 on latchkey-small, 58% lower; in a public repository like this one they are free. Estimate the monthly difference with your own run counts.
Actions used in this workflow
- actions/checkout
- actions/setup-node
- actions/upload-artifact
- actions/cache
- actions/download-artifact