Skip to content

Commit 7bd251a

Browse files
authored
Merge pull request #16 from acilearning/try-getting-hls-to-compile-codebuild-no-buildkit
Compile HLS from source
2 parents 08f0de6 + 9e6f4e3 commit 7bd251a

File tree

4 files changed

+61
-49
lines changed

4 files changed

+61
-49
lines changed

.github/workflows/workflow.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ on: push
33
jobs:
44
image:
55
strategy:
6+
fail-fast: false
67
matrix:
7-
arch:
8-
- amd64
9-
- arm64
10-
ghc:
11-
- 9.0.2
12-
- 9.2.4
13-
- 9.4.2
8+
include:
9+
- { arch: amd64, ghc: 9.0.2, hls: 1.8.0.0 }
10+
- { arch: arm64, ghc: 9.0.2, hls: 1.8.0.0 }
11+
- { arch: amd64, ghc: 9.2.5, hls: 85f788135175a007d3db4ac911c4115b30ab9d87 }
12+
- { arch: arm64, ghc: 9.2.5, hls: 85f788135175a007d3db4ac911c4115b30ab9d87 }
13+
- { arch: amd64, ghc: 9.4.3, hls: 85f788135175a007d3db4ac911c4115b30ab9d87 }
14+
- { arch: arm64, ghc: 9.4.3, hls: 85f788135175a007d3db4ac911c4115b30ab9d87 }
1415
runs-on: ubuntu-latest
1516
steps:
1617

@@ -24,18 +25,19 @@ jobs:
2425
with:
2526
project-name: docker-haskell-${{ matrix.arch }}
2627
buildspec-override: aws/image.yaml
27-
env-vars-for-codebuild: GHC_VERSION
28+
env-vars-for-codebuild: GHC_VERSION,HLS_VERSION
2829
env:
2930
GHC_VERSION: ${{ matrix.ghc }}
31+
HLS_VERSION: ${{ matrix.hls }}
3032

3133
manifest:
3234
needs: image
3335
strategy:
3436
matrix:
3537
ghc:
3638
- 9.0.2
37-
- 9.2.4
38-
- 9.4.2
39+
- 9.2.5
40+
- 9.4.3
3941
runs-on: ubuntu-latest
4042
steps:
4143

Dockerfile

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,20 @@ ARG GHCUP_VERSION=0.1.18.0
4747
RUN \
4848
set -o errexit -o xtrace; \
4949
if test -n "$GHCUP_VERSION"; then \
50-
curl --output ~/.ghcup/bin/ghcup "https://downloads.haskell.org/ghcup/$GHCUP_VERSION/$( uname --machine )-linux-ghcup-$GHCUP_VERSION"; \
51-
chmod --verbose +x ~/.ghcup/bin/ghcup; \
52-
ghcup --version; \
50+
curl --output ~/.ghcup/bin/ghcup "https://downloads.haskell.org/ghcup/$GHCUP_VERSION/$( uname --machine )-linux-ghcup-$GHCUP_VERSION"; \
51+
chmod --verbose +x ~/.ghcup/bin/ghcup; \
52+
ghcup --version; \
5353
fi
5454

5555
# Install GHC.
5656

57-
ARG GHC_VERSION=9.4.2
57+
ARG GHC_VERSION=9.0.2
5858
RUN \
5959
set -o errexit -o xtrace; \
6060
if test -n "$GHC_VERSION"; then \
61-
ghcup install ghc "$GHC_VERSION" --set; \
62-
ghcup gc --profiling-libs --share-dir; \
63-
ghc --version; \
61+
ghcup install ghc "$GHC_VERSION" --set; \
62+
ghcup gc --profiling-libs --share-dir; \
63+
ghc --version; \
6464
fi
6565

6666
# Install Cabal.
@@ -69,56 +69,61 @@ ARG CABAL_VERSION=3.8.1.0
6969
RUN \
7070
set -o errexit -o xtrace; \
7171
if test -n "$CABAL_VERSION"; then \
72-
ghcup install cabal "$CABAL_VERSION" --set; \
73-
cabal --version; \
72+
ghcup install cabal "$CABAL_VERSION" --set; \
73+
cabal --version; \
7474
fi
7575

76-
# Install Stack.
76+
# Configure Cabal.
7777

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

86-
# Install HLS.
88+
# Install Stack.
8789

88-
ARG HLS_VERSION=1.8.0.0
90+
ARG STACK_VERSION=2.9.1
8991
RUN \
9092
set -o errexit -o xtrace; \
91-
if test -n "$HLS_VERSION"; then \
92-
ghcup install hls "$HLS_VERSION" --set; \
93-
ghcup gc --hls-no-ghc; \
94-
haskell-language-server-wrapper --version; \
93+
if test -n "$STACK_VERSION"; then \
94+
ghcup install stack "$STACK_VERSION" --set; \
95+
stack --version; \
9596
fi
9697

97-
# Configure Cabal.
98+
# Configure Stack.
9899

99-
ARG CABAL_STORE=/cabal-store
100+
ARG STACK_ROOT=/stack-root
100101
RUN \
101102
set -o errexit -o xtrace; \
102-
if command -v cabal; then \
103-
sudo mkdir --mode 0775 --parents --verbose "$CABAL_STORE"; \
104-
sudo chown --verbose "$USER_NAME" "$CABAL_STORE"; \
105-
sudo chgrp --verbose sudo "$CABAL_STORE"; \
106-
cabal user-config init --augment "store-dir: $CABAL_STORE"; \
103+
if command -v stack; then \
104+
sudo mkdir --mode 0775 --parents --verbose "$STACK_ROOT"; \
105+
sudo chown --verbose "$USER_NAME" "$STACK_ROOT"; \
106+
sudo chgrp --verbose sudo "$STACK_ROOT"; \
107+
stack config set install-ghc --global false; \
108+
stack config set system-ghc --global true; \
107109
fi
110+
ENV STACK_ROOT="$STACK_ROOT"
108111

109-
# Configure Stack.
112+
# Install HLS.
110113

111-
ARG STACK_ROOT=/stack-root
114+
ARG HLS_VERSION=1.8.0.0
112115
RUN \
113116
set -o errexit -o xtrace; \
114-
if command -v stack; then \
115-
sudo mkdir --mode 0775 --parents --verbose "$STACK_ROOT"; \
116-
sudo chown --verbose "$USER_NAME" "$STACK_ROOT"; \
117-
sudo chgrp --verbose sudo "$STACK_ROOT"; \
118-
stack config set install-ghc --global false; \
119-
stack config set system-ghc --global true; \
117+
if test -n "$HLS_VERSION"; then \
118+
if echo "$HLS_VERSION" | grep --extended-regexp --quiet '^[0-9a-f]{40}$'; then \
119+
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'; \
120+
else \
121+
ghcup install hls "$HLS_VERSION" --set; \
122+
fi; \
123+
ghcup gc --cache --hls-no-ghc --tmpdirs; \
124+
rm --force --recursive --verbose /cabal-store/* ~/.cabal/{logs,packages,store}; \
125+
haskell-language-server-wrapper --version; \
120126
fi
121-
ENV STACK_ROOT="$STACK_ROOT"
122127

123128
# Configure volumes.
124129

aws/image.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ env:
55
DOCKER_USERNAME: docker-hub-read-only:DOCKER_USERNAME
66
variables:
77
AWS_REGION: us-east-1
8-
GHC_VERSION: 9.2.4
8+
# These values are simply the defaults. They are typically overriden by
9+
# the workflow in `.github/workflows/workflow.yaml`.
10+
GHC_VERSION: 9.0.2
11+
HLS_VERSION: 1.8.0.0
912
phases:
1013
build:
1114
commands:
@@ -24,6 +27,6 @@ phases:
2427

2528
- echo "$tag"
2629

27-
- docker build --build-arg GHC_VERSION="$GHC_VERSION" --tag "$tag" .
30+
- docker build --build-arg GHC_VERSION="$GHC_VERSION" --build-arg HLS_VERSION="$HLS_VERSION" --tag "$tag" .
2831

2932
- docker push "$tag"

aws/manifest.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ version: 0.2
22
env:
33
variables:
44
AWS_REGION: us-east-1
5-
GHC_VERSION: 9.2.4
5+
# This value is simply the default. It is typically overriden by the
6+
# workflow in `.github/workflows/workflow.yaml`.
7+
GHC_VERSION: 9.0.2
68
phases:
79
build:
810
commands:

0 commit comments

Comments
 (0)