fix: migrate CI and release workflows fully to bun #150
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | ||
|
Check failure on line 1 in .github/workflows/ci.yml
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
| concurrency: | ||
| group: ci-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| changes: | ||
| name: Detect Changed Areas | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| core: ${{ steps.filter.outputs.core }} | ||
| ai_sdk: ${{ steps.filter.outputs.ai_sdk }} | ||
| mastra: ${{ steps.filter.outputs.mastra }} | ||
| langchain: ${{ steps.filter.outputs.langchain }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Detect changed paths | ||
| id: filter | ||
| uses: dorny/paths-filter@v3 | ||
| with: | ||
| filters: | | ||
| core: | ||
| - ".github/workflows/**" | ||
| - "src/**" | ||
| - "templates/_shared/**" | ||
| - "package.json" | ||
| - "bun.lock" | ||
| - "tsconfig.json" | ||
| - "eslint.config.mjs" | ||
| - ".prettierrc" | ||
| - ".prettierignore" | ||
| ai_sdk: | ||
| - "templates/ai-sdk/**" | ||
| mastra: | ||
| - "templates/mastra/**" | ||
| langchain: | ||
| - "templates/langchain/**" | ||
| lint-and-build: | ||
| name: Lint, Format & Build | ||
| runs-on: ubuntu-latest | ||
| needs: changes | ||
| if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.ai_sdk == 'true' || needs.changes.outputs.mastra == 'true' || needs.changes.outputs.langchain == 'true' }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - run: bun install | ||
| - run: bun run lint | ||
| - run: bun run format:check | ||
| - run: bun run typecheck | ||
| - run: bun run build | ||
| - name: Upload built CLI artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cli-dist | ||
| path: dist/ | ||
| if-no-files-found: error | ||
| lint-python: | ||
| name: Lint Python Templates | ||
| runs-on: ubuntu-latest | ||
| needs: changes | ||
| if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.langchain == 'true' }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: astral-sh/ruff-action@v3 | ||
| with: | ||
| args: check templates/langchain/ | ||
| - uses: astral-sh/ruff-action@v3 | ||
| with: | ||
| args: format --check templates/langchain/ | ||
| smoke-test-templates: | ||
| name: Smoke Test — ${{ matrix.template }} | ||
| runs-on: ubuntu-latest | ||
| needs: [changes, lint-and-build] | ||
| if: ${{ needs.changes.outputs.core == 'true' || (matrix.template == 'ai-sdk' && needs.changes.outputs.ai_sdk == 'true') || (matrix.template == 'mastra' && needs.changes.outputs.mastra == 'true') || (matrix.template == 'langchain' && needs.changes.outputs.langchain == 'true') }} | ||
| env: | ||
| PIP_DISABLE_PIP_VERSION_CHECK: "1" | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| template: [ai-sdk, mastra, langchain] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - name: Cache bun packages | ||
| if: matrix.template != 'langchain' | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.bun/install/cache | ||
| key: bun-smoke-${{ matrix.template }}-${{ hashFiles(format('templates/{0}/package.json', matrix.template)) }} | ||
| restore-keys: | | ||
| bun-smoke-${{ matrix.template }}- | ||
| bun-smoke- | ||
| - uses: actions/setup-python@v5 | ||
| if: matrix.template == 'langchain' | ||
| with: | ||
| python-version: "3.12" | ||
| cache: pip | ||
| cache-dependency-path: templates/langchain/requirements.txt | ||
| - run: bun install | ||
| - name: Download built CLI artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: cli-dist | ||
| path: dist | ||
| - name: Scaffold template | ||
| run: bun dist/index.js ci-test-${{ matrix.template }} --template ${{ matrix.template }} | ||
| - name: Create .env from example | ||
| working-directory: ci-test-${{ matrix.template }} | ||
| run: cp .env.example .env | ||
| - name: Doctor (Next.js + TypeScript templates) | ||
| if: matrix.template != 'langchain' | ||
| working-directory: ci-test-${{ matrix.template }} | ||
| run: bun run doctor | ||
| - name: Doctor (Python template) | ||
| if: matrix.template == 'langchain' | ||
| working-directory: ci-test-${{ matrix.template }} | ||
| run: python -m app.doctor | ||
| - name: Type check (Next.js + TypeScript templates) | ||
| if: matrix.template != 'langchain' | ||
| working-directory: ci-test-${{ matrix.template }} | ||
| run: bun run typecheck | ||
| - name: Build (Next.js + TypeScript templates) | ||
| if: matrix.template != 'langchain' | ||
| working-directory: ci-test-${{ matrix.template }} | ||
| run: bun run build | ||
| - name: Lint (Next.js + TypeScript templates) | ||
| if: matrix.template != 'langchain' | ||
| working-directory: ci-test-${{ matrix.template }} | ||
| run: bun run lint | ||
| - name: Lint (Python template) | ||
| if: matrix.template == 'langchain' | ||
| working-directory: ci-test-${{ matrix.template }} | ||
| run: | | ||
| pip install ruff ty | ||
| ruff check . | ||
| ruff format --check . | ||
| ty check . | ||