-
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (104 loc) · 3.62 KB
/
Copy pathci.yml
File metadata and controls
124 lines (104 loc) · 3.62 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# ═══════════════════════════════════════════════════════════════════════
# Promptly — Build & Test CI Pipeline
#
# Runs on every push/PR to main:
# 1. Backend: Maven compile + unit tests
# 2. Frontend: Nx build + lint
# ═══════════════════════════════════════════════════════════════════════
name: Build & Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: '22'
JAVA_VERSION: '21'
JAVA_DISTRIBUTION: 'temurin'
jobs:
# ── Backend: compile + test ─────────────────────────────────────
backend:
name: Backend (Java ${{ matrix.java }})
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
java: ['21']
services:
mongodb:
image: mongodb/mongodb-atlas-local:8.0
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --eval 'db.runCommand(\"ping\").ok' --quiet"
--health-interval 15s
--health-timeout 10s
--health-retries 10
--health-start-period 30s
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
cache: maven
server-id: spectrayan-github-server-sent-events
server-username: MAVEN_USERNAME
server-password: MAVEN_TOKEN
- name: Build & Test
run: mvn verify -B -q --fail-at-end
env:
SPRING_MONGODB_URI: mongodb://localhost:27017/promptly-test
MAVEN_USERNAME: ${{ github.actor }}
MAVEN_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: backend-test-results
path: |
**/target/surefire-reports/
**/target/failsafe-reports/
retention-days: 7
# ── Frontend: build + lint ──────────────────────────────────────
frontend:
name: Frontend (Node ${{ matrix.node }})
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node: ['22']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Cache pnpm
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: pnpm-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Lint
run: npx nx lint promptly --skip-nx-cache
- name: Build
run: npx nx build promptly --configuration=production --skip-nx-cache