-
-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (71 loc) · 1.96 KB
/
jest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# 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 }}"