forked from flyfish30/json-autotype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
155 lines (135 loc) · 2.87 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
149
150
151
152
153
154
image: migamake/haskell-build:8.6
stages:
- build
- test
- release
variables:
PACKAGE_NAME: json-autotype
EXEC_NAME: json-autotype
DOCKER_TLS_CERTDIR: "/certs"
PACKAGE_VER: "3.0.3"
services:
- docker:19.03.1-dind
cache:
paths:
- .stack-work
- .cabal-sandbox
- /root/.cabal
- /root/.stack
stack_build:
image: migamake/stack-build-image:12.26
stage: build
script:
- ci/stack-build.sh
allow_failure: true
retry: 2
# Build for images up to 8.6, with `cabal-install` 2.x
.build_exe:
image: migamake/haskell-build:$GHC_VER
stage: build
script:
- ci/old-cabal-build.sh
retry: 2
artifacts:
paths:
- sdist/*[0-9].tar.gz
- hackage-docs/*-docs.tar.gz
- bin/${EXEC_NAME}
expire_in: 2 weeks
# Build for images 8.8 and above with `cabal-install` v3.x
.new_build_exe:
image: migamake/haskell-build:$GHC_VER
stage: build
script:
- ci/new-cabal-build.sh
retry: 2
artifacts:
paths:
- sdist/*[0-9].tar.gz
- hackage-docs/*-docs.tar.gz
- bin/${EXEC_NAME}
expire_in: 2 weeks
ghc_8_6:
variables:
GHC_VER: "8.6"
extends: .build_exe
allow_failure: true
artifacts:
paths:
- sdist/*[0-9].tar.gz
- hackage-docs/*-docs.tar.gz
- bin/${EXEC_NAME}
expire_in: 2 weeks
ghc_8_4:
variables:
GHC_VER: "8.4"
extends: .build_exe
allow_failure: true
ghc_8_10:
variables:
GHC_VER: "8.10"
extends: .new_build_exe
retry: 1
allow_failure: true
ghc_8_8:
variables:
GHC_VER: "8.8"
extends: .new_build_exe
retry: 2
allow_failure: false
tar_package:
stage: test
script:
- ci/package-test.sh
dependencies:
- ghc_8_8
artifacts:
paths:
- bin/${EXEC_NAME}
allow_failure: false
docker_image:
image: docker
stage: build
script:
- mkdir -p workdir
- docker build . -t migamake/${PACKAGE_NAME} -f Dockerfile
- docker run -v $PWD/json-autotype/test:/workdir migamake/${PACKAGE_NAME} /workdir/colors.json
- docker save --output ${PACKAGE_NAME}.docker migamake/${PACKAGE_NAME}:latest
- ls -alth ${PACKAGE_NAME}.docker
artifacts:
paths:
- ${PACKAGE_NAME}.docker
allow_failure: true
candidate_hackage:
stage: test
script:
- ci/release.sh
dependencies:
- ghc_8_8
environment:
name: "hackage-candidate-${PACKAGE_VER}"
url: "https://hackage.haskell.org/package/homplexity-${PACKAGE_VER}/candidate"
only:
- master
allow_failure: true
hackage:
stage: release
script:
- ci/release.sh --publish
dependencies:
- ghc_8_8
when: manual
only:
- master
dockerhub:
image: docker
stage: release
script:
- docker load -i ${PACKAGE_NAME}.docker
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin;
- docker push migamake/${PACKAGE_NAME};
dependencies:
- docker_image
when: manual
only:
- master