-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Distributable binaries #165
Merged
Merged
Changes from 54 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
69b4f07
WIP
lukel97 0e30291
WIP 2
lukel97 43c8076
WIP 3
lukel97 8ba974b
WIP 4
lukel97 cde25d7
WIP 5
lukel97 c328c80
WIP 6
lukel97 2a5b400
WIP 7
lukel97 ffe3d4e
WIP 8
lukel97 7c7c207
WIP 9 Use patched hie-bios to get libdir dynamically
lukel97 bf59f29
Try building the wrapper
lukel97 0ace84b
Try to fix build_wrapper env variable not being picked up
lukel97 32c5937
Try again
lukel97 1a66953
Give up on the env var idea
lukel97 5d3fed7
Try out static optimised builds?
lukel97 191272a
Try squashing the working dir
lukel97 a3b309c
Woops
lukel97 a626ffc
Try squashing the builddir
lukel97 4219d51
Try going into the parent directory
lukel97 dc99a50
Radical approach - don't use such a long name for the wrapper
lukel97 277f20e
Use dist-binary flag
lukel97 4feadad
Debug why floskell fails to build on windows
lukel97 f4a7fb8
haskell-language-server => hls on CI
lukel97 a91ae03
Employ extreme path saving measures
lukel97 d53fb6e
sed time :(
lukel97 7e0402b
Try making sed command portable
lukel97 505ee0a
Compress artefacts
lukel97 304f4c3
Tidy up wrapper logging
lukel97 0c48be8
Use version checking logic in hie-bios
lukel97 65eb6c4
Add documentation on the releases process
lukel97 c1a1228
Remove unused code
lukel97 d0aa2fa
Append .exe to windows binaries
lukel97 edf2cc5
Try out building remaining supported ghc configurations
lukel97 322e6ad
Add wrapper tests and update hie-bios
lukel97 8063c33
Merge remote-tracking branch 'origin/master' into github-action-builds
lukel97 997e6b0
Use index timestamp that exists on hackage
lukel97 0df1168
Update hie-bios
lukel97 74468f7
Update hie-bios
lukel97 06abcf4
Try building windows jobs on -j1
lukel97 f84d4a7
Skip windows 8.8.2
lukel97 dc3a61a
Update ghc-check to use hie-bios runtime ghc libdir
lukel97 c76a69e
Upload binaries as an artifact too
lukel97 18c4082
Try flicking on enable-executable-static
lukel97 90b286e
Fix artifact upload
lukel97 b24390f
Merge remote-tracking branch 'origin/master' into github-action-builds
lukel97 1e9b6e7
Merge remote-tracking branch 'origin/master' into github-action-builds
lukel97 a5c5608
Update to latest ghcide and reuse loadSession
lukel97 cf05aa9
Check if the tool is installed in --project-ghc-version in the wrapper
lukel97 773ec86
Fix wrapper tests by copying to temporary directory
lukel97 bcfa908
Try caching
lukel97 53c3676
Tidy up and switch back to cabal helper implicit cradle
lukel97 54ce0ec
use split sections
amesgen c162fca
Merge pull request #1 from amesgen/use-split-sections
lukel97 7156e45
Remove cabal-helper and replace it with hie-bios implicit logic
lukel97 72abb71
Merge branch 'github-action-builds' of github.com:bubba/haskell-langu…
lukel97 1cd5016
Merge remote-tracking branch 'origin/master' into github-action-builds
lukel97 9238ced
Undo agpl common stanza change
lukel97 ebe5ef1
Add release number
lukel97 3e2ac6f
Merge remote-tracking branch 'origin/master' into github-action-builds
lukel97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
name: Builds | ||
|
||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
|
||
build: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ghc: ['8.10.1', '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.3' # fails due to segfault | ||
- os: windows-latest | ||
ghc: '8.8.2' # fails due to error with Cabal | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
- uses: actions/[email protected] | ||
with: | ||
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' \ | ||
haskell-language-server.cabal | ||
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ | ||
src/**/*.hs exe/*.hs | ||
|
||
- name: Set some window specific things | ||
if: matrix.os == 'windows-latest' | ||
shell: bash | ||
run: | | ||
echo '::set-env name=EXE_EXT::.exe' | ||
|
||
- name: Set some linux specific things | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
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 | ||
|
||
- name: Find Server Binary | ||
id: find_server_binary | ||
shell: bash | ||
run: | | ||
HLS=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f) | ||
gzip --best $HLS | ||
echo ::set-output name=hls_binary::$HLS.gz | ||
|
||
- 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 | ||
|
||
- 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 }} | ||
|
||
- name: Build Wrapper | ||
if: matrix.ghc == '8.10.1' | ||
run: cabal build exe:hls-wrapper -O2 --disable-documentation $WIN_CABAL_ARGS $LINUX_CABAL_ARGS | ||
|
||
- name: Find Wrapper Binary | ||
if: matrix.ghc == '8.10.1' | ||
id: find_wrapper_binary | ||
shell: bash | ||
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 | ||
|
||
- name: Upload Wrapper | ||
if: matrix.ghc == '8.10.1' | ||
uses: actions/[email protected] | ||
env: | ||
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 | ||
|
||
- 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 }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Releases and distributable binaries | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome Documentation! |
||
|
||
Starting with 0.X.0.0 haskell-language-server provides pre-built binaries on | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I imagine 0.3.0.0, if we merge soon. |
||
each [GitHub | ||
release](https://github.com/haskell/haskell-language-server/releases). These | ||
binaries are used by the [vscode-hie-server | ||
extension](https://github.com/alanz/vscode-hie-server) to provide automatic | ||
installation for users on VS Code, but they can also be installed manually | ||
when added to the path. | ||
|
||
## Making a new release of haskell-language-server | ||
|
||
Go to the [GitHub releases | ||
page](https://github.com/haskell/haskell-language-server/releases) for | ||
haskell-language-server and start to create a new release. Choose or create a | ||
tag, fill out the release notes etc., but before you create it | ||
**make sure to check the pre-release checkbox**. This will prevent VS Code | ||
*extension | ||
users from attempting to install this version before the binaries are | ||
created. | ||
|
||
Once the release is created the [GitHub Actions | ||
workflow](https://github.com/haskell/haskell-language-server/actions) will be | ||
kicked off and will start creating binaries. They will be gzipped and | ||
uploaded to the release. | ||
|
||
It creates a `haskell-language-server-OS-GHC` binary for each platform | ||
(Linux, macOS, Windows) and each GHC version that we currently support, as well | ||
as a `haskell-language-server-wrapper-OS` binary for each platform. Note that | ||
only one wrapper binary is created per platform, and it should be built with the | ||
most recent GHC version. | ||
|
||
Once all these binaries are present | ||
|
||
## Distributable binaries | ||
In order to compile a hls binary on one machine and have it run on another, you | ||
need to make sure there are **no hardcoded paths or data-files**. | ||
|
||
### ghc libdir | ||
One noteable thing which cannot be hardcoded is the **GHC libdir** – this is | ||
a path to `/usr/local/lib/ghc` or something like that, which was previously | ||
baked in at compile-time with ghc-paths. Note that with static binaries we | ||
can no longer use this because the GHC libdir of the GitHub Actions machine | ||
will most almost certainly not exist on the end user's machine. | ||
Therefore, hie-bios provides `getGhcRuntimeLibDir` to obtain this path on the fly | ||
by consulting the cradle. | ||
|
||
### Static binaries | ||
We use the word "distributable" here because technically only the Linux builds | ||
are static. They are built by passing `--enable-executable-static` to cabal. | ||
Static binaries don't really exist on macOS, and there are issues with | ||
proprietary code being linked in on Windows. However, the `.dylib`s linked on | ||
macOS are all already provided by the system: | ||
|
||
``` | ||
$ objdump -macho --dylibs-used haskell-language-server | ||
haskell-language-server: | ||
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0) | ||
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) | ||
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1) | ||
/usr/lib/libcharset.1.dylib (compatibility version 2.0.0, current version 2.0.0) | ||
``` | ||
|
||
## The GitHub Actions workflow | ||
It just kicks off a matrix of jobs varying across GHC versions and OSs, building | ||
the binaries with Cabal and extracting them from the dist-newstyle directory. | ||
The binaries are built with -O2. | ||
|
||
One caveat is that we need to rename the binaries from | ||
haskell-language-server/haskell-language-server-wrapper to hls/hls-wrapper due to | ||
path length limitations on windows. But whenever we upload them to the release, | ||
we make sure to upload them as their full name variant. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the correct upstream repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until those other PRs and @wz1000s PRs get merged into ghcide, I think so. This checkout is just @fendor's previous submodule + my patches cherry-picked on top