1
1
name : Builds
2
2
3
+ defaults :
4
+ run :
5
+ shell : bash
6
+
3
7
on :
4
8
release :
5
9
types : [created]
28
32
ghc-version : ${{ matrix.ghc }}
29
33
cabal-version : ' 3.2'
30
34
31
- - name : Cache Cabal
32
-
33
- with :
34
- path : ~/.cabal
35
- key : ${{ runner.OS }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }}
36
-
37
35
- name : Shorten binary names
38
- shell : bash
39
36
run : |
40
37
sed -i.bak -e 's/haskell-language-server/hls/g' \
41
38
-e 's/haskell_language_server/hls/g' \
45
42
46
43
- name : Set some window specific things
47
44
if : matrix.os == 'windows-latest'
48
- shell : bash
49
45
run : |
50
46
echo '::set-env name=EXE_EXT::.exe'
51
47
@@ -55,47 +51,68 @@ jobs:
55
51
echo '::set-env name=LINUX_CABAL_ARGS::--enable-executable-static --ghc-options=-split-sections'
56
52
57
53
- name : Build Server
58
- shell : bash
59
54
# Try building it twice in case of flakey builds on Windows
60
55
run : |
61
56
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
63
58
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 }}
67
63
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
71
78
72
79
- name : Upload Server Binary
73
80
74
81
env :
75
82
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
76
83
with :
77
84
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 }}
81
88
82
89
- uses : actions/upload-artifact@v2
83
90
with :
84
91
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 }}
86
93
87
94
- name : Build Wrapper
88
95
if : matrix.ghc == '8.10.1'
89
96
run : cabal build exe:hls-wrapper -O2 --disable-documentation $WIN_CABAL_ARGS $LINUX_CABAL_ARGS
90
97
91
- - name : Find Wrapper Binary
98
+ - name : Compress Wrapper Binary
92
99
if : matrix.ghc == '8.10.1'
93
- id : find_wrapper_binary
94
- shell : bash
100
+ id : compress_wrapper_binary
95
101
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
99
116
100
117
- name : Upload Wrapper
101
118
if : matrix.ghc == '8.10.1'
@@ -104,13 +121,13 @@ jobs:
104
121
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
105
122
with :
106
123
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}}
110
127
111
128
- uses : actions/upload-artifact@v2
112
129
if : matrix.ghc == '8.10.1'
113
130
with :
114
131
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 }}
116
133
0 commit comments