Skip to content

feat(hatchet): complete Effect-first Hatchet integration slices #199

feat(hatchet): complete Effect-first Hatchet integration slices

feat(hatchet): complete Effect-first Hatchet integration slices #199

Workflow file for this run

name: 🧪 CI
on:
pull_request:
branches: [master, dev]
push:
branches: [dev]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
cancel-in-progress: true
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/effectify"
NODE_OPTIONS: "--max-old-space-size=4096"
jobs:
# Lint and format check
lint:
name: 🔍 Lint & Format
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.14.0
- name: 🏗️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile
- name: 🔍 Run oxlint on affected projects
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE="origin/${{ github.base_ref }}"
else
BASE="HEAD~1"
fi
pnpm nx affected --target=lint --base=$BASE --head=HEAD --parallel=1
- name: 🎨 Check code formatting with dprint
run: pnpm exec dprint check || (echo "❌ Some files are not formatted. Run 'pnpm exec dprint fmt' to fix formatting." && exit 1)
# Type checking
typecheck:
name: 🔍 Type Check
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.14.0
- name: 🏗️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile
- name: 🔍 Type check affected projects
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE="origin/${{ github.base_ref }}"
else
BASE="HEAD~1"
fi
pnpm nx affected --target=typecheck --base=$BASE --head=HEAD --parallel=1 --verbose
# Build affected projects
build:
name: 🏗️ Build
runs-on: ubuntu-latest
outputs:
has-build-artifacts: ${{ steps.build.outputs.has-artifacts }}
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.14.0
- name: 🏗️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile
- name: 🏗️ Build affected projects
id: build
run: |
BASE=$(git merge-base HEAD origin/dev)
# Build affected projects with caching
pnpm nx affected --target=build --base=$BASE --head=HEAD --parallel=1 --verbose
# Check if any projects were built
AFFECTED_PROJECTS=$(pnpm nx show projects --affected --base=$BASE --head=HEAD --json | jq -r '.[]' | tr '\n' ' ')
if [ -n "$AFFECTED_PROJECTS" ]; then
echo "has-artifacts=true" >> $GITHUB_OUTPUT
echo "📦 Built projects: $AFFECTED_PROJECTS"
# Create build manifest for artifact upload
echo "BUILT_PROJECTS=$AFFECTED_PROJECTS" >> $GITHUB_ENV
else
echo "has-artifacts=false" >> $GITHUB_OUTPUT
echo "ℹ️ No projects to build"
fi
- name: 📦 Upload build artifacts
if: steps.build.outputs.has-artifacts == 'true'
uses: actions/upload-artifact@v4
with:
name: build-artifacts-${{ github.sha }}
path: |
packages/**/dist/
apps/*/dist/
apps/*/build/
retention-days: 7
- run: pnpm nx fix-ci
if: always() # IMPORTANT: Always run
# Test affected projects
test:
name: 🧪 Test
runs-on: ubuntu-latest
needs: [build]
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.14.0
- name: 🏗️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile
- name: 📦 Download build artifacts
if: needs.build.outputs.has-build-artifacts == 'true'
uses: actions/download-artifact@v4
with:
name: build-artifacts-${{ github.sha }}
- name: 🧪 Test affected projects
run: |
BASE=$(git merge-base HEAD origin/dev)
pnpm nx affected --target=test --base=$BASE --head=HEAD --parallel=1 --verbose --passWithNoTests
# Summary job
ci-summary:
name: 📊 CI Summary
runs-on: ubuntu-latest
needs: [lint, typecheck, build, test]
if: always()
steps:
- name: 📊 CI Summary
run: |
echo "## 🧪 CI Results Summary" >> $GITHUB_STEP_SUMMARY
echo "| Job | Status | Details |" >> $GITHUB_STEP_SUMMARY
echo "|-----|--------|---------|" >> $GITHUB_STEP_SUMMARY
echo "| 🔍 Lint & Format | ${{ needs.lint.result == 'success' && '✅ Success' || '❌ Failed' }} | Uses oxlint + dprint |" >> $GITHUB_STEP_SUMMARY
echo "| 🔍 Type Check | ${{ needs.typecheck.result == 'success' && '✅ Success' || '❌ Failed' }} | TypeScript compiler checks |" >> $GITHUB_STEP_SUMMARY
echo "| 🏗️ Build | ${{ needs.build.result == 'success' && '✅ Success' || '❌ Failed' }} | Nx affected build |" >> $GITHUB_STEP_SUMMARY
echo "| 🧪 Test | ${{ needs.test.result == 'success' && '✅ Success' || '❌ Failed' }} | Unit tests with Vitest |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📈 Performance Metrics" >> $GITHUB_STEP_SUMMARY
echo "- 🔄 Parallel execution: 1x for lint/typecheck/build/test" >> $GITHUB_STEP_SUMMARY
echo "- 📦 Caching: Nx computation caching enabled" >> $GITHUB_STEP_SUMMARY
echo "- 🎯 Affected projects only: Runs only on changed code" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.lint.result }}" != "success" ]]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "### ❌ Linting Issues" >> $GITHUB_STEP_SUMMARY
echo "Please run 'pnpm exec dprint fmt' to fix formatting issues" >> $GITHUB_STEP_SUMMARY
fi
# NEW: Add this step at the end of your job