diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 9e2fdc0..a00607d 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -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: @@ -24,9 +25,10 @@ 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 @@ -34,8 +36,8 @@ jobs: matrix: ghc: - 9.0.2 - - 9.2.4 - - 9.4.2 + - 9.2.5 + - 9.4.3 runs-on: ubuntu-latest steps: diff --git a/Dockerfile b/Dockerfile index 7c75dd0..d203919 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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. @@ -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. diff --git a/aws/image.yaml b/aws/image.yaml index eaf21e2..44a135f 100644 --- a/aws/image.yaml +++ b/aws/image.yaml @@ -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: @@ -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" diff --git a/aws/manifest.yaml b/aws/manifest.yaml index 979d287..360a8d2 100644 --- a/aws/manifest.yaml +++ b/aws/manifest.yaml @@ -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: