Skip to content

Compile HLS from source #16

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 27 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
22 changes: 12 additions & 10 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ on: push
jobs:
image:
strategy:
fail-fast: false
matrix:
arch:
- amd64
- arm64
ghc:
- 9.0.2
- 9.2.4
- 9.4.2
include:
- { arch: amd64, ghc: 9.0.2, hls: 1.8.0.0 }
- { arch: arm64, ghc: 9.0.2, hls: 1.8.0.0 }
- { arch: amd64, ghc: 9.2.5, hls: 85f788135175a007d3db4ac911c4115b30ab9d87 }
- { arch: arm64, ghc: 9.2.5, hls: 85f788135175a007d3db4ac911c4115b30ab9d87 }
- { arch: amd64, ghc: 9.4.3, hls: 85f788135175a007d3db4ac911c4115b30ab9d87 }
- { arch: arm64, ghc: 9.4.3, hls: 85f788135175a007d3db4ac911c4115b30ab9d87 }
runs-on: ubuntu-latest
steps:

Expand All @@ -24,18 +25,19 @@ jobs:
with:
project-name: docker-haskell-${{ matrix.arch }}
buildspec-override: aws/image.yaml
env-vars-for-codebuild: GHC_VERSION
env-vars-for-codebuild: GHC_VERSION,HLS_VERSION
env:
GHC_VERSION: ${{ matrix.ghc }}
HLS_VERSION: ${{ matrix.hls }}

manifest:
needs: image
strategy:
matrix:
ghc:
- 9.0.2
- 9.2.4
- 9.4.2
- 9.2.5
- 9.4.3
runs-on: ubuntu-latest
steps:

Expand Down
77 changes: 41 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ ARG GHCUP_VERSION=0.1.18.0
RUN \
set -o errexit -o xtrace; \
if test -n "$GHCUP_VERSION"; then \
curl --output ~/.ghcup/bin/ghcup "https://downloads.haskell.org/ghcup/$GHCUP_VERSION/$( uname --machine )-linux-ghcup-$GHCUP_VERSION"; \
chmod --verbose +x ~/.ghcup/bin/ghcup; \
ghcup --version; \
curl --output ~/.ghcup/bin/ghcup "https://downloads.haskell.org/ghcup/$GHCUP_VERSION/$( uname --machine )-linux-ghcup-$GHCUP_VERSION"; \
chmod --verbose +x ~/.ghcup/bin/ghcup; \
ghcup --version; \
fi

# Install GHC.

ARG GHC_VERSION=9.4.2
ARG GHC_VERSION=9.0.2
RUN \
set -o errexit -o xtrace; \
if test -n "$GHC_VERSION"; then \
ghcup install ghc "$GHC_VERSION" --set; \
ghcup gc --profiling-libs --share-dir; \
ghc --version; \
ghcup install ghc "$GHC_VERSION" --set; \
ghcup gc --profiling-libs --share-dir; \
ghc --version; \
fi

# Install Cabal.
Expand All @@ -69,56 +69,61 @@ ARG CABAL_VERSION=3.8.1.0
RUN \
set -o errexit -o xtrace; \
if test -n "$CABAL_VERSION"; then \
ghcup install cabal "$CABAL_VERSION" --set; \
cabal --version; \
ghcup install cabal "$CABAL_VERSION" --set; \
cabal --version; \
fi

# Install Stack.
# Configure Cabal.

ARG STACK_VERSION=2.9.1
ARG CABAL_STORE=/cabal-store
RUN \
set -o errexit -o xtrace; \
if test -n "$STACK_VERSION"; then \
ghcup install stack "$STACK_VERSION" --set; \
stack --version; \
if command -v cabal; then \
sudo mkdir --mode 0775 --parents --verbose "$CABAL_STORE"; \
sudo chown --verbose "$USER_NAME" "$CABAL_STORE"; \
sudo chgrp --verbose sudo "$CABAL_STORE"; \
cabal user-config init --augment "store-dir: $CABAL_STORE"; \
fi

# Install HLS.
# Install Stack.

ARG HLS_VERSION=1.8.0.0
ARG STACK_VERSION=2.9.1
RUN \
set -o errexit -o xtrace; \
if test -n "$HLS_VERSION"; then \
ghcup install hls "$HLS_VERSION" --set; \
ghcup gc --hls-no-ghc; \
haskell-language-server-wrapper --version; \
if test -n "$STACK_VERSION"; then \
ghcup install stack "$STACK_VERSION" --set; \
stack --version; \
fi

# Configure Cabal.
# Configure Stack.

ARG CABAL_STORE=/cabal-store
ARG STACK_ROOT=/stack-root
RUN \
set -o errexit -o xtrace; \
if command -v cabal; then \
sudo mkdir --mode 0775 --parents --verbose "$CABAL_STORE"; \
sudo chown --verbose "$USER_NAME" "$CABAL_STORE"; \
sudo chgrp --verbose sudo "$CABAL_STORE"; \
cabal user-config init --augment "store-dir: $CABAL_STORE"; \
if command -v stack; then \
sudo mkdir --mode 0775 --parents --verbose "$STACK_ROOT"; \
sudo chown --verbose "$USER_NAME" "$STACK_ROOT"; \
sudo chgrp --verbose sudo "$STACK_ROOT"; \
stack config set install-ghc --global false; \
stack config set system-ghc --global true; \
fi
ENV STACK_ROOT="$STACK_ROOT"

# Configure Stack.
# Install HLS.

ARG STACK_ROOT=/stack-root
ARG HLS_VERSION=1.8.0.0
RUN \
set -o errexit -o xtrace; \
if command -v stack; then \
sudo mkdir --mode 0775 --parents --verbose "$STACK_ROOT"; \
sudo chown --verbose "$USER_NAME" "$STACK_ROOT"; \
sudo chgrp --verbose sudo "$STACK_ROOT"; \
stack config set install-ghc --global false; \
stack config set system-ghc --global true; \
if test -n "$HLS_VERSION"; then \
if echo "$HLS_VERSION" | grep --extended-regexp --quiet '^[0-9a-f]{40}$'; then \
ghcup --verbose compile hls --cabal-update --ghc "$GHC_VERSION" --git-describe-version --git-ref "$HLS_VERSION" -- --flags=-dynamic --ghc-options='+RTS -M2G -RTS' --index-state='2022-11-11T21:44:45Z'; \
else \
ghcup install hls "$HLS_VERSION" --set; \
fi; \
ghcup gc --cache --hls-no-ghc --tmpdirs; \
rm --force --recursive --verbose /cabal-store/* ~/.cabal/{logs,packages,store}; \
haskell-language-server-wrapper --version; \
fi
ENV STACK_ROOT="$STACK_ROOT"

# Configure volumes.

Expand Down
7 changes: 5 additions & 2 deletions aws/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ env:
DOCKER_USERNAME: docker-hub-read-only:DOCKER_USERNAME
variables:
AWS_REGION: us-east-1
GHC_VERSION: 9.2.4
# These values are simply the defaults. They are typically overriden by
# the workflow in `.github/workflows/workflow.yaml`.
GHC_VERSION: 9.0.2
HLS_VERSION: 1.8.0.0
phases:
build:
commands:
Expand All @@ -24,6 +27,6 @@ phases:

- echo "$tag"

- docker build --build-arg GHC_VERSION="$GHC_VERSION" --tag "$tag" .
- docker build --build-arg GHC_VERSION="$GHC_VERSION" --build-arg HLS_VERSION="$HLS_VERSION" --tag "$tag" .

- docker push "$tag"
4 changes: 3 additions & 1 deletion aws/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ version: 0.2
env:
variables:
AWS_REGION: us-east-1
GHC_VERSION: 9.2.4
# This value is simply the default. It is typically overriden by the
# workflow in `.github/workflows/workflow.yaml`.
GHC_VERSION: 9.0.2
phases:
build:
commands:
Expand Down