Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 75 additions & 83 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,108 +12,100 @@ concurrency:
cancel-in-progress: true

jobs:
lint:
name: ⬣ ESLint
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache-node-modules.outputs.cache-hit }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: 📦 Install pnpm
uses: pnpm/action-setup@v4

- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
- uses: actions/checkout@v4
with:
node-version: 20
cache: 'pnpm'

- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile

- name: 🔬 Lint
run: pnpm turbo run lint --affected

typecheck:
name: ʦ TypeScript
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
fetch-depth: 2

- name: 📦 Install pnpm
uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v4

- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile

- name: 🔎 Type check
run: pnpm turbo run type-check --affected

test:
name: 🧪 Test
- id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
packages/*/node_modules
docs/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-modules-

- id: cache-turbo
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-

# Always run install to ensure all dependencies are available
# This ensures workspace packages like docs have their dependencies
- run: pnpm install --frozen-lockfile

validate:
name: Validate
needs: setup
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: 📦 Install pnpm
uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v4

- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile

- name: 🧪 Run tests
run: pnpm turbo run test --affected
- uses: actions/cache@v4
with:
path: |
node_modules
packages/*/node_modules
docs/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-modules-

- uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-

- run: pnpm turbo run lint --affected
- run: pnpm turbo run type-check --affected
- run: pnpm turbo run build --affected
- run: pnpm turbo run test --affected

- uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: packages/*/dist

build:
name: 🏗 Build
cache-build:
name: Cache Artifacts
needs: validate
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: 📦 Install pnpm
uses: pnpm/action-setup@v4

- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
- uses: actions/download-artifact@v4
with:
node-version: 20
cache: 'pnpm'

- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile

- name: 🏗 Build packages
run: pnpm turbo run build --affected

- name: 📄 Generate docs (validate examples)
run: pnpm turbo run docgen --affected || echo "No docgen script found, skipping"
name: build-artifacts
path: packages

# All jobs must pass
ci:
name: ✅ CI
runs-on: ubuntu-latest
if: always()
needs: [lint, typecheck, test, build]
steps:
- name: ✅ All jobs passed
if: ${{ !(contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
run: exit 0

- name: ❌ Some jobs failed
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1
- uses: actions/cache@v4
with:
path: packages/*/dist
key: build-artifacts-${{ github.sha }}
74 changes: 41 additions & 33 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,53 +22,62 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: ⬇️ Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: pnpm/action-setup@v4

- name: ⎔ Install Node.js
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: 📦 Install pnpm
uses: pnpm/action-setup@v4
- id: cached-build-artifacts
uses: actions/cache@v4
with:
run_install: false
path: packages/*/dist
key: build-artifacts-${{ github.sha }}

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
packages/*/node_modules
docs/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-modules-

- name: Setup pnpm cache
- id: cache-turbo
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-pnpm-store-
${{ runner.os }}-turbo-

- name: 📦 Install dependencies
run: pnpm install
# Always run install to ensure all dependencies are available
# This ensures workspace packages like docs have their dependencies
- run: pnpm install --frozen-lockfile

- name: 🏗 Build packages (required for docs)
run: pnpm turbo run build
- run: pnpm turbo run build
if: steps.cached-build-artifacts.outputs.cache-hit != 'true'

- name: 📄 Generate Evolution SDK docs
run: pnpm turbo run docgen
working-directory: packages/evolution
- run: pnpm turbo run docgen --filter=evolution

- name: 📚 Copy Evolution docs to website
run: node scripts/copy-evolution-docs.mjs
working-directory: docs
- run: pnpm turbo run build --filter=docs

- name: 🏗 Build documentation
run: |
cd docs
pnpm build
- id: cache-docs-output
uses: actions/cache@v4
with:
path: docs/out
key: docs-output-${{ github.sha }}
restore-keys: |
docs-output-

- name: 📤 Upload artifact
uses: actions/upload-pages-artifact@v3
- uses: actions/upload-pages-artifact@v3
with:
path: docs/out

Expand All @@ -80,6 +89,5 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- name: 🚀 Deploy to GitHub Pages
id: deployment
- id: deployment
uses: actions/deploy-pages@v4
64 changes: 39 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,70 @@ on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write
pull-requests: write
id-token: write

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: 🚀 Release
name: Release
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: 📦 Install pnpm
uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v4

- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org/'

- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile
- id: cached-build-artifacts
uses: actions/cache@v4
with:
path: packages/*/dist
key: build-artifacts-${{ github.sha }}

- name: 🏗 Build packages
run: pnpm turbo run build
- id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
packages/*/node_modules
docs/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-modules-

- uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-

- name: 🧪 Run tests
run: pnpm turbo run test
# Always run install to ensure all dependencies are available
# This ensures workspace packages like docs have their dependencies
- run: pnpm install --frozen-lockfile

- name: 📄 Generate docs
run: pnpm turbo run docgen || echo "No docgen script found, skipping"
- run: pnpm turbo run build
if: steps.cached-build-artifacts.outputs.cache-hit != 'true'

- name: 🦋 Create Release Pull Request or Publish to npm
id: changesets
- id: changesets
uses: changesets/action@v1
with:
# This uses our custom publish script that builds before publishing
publish: pnpm changeset-publish
title: "ci(changesets): version packages"
commit: "ci(changesets): version packages"
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: 📢 Send a Slack notification if a publish happened
if: steps.changesets.outputs.published == 'true'
# You can do something when a publish happens.
run: echo "A new version of Evolution SDK was published!"
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ dist
.DS_Store
.direnv
docs/out
docs/.next
docs/.next
# TypeScript incremental compilation cache
*.tsbuildinfo
.tsbuildinfo/
Loading