11name : Builds
22
3+ defaults :
4+ run :
5+ shell : bash
6+
37on :
48 release :
59 types : [created]
2832 ghc-version : ${{ matrix.ghc }}
2933 cabal-version : ' 3.2'
3034
31- - name : Cache Cabal
32- uses : actions/cache@v1.2.0
33- with :
34- path : ~/.cabal
35- key : ${{ runner.OS }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }}
36-
3735 - name : Shorten binary names
38- shell : bash
3936 run : |
4037 sed -i.bak -e 's/haskell-language-server/hls/g' \
4138 -e 's/haskell_language_server/hls/g' \
4542
4643 - name : Set some window specific things
4744 if : matrix.os == 'windows-latest'
48- shell : bash
4945 run : |
5046 echo '::set-env name=EXE_EXT::.exe'
5147
@@ -55,47 +51,68 @@ jobs:
5551 echo '::set-env name=LINUX_CABAL_ARGS::--enable-executable-static --ghc-options=-split-sections'
5652
5753 - name : Build Server
58- shell : bash
5954 # Try building it twice in case of flakey builds on Windows
6055 run : |
6156 cabal build exe:hls -O2 --disable-documentation $LINUX_CABAL_ARGS || \
62- cabal build exe:hls -O2 --disable-documentation $LINUX_CABAL_ARGS
57+ cabal build exe:hls -O2 --disable-documentation $LINUX_CABAL_ARGS -j1
6358
64- - name : Find Server Binary
65- id : find_server_binary
66- shell : bash
59+ - name : Compress Server Binary
60+ id : compress_server_binary
61+ env :
62+ GHC_VER : ${{ matrix.ghc }}
6763 run : |
68- HLS=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f)
69- gzip --best $HLS
70- echo ::set-output name=hls_binary::$HLS.gz
64+ HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f)
65+ HLS=haskell-language-server-$GHC_VER
66+ mv $HLS_BUILD $HLS
67+ if [[ "$OSTYPE" == "msys" ]]; then
68+ 7z a $HLS.zip $HLS
69+ echo ::set-output name=path::$HLS.zip
70+ echo ::set-output name=content_type::application/zip
71+ echo ::set-output name=extension::zip
72+ else
73+ gzip --best $HLS
74+ echo ::set-output name=path::$HLS.gz
75+ echo ::set-output name=content_type::application/gzip
76+ echo ::set-output name=extension::gz
77+ fi
7178
7279 - name : Upload Server Binary
7380 uses : actions/upload-release-asset@v1.0.2
7481 env :
7582 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7683 with :
7784 upload_url : ${{ github.event.release.upload_url }}
78- asset_path : ${{ steps.find_server_binary .outputs.hls_binary }}
79- asset_name : haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.gz
80- asset_content_type : application/gzip
85+ asset_path : ${{ steps.compress_server_binary .outputs.path }}
86+ asset_name : haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }}
87+ asset_content_type : ${{ steps.compress_server_binary.outputs.content_type }}
8188
8289 - uses : actions/upload-artifact@v2
8390 with :
8491 name : haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.gz
85- path : ${{ steps.find_server_binary .outputs.hls_binary }}
92+ path : ${{ steps.compress_server_binary .outputs.path }}
8693
8794 - name : Build Wrapper
8895 if : matrix.ghc == '8.10.1'
8996 run : cabal build exe:hls-wrapper -O2 --disable-documentation $WIN_CABAL_ARGS $LINUX_CABAL_ARGS
9097
91- - name : Find Wrapper Binary
98+ - name : Compress Wrapper Binary
9299 if : matrix.ghc == '8.10.1'
93- id : find_wrapper_binary
94- shell : bash
100+ id : compress_wrapper_binary
95101 run : |
96- HLS_WRAPPER=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f)
97- gzip --best $HLS_WRAPPER
98- echo ::set-output name=hls_wrapper_binary::$HLS_WRAPPER.gz
102+ HLS_WRAPPER_BUILD=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f)
103+ HLS_WRAPPER=haskell-language-server-wrapper
104+ mv $HLS_WRAPPER_BUILD $HLS_WRAPPER
105+ if [[ "$OSTYPE" == "msys" ]]; then
106+ 7z a $HLS_WRAPPER.zip $HLS_WRAPPER
107+ echo ::set-output name=path::$HLS_WRAPPER.zip
108+ echo ::set-output name=content_type::application/zip
109+ echo ::set-output name=extension::zip
110+ else
111+ gzip --best $HLS_WRAPPER
112+ echo ::set-output name=path::$HLS_WRAPPER.gz
113+ echo ::set-output name=content_type::application/gzip
114+ echo ::set-output name=extension::gz
115+ fi
99116
100117 - name : Upload Wrapper
101118 if : matrix.ghc == '8.10.1'
@@ -104,13 +121,13 @@ jobs:
104121 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
105122 with :
106123 upload_url : ${{ github.event.release.upload_url }}
107- asset_path : ${{ steps.find_wrapper_binary .outputs.hls_wrapper_binary }}
108- asset_name : haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.gz
109- asset_content_type : application/gzip
124+ asset_path : ${{ steps.compress_wrapper_binary .outputs.path }}
125+ asset_name : haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }}
126+ asset_content_type : ${{ steps.compress_wrapper_binary.outputs.content_type}}
110127
111128 - uses : actions/upload-artifact@v2
112129 if : matrix.ghc == '8.10.1'
113130 with :
114131 name : haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.gz
115- path : ${{ steps.find_wrapper_binary .outputs.hls_wrapper_binary }}
132+ path : ${{ steps.compress_wrapper_binary .outputs.path }}
116133
0 commit comments