1111jobs :
1212 build :
1313 runs-on : ${{ matrix.os }}
14- container : ${{ (matrix.os == 'ubuntu-18.04' && 'alpine:3.12') || '' }}
14+ container : ${{ (startsWith( matrix.os, 'ubuntu') && 'alpine:3.12') || '' }}
1515 defaults :
1616 run :
17- shell : ${{ (matrix.os == 'windows-latest' && 'bash') || 'sh' }}
17+ shell : ${{ (startsWith( matrix.os, 'windows') && 'bash') || 'sh' }}
1818 strategy :
1919 fail-fast : false
2020 matrix :
@@ -35,58 +35,45 @@ jobs:
3535
3636 steps :
3737 - name : Install system dependencies
38- if : matrix .os == 'ubuntu-18.04 '
38+ if : runner .os == 'Linux '
3939 run : |
4040 apk add --no-cache curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz gzip tar perl git bash sudo binutils-gold
4141 apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static
4242 - uses : actions/checkout@v2
4343
4444 - name : Disable tests and bechmarks
4545 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
4848
4949 - uses : ./.github/actions/setup-build
5050 with :
5151 ghc : ${{ matrix.ghc }}
5252 os : ${{ runner.os }}
5353
5454 - name : (Windows) Platform specifics
55- if : matrix.os == 'windows-latest'
56- env :
57- GHC_VER : ${{ matrix.ghc }}
55+ if : runner.os == 'Windows'
5856 run : |
5957 echo "EXE_EXT=.exe" >> $GITHUB_ENV
60- echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV
6158
6259 - 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'
7461 run : |
75- echo "GHC_VERSION=$GHC_VER " >> $GITHUB_ENV
62+ echo "CABAL_ARGS=--enable-executable-static --ghc-options=-split-sections " >> $GITHUB_ENV
7663
7764 - name : Build the server
7865 # Try building it twice in case of flakey builds on Windows
7966 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
8168
8269 - name : Compress server binary
8370 id : compress_server_binary
8471 run : |
8572 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 }}
9077 echo ::set-output name=path::$HLS.zip
9178 echo ::set-output name=content_type::application/zip
9279 echo ::set-output name=extension::zip
@@ -97,36 +84,36 @@ jobs:
9784 echo ::set-output name=extension::gz
9885 fi
9986
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 != '' }}
10289 uses : actions/upload-release-asset@v1.0.2
10390 env :
10491 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
10592 with :
10693 upload_url : ${{ github.event.release.upload_url }}
10794 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 }}
10996 asset_content_type : ${{ steps.compress_server_binary.outputs.content_type }}
11097
11198 - name : Upload server to workflow artifacts
11299 uses : actions/upload-artifact@v2
113100 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 }}
115102 path : ${{ steps.compress_server_binary.outputs.path }}
116103
117- - name : (GHC 8.10) Build the wrapper
104+ - name : Build the wrapper
118105 if : matrix.ghc == '8.10.7'
119106 run : cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS
120107
121- - name : (GHC 8.10) Compress wrapper binary
108+ - name : Compress wrapper binary
122109 if : matrix.ghc == '8.10.7'
123110 id : compress_wrapper_binary
124111 run : |
125112 HLS_WRAPPER_BUILD=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f)
126113 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 }}
130117 echo ::set-output name=path::$HLS_WRAPPER.zip
131118 echo ::set-output name=content_type::application/zip
132119 echo ::set-output name=extension::zip
@@ -137,22 +124,22 @@ jobs:
137124 echo ::set-output name=extension::gz
138125 fi
139126
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 != '' }}
142129 uses : actions/upload-release-asset@v1.0.2
143130 env :
144131 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
145132 with :
146133 upload_url : ${{ github.event.release.upload_url }}
147134 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 }}
149136 asset_content_type : ${{ steps.compress_wrapper_binary.outputs.content_type}}
150137
151- - name : (GHC 8.10) Upload wrapper to workflow artifacts
138+ - name : Upload wrapper to workflow artifacts
152139 uses : actions/upload-artifact@v2
153140 if : matrix.ghc == '8.10.7'
154141 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 }}
156143 path : ${{ steps.compress_wrapper_binary.outputs.path }}
157144
158145 # generates a custom tarball with sources, used by `ghcup compile hls`
@@ -163,29 +150,38 @@ jobs:
163150 steps :
164151 - uses : actions/checkout@v2
165152
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+
166162 - name : Create source tarball
167163 run : |
168164 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 }}/ \
170166 --format=tar.gz \
171167 -o src-dist/haskell-language-server.tar.gz \
172168 HEAD
173169
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 != '' }}
176172 uses : actions/upload-release-asset@v1.0.2
177173 env :
178174 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
179175 with :
180176 upload_url : ${{ github.event.release.upload_url }}
181177 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
183179 asset_content_type : application/gzip
184180
185181 - name : Upload source tarball to workflow artifacts
186182 uses : actions/upload-artifact@v2
187183 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
189185 path : src-dist/haskell-language-server.tar.gz
190186
191187 # this generates .gz tarfiles containing binaries for all GHC versions and OS's
@@ -195,44 +191,53 @@ jobs:
195191 runs-on : ubuntu-18.04
196192 strategy :
197193 matrix :
198- os : [ "Linux"
199- , "macOS"
200- , "Windows"
201- ]
194+ target- os : [ "Linux"
195+ , "macOS"
196+ , "Windows"
197+ ]
202198 steps :
203199 - uses : actions/download-artifact@v2
204200
205201 - name : Generate tarball with all binaries
206202 run : |
207203 # move the binaries for the specific platform into bin/
208204 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
211207 # decompress them
212208 cd bin
213- if [[ "${{ matrix.os }}" == "Windows" ]]; then
209+ if [[ "${{ matrix.target- os }}" == "Windows" ]]; then
214210 7z x "*.zip"
215211 rm *.zip
216212 else
217213 gzip -d *.gz
218214 fi
219215 tar -czpf haskell-language-server.tar.gz *
220216
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 != '' }}
223219 uses : actions/upload-release-asset@v1.0.2
224220 env :
225221 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
226222 with :
227223 upload_url : ${{ github.event.release.upload_url }}
228224 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
230226 asset_content_type : application/gzip
231227
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+
232237 - name : Upload binaries tarball to workflow artifacts
233238 uses : actions/upload-artifact@v2
234239 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
236241 path : bin/haskell-language-server.tar.gz
237242
238243 sha256sum :
@@ -247,8 +252,8 @@ jobs:
247252 # we clean up tags to match the release file names
248253 sed -i 's/\/.*)/)/g' SHA256SUMS
249254
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 != '' }}
252257 uses : actions/upload-release-asset@v1.0.2
253258 env :
254259 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments