11
11
jobs :
12
12
build :
13
13
runs-on : ${{ matrix.os }}
14
- container : ${{ (matrix.os == 'ubuntu-18.04' && 'alpine:3.12') || '' }}
14
+ container : ${{ (startsWith( matrix.os, 'ubuntu') && 'alpine:3.12') || '' }}
15
15
defaults :
16
16
run :
17
- shell : ${{ (matrix.os == 'windows-latest' && 'bash') || 'sh' }}
17
+ shell : ${{ (startsWith( matrix.os, 'windows') && 'bash') || 'sh' }}
18
18
strategy :
19
19
fail-fast : false
20
20
matrix :
@@ -35,58 +35,45 @@ jobs:
35
35
36
36
steps :
37
37
- name : Install system dependencies
38
- if : matrix .os == 'ubuntu-18.04 '
38
+ if : runner .os == 'Linux '
39
39
run : |
40
40
apk add --no-cache curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz gzip tar perl git bash sudo binutils-gold
41
41
apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static
42
42
- uses : actions/checkout@v2
43
43
44
44
- name : Disable tests and bechmarks
45
45
run : |
46
- echo -e ' tests: false' >> cabal.project.local
47
- echo -e ' benchmarks: false' >> cabal.project.local
46
+ echo " tests: false" >> cabal.project.local
47
+ echo " benchmarks: false" >> cabal.project.local
48
48
49
49
- uses : ./.github/actions/setup-build
50
50
with :
51
51
ghc : ${{ matrix.ghc }}
52
52
os : ${{ runner.os }}
53
53
54
54
- name : (Windows) Platform specifics
55
- if : matrix.os == 'windows-latest'
56
- env :
57
- GHC_VER : ${{ matrix.ghc }}
55
+ if : runner.os == 'Windows'
58
56
run : |
59
57
echo "EXE_EXT=.exe" >> $GITHUB_ENV
60
- echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV
61
58
62
59
- name : (Linux) Platform specifics
63
- if : matrix.os == 'ubuntu-18.04'
64
- env :
65
- GHC_VER : ${{ matrix.ghc }}
66
- run : |
67
- echo "LINUX_CABAL_ARGS=--enable-executable-static --ghc-options=-split-sections" >> $GITHUB_ENV
68
- echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV
69
-
70
- - name : (macOS) Platform specifics
71
- if : matrix.os == 'macOS-latest'
72
- env :
73
- GHC_VER : ${{ matrix.ghc }}
60
+ if : runner.os == 'Linux'
74
61
run : |
75
- echo "GHC_VERSION=$GHC_VER " >> $GITHUB_ENV
62
+ echo "CABAL_ARGS=--enable-executable-static --ghc-options=-split-sections " >> $GITHUB_ENV
76
63
77
64
- name : Build the server
78
65
# Try building it twice in case of flakey builds on Windows
79
66
run : |
80
- cabal build exe:hls -O2 $LINUX_CABAL_ARGS || cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1
67
+ cabal build exe:hls -O2 $CABAL_ARGS || cabal build exe:hls -O2 $CABAL_ARGS -j1
81
68
82
69
- name : Compress server binary
83
70
id : compress_server_binary
84
71
run : |
85
72
HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f)
86
- HLS=haskell-language-server-${{env.GHC_VERSION }}
87
- mv $HLS_BUILD $HLS${{env.EXE_EXT}}
88
- if [[ "$OSTYPE " == "msys " ]]; then
89
- 7z a $HLS.zip $HLS${{env.EXE_EXT}}
73
+ HLS=haskell-language-server-${{ matrix.ghc }}
74
+ mv $HLS_BUILD $HLS${{ env.EXE_EXT }}
75
+ if [[ "${{ runner.os }} " == "Windows " ]]; then
76
+ 7z a $HLS.zip $HLS${{ env.EXE_EXT }}
90
77
echo ::set-output name=path::$HLS.zip
91
78
echo ::set-output name=content_type::application/zip
92
79
echo ::set-output name=extension::zip
@@ -97,36 +84,36 @@ jobs:
97
84
echo ::set-output name=extension::gz
98
85
fi
99
86
100
- - name : (not check) Upload server to release
101
- if : ${{ !contains(github.ref_name, 'check') }}
87
+ - name : Upload server to release
88
+ if : ${{ !contains(github.ref_name, 'check') && github.event.release.upload_url != '' }}
102
89
103
90
env :
104
91
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
105
92
with :
106
93
upload_url : ${{ github.event.release.upload_url }}
107
94
asset_path : ${{ steps.compress_server_binary.outputs.path }}
108
- asset_name : haskell-language-server-${{ runner.OS }}-${{ env.GHC_VERSION }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }}
95
+ asset_name : haskell-language-server-${{ runner.os }}-${{ matrix.ghc }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }}
109
96
asset_content_type : ${{ steps.compress_server_binary.outputs.content_type }}
110
97
111
98
- name : Upload server to workflow artifacts
112
99
uses : actions/upload-artifact@v2
113
100
with :
114
- name : haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }}
101
+ name : haskell-language-server-${{ runner.os }}-${{ matrix.ghc }}${{ env.EXE_EXT }}.${{ steps.compress_server_binary.outputs.extension }}
115
102
path : ${{ steps.compress_server_binary.outputs.path }}
116
103
117
- - name : (GHC 8.10) Build the wrapper
104
+ - name : Build the wrapper
118
105
if : matrix.ghc == '8.10.7'
119
106
run : cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS
120
107
121
- - name : (GHC 8.10) Compress wrapper binary
108
+ - name : Compress wrapper binary
122
109
if : matrix.ghc == '8.10.7'
123
110
id : compress_wrapper_binary
124
111
run : |
125
112
HLS_WRAPPER_BUILD=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f)
126
113
HLS_WRAPPER=haskell-language-server-wrapper
127
- mv $HLS_WRAPPER_BUILD $HLS_WRAPPER${{env.EXE_EXT}}
128
- if [[ "$OSTYPE " == "msys " ]]; then
129
- 7z a $HLS_WRAPPER.zip $HLS_WRAPPER${{env.EXE_EXT}}
114
+ mv $HLS_WRAPPER_BUILD $HLS_WRAPPER${{ env.EXE_EXT }}
115
+ if [[ "${{ runner.os }} " == "Windows " ]]; then
116
+ 7z a $HLS_WRAPPER.zip $HLS_WRAPPER${{ env.EXE_EXT }}
130
117
echo ::set-output name=path::$HLS_WRAPPER.zip
131
118
echo ::set-output name=content_type::application/zip
132
119
echo ::set-output name=extension::zip
@@ -137,22 +124,22 @@ jobs:
137
124
echo ::set-output name=extension::gz
138
125
fi
139
126
140
- - name : (GHC 8.10, not check) Upload wrapper to the release
141
- if : ${{ matrix.ghc == '8.10.7' && !contains(github.ref_name, 'check') }}
127
+ - name : Upload wrapper to the release
128
+ if : ${{ matrix.ghc == '8.10.7' && !contains(github.ref_name, 'check') && github.event.release.upload_url != '' }}
142
129
143
130
env :
144
131
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
145
132
with :
146
133
upload_url : ${{ github.event.release.upload_url }}
147
134
asset_path : ${{ steps.compress_wrapper_binary.outputs.path }}
148
- asset_name : haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }}
135
+ asset_name : haskell-language-server-wrapper-${{ runner.os }}${{ env.EXE_EXT }}.${{ steps.compress_wrapper_binary.outputs.extension }}
149
136
asset_content_type : ${{ steps.compress_wrapper_binary.outputs.content_type}}
150
137
151
- - name : (GHC 8.10) Upload wrapper to workflow artifacts
138
+ - name : Upload wrapper to workflow artifacts
152
139
uses : actions/upload-artifact@v2
153
140
if : matrix.ghc == '8.10.7'
154
141
with :
155
- name : haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }}
142
+ name : haskell-language-server-wrapper-${{ runner.os }}${{ env.EXE_EXT }}.${{ steps.compress_wrapper_binary.outputs.extension }}
156
143
path : ${{ steps.compress_wrapper_binary.outputs.path }}
157
144
158
145
# generates a custom tarball with sources, used by `ghcup compile hls`
@@ -163,29 +150,38 @@ jobs:
163
150
steps :
164
151
- uses : actions/checkout@v2
165
152
153
+ - name : Set hls release version
154
+ run : |
155
+ HLS_VER="${{ github.event.release.tag_name }}"
156
+ if [[ -z $HLS_VER ]]; then
157
+ HLS_VER=${{ github.sha }}
158
+ HLS_VER=${HLS_VER:0:5}
159
+ fi
160
+ echo "HLS_VER=$HLS_VER" >> $GITHUB_ENV
161
+
166
162
- name : Create source tarball
167
163
run : |
168
164
mkdir src-dist
169
- git archive --prefix=haskell-language-server-${{ github.event.release.tag_name }}/ \
165
+ git archive --prefix=haskell-language-server-${{ env.HLS_VER }}/ \
170
166
--format=tar.gz \
171
167
-o src-dist/haskell-language-server.tar.gz \
172
168
HEAD
173
169
174
- - name : (not check) Upload source tarball to the release
175
- if : ${{ !contains(github.ref_name, 'check') }}
170
+ - name : Upload source tarball to the release
171
+ if : ${{ !contains(github.ref_name, 'check') && github.event.release.upload_url != '' }}
176
172
177
173
env :
178
174
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
179
175
with :
180
176
upload_url : ${{ github.event.release.upload_url }}
181
177
asset_path : src-dist/haskell-language-server.tar.gz
182
- asset_name : haskell-language-server-${{ github.event.release.tag_name }}-src.tar.gz
178
+ asset_name : haskell-language-server-${{ env.HLS_VER }}-src.tar.gz
183
179
asset_content_type : application/gzip
184
180
185
181
- name : Upload source tarball to workflow artifacts
186
182
uses : actions/upload-artifact@v2
187
183
with :
188
- name : haskell-language-server-${{ github.event.release.tag_name }}-src.tar.gz
184
+ name : haskell-language-server-${{ env.HLS_VER }}-src.tar.gz
189
185
path : src-dist/haskell-language-server.tar.gz
190
186
191
187
# this generates .gz tarfiles containing binaries for all GHC versions and OS's
@@ -195,44 +191,53 @@ jobs:
195
191
runs-on : ubuntu-18.04
196
192
strategy :
197
193
matrix :
198
- os : [ "Linux"
199
- , "macOS"
200
- , "Windows"
201
- ]
194
+ target- os : [ "Linux"
195
+ , "macOS"
196
+ , "Windows"
197
+ ]
202
198
steps :
203
199
- uses : actions/download-artifact@v2
204
200
205
201
- name : Generate tarball with all binaries
206
202
run : |
207
203
# move the binaries for the specific platform into bin/
208
204
mkdir bin
209
- mv haskell-language-server-${{ matrix.os }}-*/* bin
210
- mv haskell-language-server-wrapper-${{ matrix.os }}.*/* bin
205
+ mv haskell-language-server-${{ matrix.target- os }}-*/* bin
206
+ mv haskell-language-server-wrapper-${{ matrix.target- os }}.*/* bin
211
207
# decompress them
212
208
cd bin
213
- if [[ "${{ matrix.os }}" == "Windows" ]]; then
209
+ if [[ "${{ matrix.target- os }}" == "Windows" ]]; then
214
210
7z x "*.zip"
215
211
rm *.zip
216
212
else
217
213
gzip -d *.gz
218
214
fi
219
215
tar -czpf haskell-language-server.tar.gz *
220
216
221
- - name : (not check) Upload binaries tarball to the release
222
- if : ${{ !contains(github.ref_name, 'check') }}
217
+ - name : Upload binaries tarball to the release
218
+ if : ${{ !contains(github.ref_name, 'check') && github.event.release.upload_url != '' }}
223
219
224
220
env :
225
221
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
226
222
with :
227
223
upload_url : ${{ github.event.release.upload_url }}
228
224
asset_path : bin/haskell-language-server.tar.gz
229
- asset_name : haskell-language-server-${{ matrix.os }}-${{ github.event.release.tag_name }}.tar.gz
225
+ asset_name : haskell-language-server-${{ matrix.target- os }}-${{ github.event.release.tag_name }}.tar.gz
230
226
asset_content_type : application/gzip
231
227
228
+ - name : Set hls release version
229
+ run : |
230
+ HLS_VER="${{ github.event.release.tag_name }}"
231
+ if [[ -z $HLS_VER ]]; then
232
+ HLS_VER=${{ github.sha }}
233
+ HLS_VER=${HLS_VER:0:5}
234
+ fi
235
+ echo "HLS_VER=$HLS_VER" >> $GITHUB_ENV
236
+
232
237
- name : Upload binaries tarball to workflow artifacts
233
238
uses : actions/upload-artifact@v2
234
239
with :
235
- name : haskell-language-server-${{ matrix.os }}-${{ github.event.release.tag_name }}.tar.gz
240
+ name : haskell-language-server-${{ matrix.target- os }}-${{ env.HLS_VER }}.tar.gz
236
241
path : bin/haskell-language-server.tar.gz
237
242
238
243
sha256sum :
@@ -247,8 +252,8 @@ jobs:
247
252
# we clean up tags to match the release file names
248
253
sed -i 's/\/.*)/)/g' SHA256SUMS
249
254
250
- - name : (not check) Upload sha256sums to the release
251
- if : ${{ !contains(github.ref_name, 'check') }}
255
+ - name : Upload sha256sums to the release
256
+ if : ${{ !contains(github.ref_name, 'check') && github.event.release.upload_url != '' }}
252
257
253
258
env :
254
259
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments