# E2E tests workflow (babel/babel)

> The E2E tests workflow from babel/babel, explained and optimized by Latchkey.

Source: https://latchkey.dev/workflows/babel-babel-e2e-tests  
Upstream: [babel/babel](https://github.com/babel/babel/blob/main/.github/workflows/e2e-tests.yml) (.github/workflows/e2e-tests.yml), licence MIT

## 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

```yaml
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
```

## FAQ

### What does the E2E tests workflow (babel/babel) workflow do?

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.

### What CI health grade does this workflow get?

This Node.js workflow grades C. Paste your own workflow into the Latchkey grader to see its grade and the exact fixes.

### How can I improve this Node.js workflow?

Add caching and job timeouts. Latchkey applies these automatically on managed runners when you point runs-on at Latchkey.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
