-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
100 lines (90 loc) · 2.33 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
image: node:lts
stages:
- test
- build
- deploy
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .npm/
test-backend:
stage: test
script:
- cd backend
- npm ci --cache .npm --prefer-offline
- npm run test
lint-backend:
stage: test
script:
- cd backend
- npm ci --cache .npm --prefer-offline
- npm run lint
build-backend:
stage: build
script:
- cd backend
- npm ci --cache .npm --prefer-offline --omit=dev
- npm run package
- cp healthcheck.js ./package
artifacts:
name: "Backend Build"
paths:
- backend/package
#test-frontend:
# stage: test
# image: cypress/base:18.12.0
# variables:
# ELECTRON_EXTRA_LAUNCH_ARGS: "--headless --disable-gpu --disable-software-rasterizer --no-sandbox"
# script:
# - cd frontend
# - npm ci --cache .npm --prefer-offline
# - npm run config:defaults:mempool.cash
# - npm run cypress:run
lint-frontend:
stage: test
script:
- cd frontend
- npm ci --cache .npm --prefer-offline
- npm run config:defaults:mempool.cash
- npm run lint
test-build-frontend:
stage: build
image: danger89/node:lts-rsync
rules:
- if: '$CI_PROJECT_NAMESPACE == "bitcoincash" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
script:
- cd frontend
- npm ci --cache .npm --prefer-offline --omit=dev
- npm run config:defaults:mempool.cash
- npm run build
deploy-docker-backend:
stage: deploy
rules:
- if: '$CI_PROJECT_NAMESPACE == "bitcoincash" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
tags:
- shell
before_script:
- echo "${DOCKER_PASSWORD}" | docker login -u danger89 --password-stdin
script:
- docker build -t danger89/bch-explorer-backend -f backend/DockerfileBCH --build-arg commitHash="$CI_COMMIT_SHORT_SHA" ./backend/
- docker push danger89/bch-explorer-backend
after_script:
- docker logout
build-and-deploy-frontend:
stage: build
image: danger89/node:lts-rsync
rules:
- if: '$CI_PROJECT_NAMESPACE == "bitcoincash" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
script:
- cd frontend
- npm ci --cache .npm --prefer-offline --omit=dev
- npm run config:defaults:mempool.cash
- npm run build
environment:
name: production
url: https://explorer.melroy.org
artifacts:
name: "Frontend Build"
expire_in: 3 months
paths:
- frontend/dist/mempool/browser