Skip to content

Add scripts for releases and final 1.7 tweaks #2850

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 7 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ variables:

.windows_matrix: &windows_matrix
matrix:
- GHC_VERSION: 8.8.4
CABAL_PROJECT: cabal.project
- GHC_VERSION: 8.10.7
CABAL_PROJECT: cabal.project
- GHC_VERSION: 9.0.2
CABAL_PROJECT: cabal-ghc90.project
- GHC_VERSION: 9.2.1
CABAL_PROJECT: cabal-ghc92.project
- GHC_VERSION: 9.2.2
CABAL_PROJECT: cabal-ghc92.project
- GHC_VERSION: 9.2.1
CABAL_PROJECT: cabal-ghc92.project

workflow:
rules:
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/tar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ls -la out/
TARBALL_PREFIX="haskell-language-server"
case "${TARBALL_EXT}" in
zip)
HLS_VERSION="$("$CI_PROJECT_DIR/out/haskell-language-server-wrapper" --numeric-version)"
HLS_VERSION="$("$CI_PROJECT_DIR/out/haskell-language-server-8.10.7" --numeric-version)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? This will break CI once 8.10.7 is deprecated, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If hls-wrapper is compiled with 9.2.2 then the job fails because it can't find libgcc_s_seh-1.dll

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this should have been fixed upstream weeks ago.

cd out/
zip "${TARBALL_PREFIX}-${HLS_VERSION}-${TARBALL_ARCHIVE_SUFFIX}.zip" haskell-language-server-*
find . -type f ! -name '*.zip' -delete
Expand Down
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ define set_rpath
endef

hls: bindist/ghcs
for ghc in $(shell [ -e "bindist/ghcs-`uname`" ] && cat "bindist/ghcs-`uname`" || cat "bindist/ghcs") ; do \
for ghc in $(shell [ -e "bindist/ghcs-`uname -o`" ] && cat "bindist/ghcs-`uname -o`" || cat "bindist/ghcs") ; do \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it on Windows and FreeBSD, and it seems like the only way to detect mingw without a version number so I think it is OK.

$(GHCUP) -v install ghc `echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` && \
$(GHCUP) -v gc -p -s -c && \
$(MAKE) GHC_VERSION=`echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` PROJECT_FILE=`echo $$ghc | $(AWK) -F ',' '{ print $$2 }'` hls-ghc && \
Expand Down
4 changes: 4 additions & 0 deletions bindist/ghcs-Msys
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
8.10.7,cabal.project
9.0.2,cabal-ghc90.project
9.2.2,cabal-ghc92.project
9.2.1,cabal-ghc92.project
2 changes: 1 addition & 1 deletion haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ test-suite func-test
, lens
, lens-aeson
, ghcide
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
, lsp-types
, aeson
, hls-plugin-api
Expand Down
2 changes: 1 addition & 1 deletion hls-test-utils/hls-test-utils.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: hls-test-utils
version: 1.2.0.0
version: 1.3.0.0
synopsis: Utilities used in the tests of Haskell Language Server
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test-suite tests
, base >=4.12 && < 5
, filepath
, hls-alternate-number-format-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
, lsp
, QuickCheck
, regex-tdfa
Expand Down
4 changes: 2 additions & 2 deletions plugins/hls-brittany-plugin/hls-brittany-plugin.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: hls-brittany-plugin
version: 1.0.2.0
version: 1.0.2.1
synopsis: Integration with the Brittany code formatter
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
Expand Down Expand Up @@ -48,4 +48,4 @@ test-suite tests
, base
, filepath
, hls-brittany-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test-suite tests
, extra
, filepath
, hls-call-hierarchy-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
, lens
, lsp
, lsp-test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test-suite tests
, base >=4.12 && < 5
, filepath
, hls-change-type-signature-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
, lsp
, QuickCheck
, regex-tdfa
Expand Down
2 changes: 1 addition & 1 deletion plugins/hls-class-plugin/hls-class-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ test-suite tests
, base
, filepath
, hls-class-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
, lens
, lsp-types
2 changes: 1 addition & 1 deletion plugins/hls-eval-plugin/hls-eval-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ test-suite tests
, filepath
, hls-eval-plugin
, hls-plugin-api
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
, lens
, lsp-types
, text
4 changes: 2 additions & 2 deletions plugins/hls-floskell-plugin/hls-floskell-plugin.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: hls-floskell-plugin
version: 1.0.1.0
version: 1.0.1.1
synopsis: Integration with the Floskell code formatter
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
Expand Down Expand Up @@ -40,4 +40,4 @@ test-suite tests
, base
, filepath
, hls-floskell-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
2 changes: 1 addition & 1 deletion plugins/hls-fourmolu-plugin/hls-fourmolu-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ test-suite tests
, filepath
, hls-fourmolu-plugin
, hls-plugin-api
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
, lsp-test
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ test-suite tests
, base
, filepath
, hls-haddock-comments-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.2 || ^>=1.3
, text
2 changes: 1 addition & 1 deletion plugins/hls-hlint-plugin/hls-hlint-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ test-suite tests
, filepath
, hls-hlint-plugin
, hls-plugin-api
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
, lens
, lsp-types
, text
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ test-suite tests
, base
, filepath
, hls-module-name-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
4 changes: 2 additions & 2 deletions plugins/hls-ormolu-plugin/hls-ormolu-plugin.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: hls-ormolu-plugin
version: 1.0.2.0
version: 1.0.2.1
synopsis: Integration with the Ormolu code formatter
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
Expand Down Expand Up @@ -43,5 +43,5 @@ test-suite tests
, base
, filepath
, hls-ormolu-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
, lsp-types
4 changes: 2 additions & 2 deletions plugins/hls-pragmas-plugin/hls-pragmas-plugin.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: hls-pragmas-plugin
version: 1.0.2.0
version: 1.0.2.1
synopsis: Pragmas plugin for Haskell Language Server
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
Expand Down Expand Up @@ -46,7 +46,7 @@ test-suite tests
, base
, filepath
, hls-pragmas-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
, lens
, lsp-types
, text
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ test-suite tests
, text
, filepath
, hls-qualify-imported-names-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>= 1.2 || ^>=1.3
2 changes: 1 addition & 1 deletion plugins/hls-rename-plugin/hls-rename-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ test-suite tests
, filepath
, hls-plugin-api
, hls-rename-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test-suite tests
, containers
, filepath
, hls-selection-range-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.2 || ^>=1.3
, lsp
, lsp-test
, text
Expand Down
2 changes: 1 addition & 1 deletion plugins/hls-splice-plugin/hls-splice-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ test-suite tests
, base
, filepath
, hls-splice-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.2 || ^>=1.3
, text
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ test-suite tests
, base
, filepath
, hls-stylish-haskell-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
2 changes: 1 addition & 1 deletion plugins/hls-tactics-plugin/hls-tactics-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ test-suite tests
, ghcide
, hls-plugin-api
, hls-tactics-plugin
, hls-test-utils ^>=1.2
, hls-test-utils ^>=1.3
, hspec
, hspec-expectations
, lens
Expand Down
7 changes: 7 additions & 0 deletions release/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Making and uploading the Gitlab release to downloads.haskell.org

1. Run the gitlab release pipeline using https://gitlab.haskell.org/haskell/haskell-language-server/-/pipelines/new
2. Once the pipeline has completed, download the artifacts using `fetch_gitlab.py`
- For example for the `1.7.0.0` release: `python fetch_gitlab.py -p <pipeline_id> --output haskell-language-server-1.7.0.0 -r 1.7.0.0`
- Ensure all the artifacts in the output directory are accurate and add any missing/extra artifacts
3. `cd` to the output directory created in the previous step, and run `SIGNING_KEY=<your signing key> ../upload.sh`
76 changes: 76 additions & 0 deletions release/fetch_gitlab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# adapted from https://gitlab.haskell.org/bgamari/ghc-utils/-/blob/master/rel-eng/fetch-gitlab-artifacts/fetch_gitlab.py
import logging
from pathlib import Path
import subprocess
import gitlab

logging.basicConfig(level=logging.INFO)

def strip_prefix(s, prefix):
if s.startswith(prefix):
return s[len(prefix):]
else:
return None

def fetch_artifacts(release: str, pipeline_id: int,
dest_dir: Path, gl: gitlab.Gitlab):
dest_dir.mkdir(exist_ok=True)
proj = gl.projects.get('haskell/haskell-language-server')
pipeline = proj.pipelines.get(pipeline_id)
tmpdir = Path("fetch-gitlab")
tmpdir.mkdir(exist_ok=True)
for pipeline_job in pipeline.jobs.list(all=True):
if len(pipeline_job.artifacts) == 0:
logging.info(f'job {pipeline_job.name} ({pipeline_job.id}) has no artifacts')
continue

job = proj.jobs.get(pipeline_job.id)
platform = strip_prefix(job.name, 'tar-')
if not platform:
logging.info(f'Skipping {job.name} (not a tar job)')
continue
try:
destdir = tmpdir / job.name
zip_name = Path(f"{tmpdir}/{job.name}.zip")
if not zip_name.exists() or zip_name.stat().st_size == 0:
logging.info(f'downloading archive {zip_name} for job {job.name} (job {job.id})...')
with open(zip_name, 'wb') as f:
job.artifacts(streamed=True, action=f.write)

if zip_name.stat().st_size == 0:
logging.info(f'artifact archive for job {job.name} (job {job.id}) is empty')
continue

dest = dest_dir / f'haskell-language-server-{release}-{platform}.tar.xz'
if dest.exists():
logging.info(f'bindist {dest} already exists')
continue

subprocess.run(['unzip', '-bo', zip_name, '-d', destdir])
bindist_files = list(destdir.glob('*/haskell-language-server*.tar.xz'))
if len(bindist_files) == 0:
logging.warn(f'Bindist does not exist')
continue

bindist = bindist_files[0]
logging.info(f'extracted {job.name} to {dest}')
bindist.replace(dest)
except Exception as e:
logging.error(f'Error fetching job {job.name}: {e}')
pass

def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--pipeline', '-p', required=True, type=int, help="pipeline id")
parser.add_argument('--release', '-r', required=True, type=str, help="release name")
parser.add_argument('--output', '-o', type=Path, default=Path.cwd(), help="output directory")
parser.add_argument('--profile', '-P', default='haskell',
help='python-gitlab.cfg profile name')
args = parser.parse_args()
gl = gitlab.Gitlab.from_config(args.profile)
fetch_artifacts(args.release, args.pipeline,
dest_dir=args.output, gl=gl)

if __name__ == '__main__':
main()
Loading