Skip to content

Commit 8ee73d0

Browse files
jneiramergify[bot]
andauthored
Generate custom source tarball (#2248)
* Generate source tarball * Update release doc * Checkout code and create subdir * Separate src-tar in a new job Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 6ba5eef commit 8ee73d0

File tree

2 files changed

+59
-27
lines changed

2 files changed

+59
-27
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
types: [created]
1010

1111
jobs:
12-
1312
build:
1413
runs-on: ${{ matrix.os }}
1514

@@ -156,9 +155,41 @@ jobs:
156155
with:
157156
name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }}
158157
path: ${{ steps.compress_wrapper_binary.outputs.path }}
158+
159+
# generates a custom tarball with sources, used by `ghcup compile hls`
160+
src-tar:
161+
needs: build
162+
runs-on: ubuntu-18.04
163+
164+
steps:
165+
- uses: actions/checkout@v2
166+
with:
167+
submodules: true
168+
169+
- name: "Create source tarball"
170+
run: |
171+
mkdir src-dist
172+
git archive --prefix=haskell-language-server-${{ github.event.release.tag_name }}/ \
173+
--format=tar.gz \
174+
-o src-dist/haskell-language-server.tar.gz \
175+
HEAD
176+
177+
- uses: actions/upload-release-asset@v1.0.2
178+
env:
179+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
180+
with:
181+
upload_url: ${{ github.event.release.upload_url }}
182+
asset_path: src-dist/haskell-language-server.tar.gz
183+
asset_name: haskell-language-server-${{ github.event.release.tag_name }}-src.tar.gz
184+
asset_content_type: application/gzip
159185

160-
# this generates .gz tarfiles containing all the GHC versions for
161-
# macOS and Linux, used by ghcup
186+
- uses: actions/upload-artifact@v2
187+
with:
188+
name: haskell-language-server-${{ github.event.release.tag_name }}-src.tar.gz
189+
path: src-dist/haskell-language-server.tar.gz
190+
191+
# this generates .gz tarfiles containing binaries for all GHC versions and OS's
192+
# used by `ghcup install hls`
162193
tar:
163194
needs: build
164195
runs-on: ubuntu-18.04
@@ -198,7 +229,7 @@ jobs:
198229
path: bin/haskell-language-server.tar.gz
199230

200231
sha256sum:
201-
needs: tar
232+
needs: [tar, src-tar]
202233
runs-on: ubuntu-18.04
203234
steps:
204235
- uses: actions/download-artifact@v2

docs/contributing/releases.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,24 @@ only one wrapper binary is created per platform, and it should be built with the
5757
most recent GHC version.
5858

5959
### ghcup
60-
It also creates a `haskell-language-server-${os}-${hlsVersion}.tar.gz` tarball with
61-
the binaries for *all* supported ghc versions, to help downstream publishers in
62-
the distribution of the release. The most prominent publisher using them is `ghcup`.
63-
The `tar` job in the workflow file automates the creation of this.
6460

65-
Once all these binaries are present
61+
It creates a `haskell-language-server-${os}-${hlsVersion}.tar.gz` tarball with
62+
the binaries for *all* supported ghc versions and a custom source tarball to help
63+
downstream publishers in the distribution of the release.
64+
65+
The most prominent publisher using them is `ghcup`.
66+
67+
### checksums
68+
69+
The sha256 checksum of all artifacts are listed in the `SHA256SUMS` release file.
6670

6771
## Distributable binaries
72+
6873
In order to compile a hls binary on one machine and have it run on another, you
6974
need to make sure there are **no hardcoded paths or data-files**.
7075

7176
### ghc libdir
77+
7278
One noteable thing which cannot be hardcoded is the **GHC libdir** – this is
7379
a path to `/usr/local/lib/ghc` or something like that, which was previously
7480
baked in at compile-time with ghc-paths. Note that with static binaries we
@@ -78,22 +84,24 @@ Therefore, hie-bios provides `getGhcRuntimeLibDir` to obtain this path on the fl
7884
by consulting the cradle.
7985

8086
### Static binaries
87+
8188
We use the word "distributable" here because technically only the Linux builds
8289
are static. They are built by passing `--enable-executable-static` to cabal.
8390
Static binaries don't really exist on macOS, and there are issues with
8491
proprietary code being linked in on Windows. However, the `.dylib`s linked on
8592
macOS are all already provided by the system:
8693

87-
```
94+
```bash
8895
$ objdump -macho --dylibs-used haskell-language-server
8996
haskell-language-server:
90-
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
91-
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
92-
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
93-
/usr/lib/libcharset.1.dylib (compatibility version 2.0.0, current version 2.0.0)
97+
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
98+
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
99+
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
100+
/usr/lib/libcharset.1.dylib (compatibility version 2.0.0, current version 2.0.0)
94101
```
95102

96103
## The GitHub Actions workflow
104+
97105
It just kicks off a matrix of jobs varying across GHC versions and OSs, building
98106
the binaries with Cabal and extracting them from the dist-newstyle directory.
99107
The binaries are built with -O2.
@@ -120,19 +128,12 @@ its secure distribution using their hashes. We should only add new ones.*
120128

121129
To manually upload a new binary we should:
122130

123-
- Add the new tar/zip following the name conventions of existing ones
124-
- `haskell-language-server-${os}-${ghcVersion}.gz` for `Linux` and `macOS` and `haskell-language-server-Windows-${ghcVersion}.exe.zip` for `Windows`
125-
- the binary inside the gz file is named `haskell-language-server-${ghcVersion}` (with the `.exe` extension for `Windows`). Note that the binary name does not contain the `${os}` part.
126-
- Add the executable to the existing tar `haskell-language-server-${os}-${ghcVersion}.tar.gz` *locally* and upload it under a new name `haskell-language-server-${os}-${ghcVersion}-rev${n}.tar.gz` following the same schema for the binary as the previous one.
127-
- `-rev${n}` is the next revision number of the tarball, starting at 1.
128-
- we should contact users of the tarball (particularly ghcup) to notify the change
129-
130-
### Windows
131-
Currently building HLS with GHC 8.8.x on Windows is very flakey and so
132-
is not included by default in the GitHub Actions build matrix. Instead
133-
they need to be built and uploaded manually. See [this
134-
PR](https://github.com/haskell/haskell-language-server/issues/276) for
135-
more details
131+
* Add the new tar/zip following the name conventions of existing ones
132+
* `haskell-language-server-${os}-${ghcVersion}.gz` for `Linux` and `macOS` and `haskell-language-server-Windows-${ghcVersion}.exe.zip` for `Windows`
133+
* the binary inside the gz file is named `haskell-language-server-${ghcVersion}` (with the `.exe` extension for `Windows`). Note that the binary name does not contain the `${os}` part.
134+
* Add the executable to the existing tar `haskell-language-server-${os}-${ghcVersion}.tar.gz` *locally* and upload it under a new name `haskell-language-server-${os}-${ghcVersion}-rev${n}.tar.gz` following the same schema for the binary as the previous one.
135+
* `-rev${n}` is the next revision number of the tarball, starting at 1.
136+
* we should contact users of the tarball (particularly ghcup) to notify the change
136137

137138
## Hackage release workflow
138139

0 commit comments

Comments
 (0)