-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.yml
110 lines (103 loc) · 3.03 KB
/
config.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
104
105
106
107
108
109
110
version: 2
defaults: &defaults
working_directory: "/carma"
docker:
- image: formalmethods/carma-stack-build:stack-1.6.3@sha256:13b265472181d1c519420aff8dbe2e8426da52e41094e4c9e70004caac4004ae
jobs:
build_client:
<<: *defaults
docker:
- image: node:8.9.1@sha256:552348163f074034ae75643c01e0ba301af936a898d778bb4fc16062917d0430
steps:
- checkout
- run:
name: Node.js and NPM version
command: |
printf 'node: %s, npm: %s\n' "`node --version`" "`npm --version`"
- run:
name: Build CaRMa frontend
command: |
cd srv
npm install
npm run prod-build
npm run build-backend-templates
- run:
name: Build CaRMa frontend ("pure" part)
command: |
cd srv/resources/assets/pure
npm install
npm run bower -- install --allow-root
npm run prod-clean-build
- persist_to_workspace:
root: .
paths:
- ./srv/resources
build_server:
<<: *defaults
steps:
- setup_remote_docker
- checkout
- restore_cache:
keys:
- stack-cache-{{ checksum "stack.yaml" }}
- run:
name: Haskell Stack version
command: |
stack --version
- run:
name: Build CaRMa backend
command: |
stack --install-ghc -j2 build
- save_cache:
key: stack-cache-{{ checksum "stack.yaml" }}
paths:
- ~/.cabal
- ~/.ghc
- ~/.stack
- .stack-work
- run:
name: Build CaRMa backend container
command: |
stack image container
docker save carma > carma-image.tar
- persist_to_workspace:
root: .
paths:
- ./carma-image.tar
build_bundle:
<<: *defaults
steps:
- setup_remote_docker
- checkout
- attach_workspace:
at: .
- run:
name: Build CaRMa frontend + backend container
command: |
docker load < carma-image.tar
cd srv
docker build \
--build-arg VCS_REF=$CIRCLE_SHA1 \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
-t formalmethods/carma-bundle:latest \
-t formalmethods/carma-bundle:${CIRCLE_BRANCH/\//-} \
-t formalmethods/carma-bundle:$CIRCLE_SHA1 \
.
- run:
name: Push to Docker Hub
command: |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
if [ $CIRCLE_BRANCH = "master" ]; then docker push formalmethods/carma-bundle:latest; fi
docker push formalmethods/carma-bundle:${CIRCLE_BRANCH/\//-}
docker push formalmethods/carma-bundle:$CIRCLE_SHA1
docker logout
workflows:
version: 2
build_all:
jobs:
- build_client
- build_server
- build_bundle:
requires:
- build_client
- build_server