Skip to content

ci: enable Turborepo caching for test #59

ci: enable Turborepo caching for test

ci: enable Turborepo caching for test #59

Workflow file for this run

# GitHub Actions workflow for running Jest backend tests.
# Features:
# - Automated testing on push/PR
# - Environment setup
# - Test execution
# - Results reporting
# - Deployment trigger
#
# By Dulapah Vibulsanti (https://dulapahv.dev)
name: 🧪 Jest Tests
permissions:
contents: read
actions: write
checks: write
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
name: 🧪 Run Server Tests
runs-on: ubuntu-latest
env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
# Checkout code
- name: 📥 Checkout code
uses: actions/checkout@v4
# Install pnpm
- name: 📦 Install pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
# Setup Node.js
- name: 🔧 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
# Turbo cache
- name: 💾 Cache Turbo
id: turbo-cache
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
# Install dependencies
- name: 🏗️ Install dependencies
run: pnpm install
# Build packages
- name: 🔨 Build packages
run: pnpm build:server
# Run Jest tests
- name: 🧪 Run Jest tests
run: pnpm test:server
# Upload test results
- name: 📊 Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: jest-report
path: apps/server/test-results/junit.xml
retention-days: 30
# Trigger Render deployment if tests pass
- name: 🚀 Trigger Render Deployment
if: success() && github.ref == 'refs/heads/main'
run: |
curl -X POST "${{ secrets.RENDER_DEPLOY_HOOK }}"