mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
169 lines
4.8 KiB
YAML
169 lines
4.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
# Cancel in-progress runs when a new commit is pushed
|
|
concurrency:
|
|
# For pull requests, use the PR number as the concurrency group
|
|
# For other events (push), use the branch/ref
|
|
# This ensures PR builds are cancelled when new commits are pushed
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
# Define Node.js version in one place
|
|
env:
|
|
NODE_VERSION: "22.x"
|
|
PNPM_VERSION: 8
|
|
|
|
jobs:
|
|
typecheck:
|
|
name: Type Check
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
continue-on-error: true
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Setup PNPM
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: ${{ env.PNPM_VERSION }}
|
|
|
|
# Use PNPM store cache to improve performance
|
|
- name: PNPM store cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.pnpm-store
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
# Use node_modules cache to improve performance between runs
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
**/node_modules
|
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-modules-
|
|
|
|
# Install dependencies with fallback for lockfile mismatch
|
|
- name: Install dependencies
|
|
run: |
|
|
# Try frozen install first
|
|
pnpm install --frozen-lockfile || \
|
|
# If frozen install fails, update lockfile and try again
|
|
(echo "Frozen install failed, updating lockfile..." && pnpm install)
|
|
|
|
- name: Run type check
|
|
run: pnpm run typecheck
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
continue-on-error: true
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Setup PNPM
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: ${{ env.PNPM_VERSION }}
|
|
|
|
# Use PNPM store cache to improve performance
|
|
- name: PNPM store cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.pnpm-store
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
# Use node_modules cache to improve performance between runs
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
**/node_modules
|
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-modules-
|
|
|
|
# Install dependencies with fallback for lockfile mismatch
|
|
- name: Install dependencies
|
|
run: |
|
|
# Try frozen install first
|
|
pnpm install --frozen-lockfile || \
|
|
# If frozen install fails, update lockfile and try again
|
|
(echo "Frozen install failed, updating lockfile..." && pnpm install)
|
|
|
|
- name: Run ESLint
|
|
run: pnpm run lint
|
|
|
|
test:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
continue-on-error: true
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Setup PNPM
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: ${{ env.PNPM_VERSION }}
|
|
|
|
# Use PNPM store cache to improve performance
|
|
- name: PNPM store cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.pnpm-store
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
# Use node_modules cache to improve performance between runs
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
**/node_modules
|
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-modules-
|
|
|
|
# Install dependencies with fallback for lockfile mismatch
|
|
- name: Install dependencies
|
|
run: |
|
|
# Try frozen install first
|
|
pnpm install --frozen-lockfile || \
|
|
# If frozen install fails, update lockfile and try again
|
|
(echo "Frozen install failed, updating lockfile..." && pnpm install)
|
|
|
|
- name: Run tests
|
|
run: pnpm run test
|