Skip to content

Commit cd68c15

Browse files
authored
Merge pull request #248 from bubba/binary-rename
Rename binaries before uploading
2 parents 8d32b21 + 0ac6c6d commit cd68c15

File tree

1 file changed

+51
-32
lines changed

1 file changed

+51
-32
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Builds
22

3+
defaults:
4+
run:
5+
shell: bash
6+
37
on:
48
release:
59
types: [created]
@@ -14,6 +18,8 @@ jobs:
1418
ghc: ['8.10.1', '8.8.4', '8.8.3', '8.8.2', '8.6.5', '8.6.4']
1519
os: [ubuntu-latest, macOS-latest, windows-latest]
1620
exclude:
21+
- os: windows-latest
22+
ghc: '8.8.4' # also fails due to segfault :(
1723
- os: windows-latest
1824
ghc: '8.8.3' # fails due to segfault
1925
- os: windows-latest
@@ -28,14 +34,7 @@ jobs:
2834
ghc-version: ${{ matrix.ghc }}
2935
cabal-version: '3.2'
3036

31-
- name: Cache Cabal
32-
uses: actions/[email protected]
33-
with:
34-
path: ~/.cabal
35-
key: ${{ runner.OS }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }}
36-
3737
- name: Shorten binary names
38-
shell: bash
3938
run: |
4039
sed -i.bak -e 's/haskell-language-server/hls/g' \
4140
-e 's/haskell_language_server/hls/g' \
@@ -45,7 +44,6 @@ jobs:
4544
4645
- name: Set some window specific things
4746
if: matrix.os == 'windows-latest'
48-
shell: bash
4947
run: |
5048
echo '::set-env name=EXE_EXT::.exe'
5149
@@ -55,47 +53,68 @@ jobs:
5553
echo '::set-env name=LINUX_CABAL_ARGS::--enable-executable-static --ghc-options=-split-sections'
5654
5755
- name: Build Server
58-
shell: bash
5956
# Try building it twice in case of flakey builds on Windows
6057
run: |
61-
cabal build exe:hls -O2 --disable-documentation $LINUX_CABAL_ARGS || \
62-
cabal build exe:hls -O2 --disable-documentation $LINUX_CABAL_ARGS
58+
cabal build exe:hls -O2 $LINUX_CABAL_ARGS || \
59+
cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1
6360
64-
- name: Find Server Binary
65-
id: find_server_binary
66-
shell: bash
61+
- name: Compress Server Binary
62+
id: compress_server_binary
63+
env:
64+
GHC_VER: ${{ matrix.ghc }}
6765
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
66+
HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f)
67+
HLS=haskell-language-server-$GHC_VER
68+
mv $HLS_BUILD $HLS
69+
if [[ "$OSTYPE" == "msys" ]]; then
70+
7z a $HLS.zip $HLS
71+
echo ::set-output name=path::$HLS.zip
72+
echo ::set-output name=content_type::application/zip
73+
echo ::set-output name=extension::zip
74+
else
75+
gzip --best $HLS
76+
echo ::set-output name=path::$HLS.gz
77+
echo ::set-output name=content_type::application/gzip
78+
echo ::set-output name=extension::gz
79+
fi
7180
7281
- name: Upload Server Binary
7382
uses: actions/[email protected]
7483
env:
7584
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7685
with:
7786
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
87+
asset_path: ${{ steps.compress_server_binary.outputs.path }}
88+
asset_name: haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }}
89+
asset_content_type: ${{ steps.compress_server_binary.outputs.content_type }}
8190

8291
- uses: actions/upload-artifact@v2
8392
with:
8493
name: haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.gz
85-
path: ${{ steps.find_server_binary.outputs.hls_binary }}
94+
path: ${{ steps.compress_server_binary.outputs.path }}
8695

8796
- name: Build Wrapper
8897
if: matrix.ghc == '8.10.1'
89-
run: cabal build exe:hls-wrapper -O2 --disable-documentation $WIN_CABAL_ARGS $LINUX_CABAL_ARGS
98+
run: cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS
9099

91-
- name: Find Wrapper Binary
100+
- name: Compress Wrapper Binary
92101
if: matrix.ghc == '8.10.1'
93-
id: find_wrapper_binary
94-
shell: bash
102+
id: compress_wrapper_binary
95103
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
104+
HLS_WRAPPER_BUILD=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f)
105+
HLS_WRAPPER=haskell-language-server-wrapper
106+
mv $HLS_WRAPPER_BUILD $HLS_WRAPPER
107+
if [[ "$OSTYPE" == "msys" ]]; then
108+
7z a $HLS_WRAPPER.zip $HLS_WRAPPER
109+
echo ::set-output name=path::$HLS_WRAPPER.zip
110+
echo ::set-output name=content_type::application/zip
111+
echo ::set-output name=extension::zip
112+
else
113+
gzip --best $HLS_WRAPPER
114+
echo ::set-output name=path::$HLS_WRAPPER.gz
115+
echo ::set-output name=content_type::application/gzip
116+
echo ::set-output name=extension::gz
117+
fi
99118
100119
- name: Upload Wrapper
101120
if: matrix.ghc == '8.10.1'
@@ -104,13 +123,13 @@ jobs:
104123
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105124
with:
106125
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
126+
asset_path: ${{ steps.compress_wrapper_binary.outputs.path }}
127+
asset_name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }}
128+
asset_content_type: ${{ steps.compress_wrapper_binary.outputs.content_type}}
110129

111130
- uses: actions/upload-artifact@v2
112131
if: matrix.ghc == '8.10.1'
113132
with:
114133
name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.gz
115-
path: ${{ steps.find_wrapper_binary.outputs.hls_wrapper_binary }}
134+
path: ${{ steps.compress_wrapper_binary.outputs.path }}
116135

0 commit comments

Comments
 (0)