-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
68 lines (62 loc) · 1.35 KB
/
.gitlab-ci.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
stages:
- setup
- test
- security
- build
- deploy
variables:
NODE_VERSION: "18"
# Etapa de preparação para garantir que o ambiente esteja configurado corretamente
setup:
stage: setup
image: node:${NODE_VERSION}
script:
- npm install -g npm@latest
- |
if [ ! -f backend/package-lock.json ]; then
echo "package-lock.json não encontrado no backend. Executando npm install."
cd backend && npm install && cd ..
fi
- |
if [ ! -f frontend/package-lock.json ]; then
echo "package-lock.json não encontrado no frontend. Executando npm install."
cd frontend && npm install && cd ..
fi
test:
stage: test
image: node:${NODE_VERSION}
script:
- cd backend
- npm ci
- npm test
- cd ../frontend
- npm ci
- npm test
security:
stage: security
image: node:${NODE_VERSION}
script:
- npm install -g npm-audit-resolver
- cd backend
- npm audit --audit-level=moderate
- cd ../frontend
- npm audit --audit-level=moderate
build:
stage: build
image: node:${NODE_VERSION}
script:
- cd frontend
- npm ci
- npm run build
artifacts:
paths:
- frontend/dist
deploy:
stage: deploy
image: node:${NODE_VERSION}
script:
- npm install -g vercel
- cd frontend
- vercel --token $VERCEL_TOKEN --prod
only:
- main