This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
148 lines (132 loc) · 3.17 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
image: "plutus4binarapps/dex-plutus-dev:v1.6"
.automatic:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
.manual:
rules:
- if: "$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH"
when: manual
allow_failure: false
- when: on_success
.cabal-cache:
cache: &cabal_cache
key: cache-dot-dex-cabal
paths:
- /builds/plutus/dex/prebuild-cache/
policy: pull-push
.copy-cabal-cache:
extends: .cabal-cache
cache:
policy: pull
variables:
GIT_CLEAN_FLAGS: -ffdx -e prebuild-cache/
before_script:
- |
if [[ -d /builds/plutus/dex/prebuild-cache/.cabal ]]; then
cp -rf /builds/plutus/dex/prebuild-cache/.cabal /home/dex
else
echo ".cabal not found"
- |
if [[ -d /builds/plutus/dex/prebuild-cache/dist-newstyle ]]; then
cp -rf /builds/plutus/dex/prebuild-cache/dist-newstyle /builds/plutus/dex/
else
echo "dist-newstyle not found"
.base-cache: &base_cache
variables:
GIT_CLEAN_FLAGS: -ffdx -e prebuild-cache/ -e dist-newstyle/
before_script:
- cp -rf /builds/plutus/dex/prebuild-cache/.cabal /home/dex
- cp -rf /builds/plutus/dex/prebuild-cache/dist-newstyle /builds/plutus/dex/
.dex-cache:
<<: *base_cache
cache:
- <<: *cabal_cache
- key: dex-cache-$CI_COMMIT_REF_SLUG
paths:
- /builds/plutus/dex/dist-newstyle
policy: pull-push
.middleware-cache:
<<: *base_cache
cache:
- <<: *cabal_cache
- key: middleware-cache-$CI_COMMIT_REF_SLUG
paths:
- /builds/plutus/dex/dist-newstyle
policy: pull-push
.faucet-cache:
<<: *base_cache
cache:
- <<: *cabal_cache
- key: faucet-cache-$CI_COMMIT_REF_SLUG
paths:
- /builds/plutus/dex/dist-newstyle
policy: pull-push
stages:
- lint
- prebuild
- build
- test
prebuild:
stage: prebuild
extends:
- .automatic
- .cabal-cache
script:
- |
if [[ ! -d /builds/plutus/dex/prebuild-cache/.cabal ]]; then
cabal update
cabal configure --index-state=2021-07-07T00:00:00Z
# The GitLab CI can only archive files from directories relative to your build directory.
mkdir -p /builds/plutus/dex/dist-newstyle
cp -Rf /home/dex/.cabal /builds/plutus/dex/prebuild-cache/
cp -Rf /builds/plutus/dex/dist-newstyle /builds/plutus/dex/prebuild-cache/
else
echo "Using cache.. ."
fi
# dex
lint_dex:
stage: lint
extends: .automatic
script: "hlint dex"
build_dex:
stage: build
extends:
- .automatic
- .dex-cache
needs:
- prebuild
- lint_dex
script:
- cabal build dex
# middleware
lint_middleware:
stage: lint
extends: .automatic
script: "hlint middleware"
build_middleware:
stage: build
extends:
- .automatic
- .middleware-cache
needs:
- prebuild
- lint_middleware
script:
- ls -la /builds/plutus/dex/prebuild-cache/
- cabal build middleware
# faucet
lint_faucet:
stage: lint
extends: .automatic
script: "hlint faucet/faucet-backend/src"
build_faucet:
stage: build
extends:
- .automatic
- .faucet-cache
needs:
- prebuild
- lint_faucet
script:
- cabal build faucet-backend