-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
104 lines (96 loc) · 3.38 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
101
102
103
image: node:7.0.0-onbuild
stages:
- build_&_test_unit # done for all commits
- deploy_dev # only master & dev
- test_integration # only master & dev
- deploy_prod_&_release # deploy_prod => only master; release => only master & tags
job_build:
stage: build_&_test_unit
script:
- node --version
- npm --version
- npm install --unsafe-perm --production --quiet
- npm run build
- npm run build:story
artifacts:
expire_in: 1 day
paths:
- build
job_test_unit:
stage: build_&_test_unit
script:
- node --version
- npm --version
- npm install --unsafe-perm --quiet
- npm test
cache:
paths:
- node_modules
job_deploy_dev:
stage: deploy_dev
script:
- echo "deploying dev"
# Save previous deployment
- PREVIOUS_DEPLOY_DIR=$(ssh aicdeploy@$AIC_DEV_HOST "readlink -f ~/aic/services/artifacts/frontend")
# Send new build
- scp -r build/ aicdeploy@$AIC_DEV_HOST:aic/services/artifacts/frontend_${CI_BUILD_REF_NAME}_${CI_BUILD_REF}
# Link configuration
- ssh aicdeploy@$AIC_DEV_HOST "ln -s ~/aic/services/frontend-config.json ~/aic/services/artifacts/frontend_${CI_BUILD_REF_NAME}_${CI_BUILD_REF}/config.json"
# Recreate link to new build
- ssh aicdeploy@$AIC_DEV_HOST "rm -rf ~/aic/services/artifacts/frontend; ln -s ~/aic/services/artifacts/frontend_${CI_BUILD_REF_NAME}_${CI_BUILD_REF} ~/aic/services/artifacts/frontend"
# Remove previous deployment
- ssh aicdeploy@$AIC_DEV_HOST "rm -rf $PREVIOUS_DEPLOY_DIR"
only:
- dev
- master
job_test_integration:
stage: test_integration
services:
- selenium/standalone-chrome
script:
- node --version
- npm --version
- git clone [email protected]:aic-documentation/aic_features.git
- cd aic_features
- npm install --unsafe-perm --quiet
- echo "Saving screenshots at ${AIC_SCREENSHOT_PATH}"
- echo "Running tests at https://${AIC_DEV_HOST}:8443/"
- AIC_WB_HOST=selenium__standalone-chrome AIC_FRONTEND_HOST=https://${AIC_DEV_HOST}:8443/ ./run-tests.sh
- ls ${AIC_SCREENSHOT_PATH}
artifacts:
when: always
expire_in: 1 day
paths:
- aic_features/${AIC_SCREENSHOT_PATH}
only:
- dev
- master
# Rework this job once https://gitlab.com/gitlab-org/gitlab-ce/issues/19208 lands
job_release:
stage: deploy_prod_&_release
script:
- echo "release"
artifacts:
expire_in: 3 months
paths:
- build
only:
- master
- tags
job_deploy_prod:
stage: deploy_prod_&_release
script:
- echo "We removed the prod stack."
# - echo "deploying prod"
# # Save previous deployment
# - PREVIOUS_DEPLOY_DIR=$(ssh aicdeploy@$AIC_PROD_HOST "readlink -f ~/aic/services/artifacts/frontend")
# # Send new build
# - scp -r build/ aicdeploy@$AIC_PROD_HOST:aic/services/artifacts/frontend_${CI_BUILD_REF_NAME}_${CI_BUILD_REF}
# # Link configuration
# - ssh aicdeploy@$AIC_PROD_HOST "ln -s ~/aic/services/frontend-config.json ~/aic/services/artifacts/frontend_${CI_BUILD_REF_NAME}_${CI_BUILD_REF}/config.json"
# # Recreate link to new build
# - ssh aicdeploy@$AIC_PROD_HOST "rm -rf ~/aic/services/artifacts/frontend; ln -s ~/aic/services/artifacts/frontend_${CI_BUILD_REF_NAME}_${CI_BUILD_REF} ~/aic/services/artifacts/frontend"
# # Remove previous deployment
# - ssh aicdeploy@$AIC_PROD_HOST "rm -rf $PREVIOUS_DEPLOY_DIR"
only:
- master