-
Notifications
You must be signed in to change notification settings - Fork 15
/
.gitlab-ci.yml
135 lines (117 loc) · 2.91 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
image: migamake/haskell-build:8.6
stages:
- build
- test
- release
variables:
PACKAGE_NAME: homplexity
EXEC_NAME: homplexity-cli
DOCKER_TLS_CERTDIR: "/certs"
services:
- docker:19.03.1-dind
cache:
paths:
- .cabal-sandbox
- /root/.cabal
# 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
# 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
ghc_8_6:
variables:
GHC_VER: "8.6"
extends: .build_exe
artifacts:
paths:
- sdist/$PACKAGE_NAME-*[0-9].tar.gz
- hackage-docs/$PACKAGE_NAME-*-docs.tar.gz
- bin/homplexity-cli
expire_in: 2 weeks
allow_failure: false
ghc_8_4:
variables:
GHC_VER: "8.4"
extends: .build_exe
ghc_8_10:
variables:
GHC_VER: "8.10"
extends: .new_build_exe
retry: 2
allow_failure: true
ghc_8_8:
variables:
GHC_VER: "8.8"
extends: .new_build_exe
retry: 2
allow_failure: true
tar_package:
stage: test
script:
- cabal update
- mkdir -p bin
- cabal install sdist/$PACKAGE_NAME*[0-9].tar.gz --bindir=bin/
- tar xzf sdist/$PACKAGE_NAME*[0-9].tar.gz
- bin/homplexity-cli homplexity-*/lib
dependencies:
- ghc_8_6
artifacts:
paths:
- bin/homplexity-cli
allow_failure: false
docker_image:
image: docker
stage: build
script:
- mkdir -p workdir
- docker build . -t migamake/homplexity -f Dockerfile
- docker run migamake/homplexity -v $PWD/lib:/workdir
- docker save --output homplexity.docker migamake/homplexity:latest
- ls -alth homplexity.docker
artifacts:
paths:
- homplexity.docker
candidate_hackage:
variables:
PACKAGE_VER: "0.4.8.0"
stage: test
script:
- cabal upload --username="$HACKAGE_USER" --password="$HACKAGE_PASSWORD" sdist/$PACKAGE_NAME-*[0-9].tar.gz
- cabal upload --username="$HACKAGE_USER" --password="$HACKAGE_PASSWORD" -d hackage-docs/$PACKAGE_NAME-*-docs.tar.gz
dependencies:
- ghc_8_6
environment:
name: "hackage-candidate"
url: "https://hackage.haskell.org/package/homplexity-${PACKAGE_VER}/candidate"
only:
- master
allow_failure: true
hackage:
stage: release
script:
- cabal upload --publish --username="$HACKAGE_USER" --password="$HACKAGE_PASSWORD" sdist/$PACKAGE_NAME-*[0-9].tar.gz
- cabal upload --publish --username="$HACKAGE_USER" --password="$HACKAGE_PASSWORD" -d hackage-docs/$PACKAGE_NAME-*-docs.tar.gz
dependencies:
- ghc_8_6
when: manual
only:
- master
dockerhub:
image: docker
stage: release
script:
- docker load -i homplexity.docker
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin;
- docker push migamake/homplexity;
dependencies:
- docker_image
when: manual
only:
- master