4
4
5
5
# Colors
6
6
RED=" 0;31"
7
- LT_BROWN=" 1;33"
8
- LT_BLUE=" 1;34"
9
7
10
8
ecabal () {
11
9
cabal " $@ "
12
10
}
13
11
14
- nonfatal () {
15
- " $@ " || " $* failed"
16
- }
17
-
18
- # sync the relevant parts of cabal artifacts that are part of
19
- # the current plan.json from an S3 bucket
20
- sync_from () {
21
- if [ " ${RUNNER_OS} " != " Windows" ] ; then
22
- cabal_store_path=" $( dirname " $( cabal help user-config | tail -n 1 | xargs) " ) /store"
23
- fi
24
-
25
- cabal-cache.sh sync-from-archive \
26
- --host-name-override=" ${S3_HOST} " \
27
- --host-port-override=443 \
28
- --host-ssl-override=True \
29
- --region us-west-2 \
30
- $( [ " ${RUNNER_OS} " != " Windows" ] && echo --store-path=" $cabal_store_path " ) \
31
- --archive-uri " s3://haskell-language-server/${ARTIFACT} "
32
- }
33
-
34
- # sync the relevant parts of cabal artifacts that are part of
35
- # the current plan.json to an S3 bucket
36
- sync_to () {
37
- if [ " ${RUNNER_OS} " != " Windows" ] ; then
38
- cabal_store_path=" $( dirname " $( cabal help user-config | tail -n 1 | xargs) " ) /store"
39
- fi
40
-
41
- cabal-cache.sh sync-to-archive \
42
- --host-name-override=" ${S3_HOST} " \
43
- --host-port-override=443 \
44
- --host-ssl-override=True \
45
- --region us-west-2 \
46
- $( [ " ${RUNNER_OS} " != " Windows" ] && echo --store-path=" $cabal_store_path " ) \
47
- --archive-uri " s3://haskell-language-server/${ARTIFACT} "
48
- }
49
-
50
- sha_sum () {
51
- if [ " ${RUNNER_OS} " = " FreeBSD" ] ; then
52
- sha256 " $@ "
53
- else
54
- sha256sum " $@ "
55
- fi
56
- }
57
-
58
- git_describe () {
59
- git config --global --get-all safe.directory | grep ' ^\*$' || git config --global --add safe.directory " *"
60
- git describe --always
61
- }
62
-
63
- download_cabal_cache () {
64
- (
65
- set -e
66
- dest=" $HOME /.local/bin/cabal-cache"
67
- url=" "
68
- exe=" "
69
- cd /tmp
70
- case " ${RUNNER_OS} " in
71
- " Linux" )
72
- case " ${ARCH} " in
73
- " 32" ) url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/i386-linux-cabal-cache
74
- ;;
75
- " 64" ) url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-linux-cabal-cache
76
- ;;
77
- " ARM64" ) url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/aarch64-linux-cabal-cache
78
- ;;
79
- " ARM" ) url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/armv7-linux-cabal-cache
80
- ;;
81
- esac
82
- ;;
83
- " FreeBSD" )
84
- url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-portbld-freebsd-cabal-cache
85
- ;;
86
- " Windows" )
87
- exe=" .exe"
88
- url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-mingw64-cabal-cache
89
- ;;
90
- " macOS" )
91
- case " ${ARCH} " in
92
- " ARM64" ) url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/aarch64-apple-darwin-cabal-cache
93
- ;;
94
- " 64" ) url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-apple-darwin-cabal-cache
95
- ;;
96
- esac
97
- ;;
98
- esac
99
-
100
- if [ -n " ${url} " ] ; then
101
- case " ${url##* .} " in
102
- " gz" )
103
- curl -L -o - " ${url} " | gunzip > cabal-cache${exe}
104
- ;;
105
- * )
106
- curl -o cabal-cache${exe} -L " ${url} "
107
- ;;
108
- esac
109
- sha_sum cabal-cache${exe}
110
- mv " cabal-cache${exe} " " ${dest}${exe} "
111
- chmod +x " ${dest}${exe} "
112
- fi
113
-
114
- # install shell wrapper
115
- cp " ${CI_PROJECT_DIR} " /.github/scripts/cabal-cache.sh " $HOME " /.local/bin/
116
- chmod +x " $HOME " /.local/bin/cabal-cache.sh
117
- )
118
- }
119
-
120
- build_with_cache () {
121
- ecabal configure " $@ "
122
- ecabal build --dependencies-only " $@ " --dry-run
123
- nonfatal sync_from
124
- ecabal build " $@ "
125
- nonfatal sync_to
126
- }
127
-
128
- install_ghcup () {
129
- # find "$GHCUP_INSTALL_BASE_PREFIX"
130
- mkdir -p " $GHCUP_BIN "
131
- mkdir -p " $GHCUP_BIN " /../cache
132
-
133
- if [ " ${RUNNER_OS} " = " FreeBSD" ] ; then
134
- curl -o ghcup https://downloads.haskell.org/ghcup/tmp/x86_64-portbld-freebsd-ghcup-0.1.18.1
135
- chmod +x ghcup
136
- mv ghcup " $HOME /.local/bin/ghcup"
12
+ emake () {
13
+ if command -v gmake > /dev/null 2>&1 ; then
14
+ gmake " $@ "
137
15
else
138
- curl --proto ' =https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_MINIMAL=1 sh
139
- source " $( dirname " ${GHCUP_BIN} " ) /env"
140
- ghcup install cabal --set " ${BOOTSTRAP_HASKELL_CABAL_VERSION} "
16
+ make " $@ "
141
17
fi
142
18
}
143
19
144
- strip_binary () {
145
- (
146
- set -e
147
- local binary=$1
20
+ mktempdir () {
148
21
case " $( uname -s) " in
149
22
" Darwin" |" darwin" )
150
- ;;
151
- MSYS_* |MINGW* )
23
+ mktemp -d -t hls_ci.XXXXXXX
152
24
;;
153
25
* )
154
- strip -s " ${binary} "
155
- ;;
156
- esac
157
- )
158
- }
159
-
160
- # GitLab Pipelines log section delimiters
161
- # https://gitlab.com/gitlab-org/gitlab-foss/issues/14664
162
- start_section () {
163
- name=" $1 "
164
- echo -e " section_start:$( date +%s) :$name \015\033[0K"
165
- }
166
-
167
- end_section () {
168
- name=" $1 "
169
- echo -e " section_end:$( date +%s) :$name \015\033[0K"
26
+ mktemp -d
27
+ ;;
28
+ esac
170
29
}
171
30
172
31
echo_color () {
@@ -176,31 +35,5 @@ echo_color() {
176
35
}
177
36
178
37
error () { echo_color " ${RED} " " $1 " ; }
179
- warn () { echo_color " ${LT_BROWN} " " $1 " ; }
180
- info () { echo_color " ${LT_BLUE} " " $1 " ; }
181
38
182
39
fail () { error " error: $1 " ; exit 1; }
183
-
184
- run () {
185
- info " Running $* ..."
186
- " $@ " || ( error " $* failed" ; return 1; )
187
- }
188
-
189
- emake () {
190
- if command -v gmake > /dev/null 2>&1 ; then
191
- gmake " $@ "
192
- else
193
- make " $@ "
194
- fi
195
- }
196
-
197
- mktempdir () {
198
- case " $( uname -s) " in
199
- " Darwin" |" darwin" )
200
- mktemp -d -t hls_ci.XXXXXXX
201
- ;;
202
- * )
203
- mktemp -d
204
- ;;
205
- esac
206
- }
0 commit comments