Skip to content

Rename binaries before uploading #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 51 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Builds

defaults:
run:
shell: bash

on:
release:
types: [created]
Expand All @@ -14,6 +18,8 @@ jobs:
ghc: ['8.10.1', '8.8.4', '8.8.3', '8.8.2', '8.6.5', '8.6.4']
os: [ubuntu-latest, macOS-latest, windows-latest]
exclude:
- os: windows-latest
ghc: '8.8.4' # also fails due to segfault :(
- os: windows-latest
ghc: '8.8.3' # fails due to segfault
- os: windows-latest
Expand All @@ -28,14 +34,7 @@ jobs:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.2'

- name: Cache Cabal
uses: actions/[email protected]
with:
path: ~/.cabal
key: ${{ runner.OS }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }}

- name: Shorten binary names
shell: bash
run: |
sed -i.bak -e 's/haskell-language-server/hls/g' \
-e 's/haskell_language_server/hls/g' \
Expand All @@ -45,7 +44,6 @@ jobs:

- name: Set some window specific things
if: matrix.os == 'windows-latest'
shell: bash
run: |
echo '::set-env name=EXE_EXT::.exe'

Expand All @@ -55,47 +53,68 @@ jobs:
echo '::set-env name=LINUX_CABAL_ARGS::--enable-executable-static --ghc-options=-split-sections'

- name: Build Server
shell: bash
# Try building it twice in case of flakey builds on Windows
run: |
cabal build exe:hls -O2 --disable-documentation $LINUX_CABAL_ARGS || \
cabal build exe:hls -O2 --disable-documentation $LINUX_CABAL_ARGS
cabal build exe:hls -O2 $LINUX_CABAL_ARGS || \
cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1

- name: Find Server Binary
id: find_server_binary
shell: bash
- name: Compress Server Binary
id: compress_server_binary
env:
GHC_VER: ${{ matrix.ghc }}
run: |
HLS=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f)
gzip --best $HLS
echo ::set-output name=hls_binary::$HLS.gz
HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f)
HLS=haskell-language-server-$GHC_VER
mv $HLS_BUILD $HLS
if [[ "$OSTYPE" == "msys" ]]; then
7z a $HLS.zip $HLS
echo ::set-output name=path::$HLS.zip
echo ::set-output name=content_type::application/zip
echo ::set-output name=extension::zip
else
gzip --best $HLS
echo ::set-output name=path::$HLS.gz
echo ::set-output name=content_type::application/gzip
echo ::set-output name=extension::gz
fi

- name: Upload Server Binary
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.find_server_binary.outputs.hls_binary }}
asset_name: haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.gz
asset_content_type: application/gzip
asset_path: ${{ steps.compress_server_binary.outputs.path }}
asset_name: haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }}
asset_content_type: ${{ steps.compress_server_binary.outputs.content_type }}

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

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

- name: Find Wrapper Binary
- name: Compress Wrapper Binary
if: matrix.ghc == '8.10.1'
id: find_wrapper_binary
shell: bash
id: compress_wrapper_binary
run: |
HLS_WRAPPER=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f)
gzip --best $HLS_WRAPPER
echo ::set-output name=hls_wrapper_binary::$HLS_WRAPPER.gz
HLS_WRAPPER_BUILD=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f)
HLS_WRAPPER=haskell-language-server-wrapper
mv $HLS_WRAPPER_BUILD $HLS_WRAPPER
if [[ "$OSTYPE" == "msys" ]]; then
7z a $HLS_WRAPPER.zip $HLS_WRAPPER
echo ::set-output name=path::$HLS_WRAPPER.zip
echo ::set-output name=content_type::application/zip
echo ::set-output name=extension::zip
else
gzip --best $HLS_WRAPPER
echo ::set-output name=path::$HLS_WRAPPER.gz
echo ::set-output name=content_type::application/gzip
echo ::set-output name=extension::gz
fi

- name: Upload Wrapper
if: matrix.ghc == '8.10.1'
Expand All @@ -104,13 +123,13 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.find_wrapper_binary.outputs.hls_wrapper_binary }}
asset_name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.gz
asset_content_type: application/gzip
asset_path: ${{ steps.compress_wrapper_binary.outputs.path }}
asset_name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }}
asset_content_type: ${{ steps.compress_wrapper_binary.outputs.content_type}}

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