# CI workflow (sveltejs/svelte)

> The CI workflow from sveltejs/svelte, explained and optimized by Latchkey.

Source: https://latchkey.dev/workflows/sveltejs-svelte-ci  
Upstream: [sveltejs/svelte](https://github.com/sveltejs/svelte/blob/main/.github/workflows/ci.yml) (.github/workflows/ci.yml), licence MIT

## What it does

This is the CI workflow from the sveltejs/svelte 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: CI
on:
  push:
    branches: [main]
  pull_request:
permissions:
  contents: read # to fetch code (actions/checkout)

env:
  # We only install Chromium manually
  PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'

jobs:
  Tests:
    permissions: {}
    runs-on: ${{ matrix.os }}
    timeout-minutes: 15
    strategy:
      matrix:
        include:
          # Vitest 4 requires Node 20+, so tests run on 20/22/24. The published
          # Svelte package still supports Node >=18 (see packages/svelte/package.json).
          - node-version: 20
            os: windows-latest
          - node-version: 20
            os: macOS-latest
          - node-version: 20
            os: ubuntu-latest
          - node-version: 22
            os: ubuntu-latest
          - node-version: 24
            os: ubuntu-latest

    steps:
      - uses: actions/checkout@v6
      - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4
      - uses: actions/setup-node@v6
        with:
          node-version: ${{ matrix.node-version }}
          cache: pnpm
      - run: pnpm install --frozen-lockfile
      - run: pnpm playwright install chromium
      - run: pnpm test
        env:
          CI: true
  TestNoAsync:
    permissions: {}
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v6
      - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4
      - uses: actions/setup-node@v6
        with:
          node-version: 22
          cache: pnpm
      - run: pnpm install --frozen-lockfile
      - run: pnpm playwright install chromium
      - run: pnpm test runtime-runes
        env:
          CI: true
          SVELTE_NO_ASYNC: true
  TSGo:
    permissions: {}
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - uses: actions/checkout@v6
      - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4
      - uses: actions/setup-node@v6
        with:
          node-version: 24
          cache: pnpm
      - name: install
        run: pnpm install --frozen-lockfile
      - name: install tsgo
        run: cd packages/svelte && pnpm i -D @typescript/native-preview
      - name: type check
        run: cd packages/svelte && pnpm check:tsgo
  Lint:
    permissions: {}
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v6
      - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4
      - uses: actions/setup-node@v6
        with:
          node-version: 24
          cache: pnpm
      - name: install
        run: pnpm install --frozen-lockfile
      - name: type check
        run: pnpm check
      - name: lint
        if: (${{ success() }} || ${{ failure() }}) # ensures this step runs even if previous steps fail (avoids multiple runs uncovering different issues at different steps)
        run: pnpm lint
      - name: build and check generated types
        if: (${{ success() }} || ${{ failure() }}) # ensures this step runs even if previous steps fail
        run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed - please regenerate types locally with `cd packages/svelte && pnpm generate:types` and commit the changes after you have reviewed them"; git diff; exit 1); }
      - name: check browser-support docs page is up to date
        run: '{ [ "`git status --porcelain=v1 documentation/docs/07-misc/.generated/`" == "" ] || (echo "The browser-support docs page is out of date - please regenerate it locally with \`cd packages/svelte && pnpm generate:browser-support\` and commit the changes"; git diff documentation/docs/07-misc/.generated/; exit 1); }'
  Benchmarks:
    permissions: {}
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v6
      - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4
      - uses: actions/setup-node@v6
        with:
          node-version: 24
          cache: pnpm
      - run: pnpm install --frozen-lockfile
      - run: pnpm bench
        env:
          CI: true
```

## FAQ

### What does the CI workflow (sveltejs/svelte) workflow do?

This is the CI workflow from the sveltejs/svelte 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 A. 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 run de-duplication. 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
