This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
84 lines (76 loc) · 1.84 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
stages:
- install
- test
- publish-docker-image
- dev-deploy
default:
image: node:18 #TODO - use node:18-alipne, but install openSLL, otherwise prisma job will fail
.standard-rules: # Make a hidden job to hold the common rules
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
cache:
key:
files:
- package-lock.json
paths:
- node_modules/
install-deps:
stage: install
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: always
script:
- npm install
run-tests-with-coverage:
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: always
needs:
- install-deps
script:
- npx prisma generate
- npm run test:cov
run-linter:
stage: test
needs:
- install-deps
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: always
script:
- npm run lint
allow_failure: true
build-docker-image:
image: docker:latest
stage: publish-docker-image
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
exists:
- docker-compose.yml
when: always
services:
- docker:dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- echo $ENV_FILE
# File is outside of build context, so make local copy.
- cp $ENV_FILE .env
- docker compose up --build -dV
- docker tag looties-api-dev:latest "$CI_REGISTRY_IMAGE:latest"
- docker push "$CI_REGISTRY_IMAGE:latest"
deploy-to-dev:
stage: dev-deploy
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: always
needs:
- build-docker-image
script:
- echo "Dummy deploy to dev"