Repository navigation
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
67 lines (58 loc) · 2.07 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
67 lines (58 loc) · 2.07 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
# .gitlab-ci.yml — SarvaVaidya EHR GitLab CI Pipeline
image: node:20-alpine
stages:
- lint
- test
- build
- security
- deploy
variables:
PNPM_HOME: "/root/.local/share/pnpm"
PATH: "$PNPM_HOME:$PATH"
before_script:
- corepack enable
- corepack prepare pnpm@10 --activate
- pnpm install --frozen-lockfile
# ── Stage 1: Static Analysis & Lint ──────────────────────────────────────────
typecheck:
stage: lint
script:
- pnpm --filter @vox/shared-types tsc --noEmit
- pnpm --filter @vox/server tsc --noEmit
- pnpm --filter @vox/web tsc --noEmit
# ── Stage 2: Automated Unit Testing ──────────────────────────────────────────
unit-tests:
stage: test
script:
- pnpm test
# ── Stage 3: Build ────────────────────────────────────────────────────────────
build-frontend:
stage: build
script:
- NODE_OPTIONS="--max-old-space-size=896" pnpm build
artifacts:
paths:
- apps/web/dist/
expire_in: 3 days
build-server:
stage: build
script:
- pnpm --filter @vox/server build
# ── Stage 4: DevSecOps Vulnerability Scan ─────────────────────────────────────
security-audit:
stage: security
script:
- pnpm audit --audit-level=high || true
allow_failure: true
# ── Stage 5: Deploy to AWS EC2 ────────────────────────────────────────────────
deploy-production:
stage: deploy
image: alpine:latest
before_script:
- apk add --no-cache openssh-client ansible
script:
- echo "Deploying to production EC2..."
- ansible-playbook -i ansible/inventory/hosts.yml ansible/playbooks/deploy.yml
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: manual