From 7d5a37a6e4f50ac93e3bbb8acb4dbf471b67b71d Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Thu, 5 Dec 2024 23:19:33 +0800 Subject: [PATCH 1/6] Finalize aarch64 alpine support wrt #1012 --- .github/scripts/build.sh | 2 +- .github/workflows/docker.yaml | 8 ++++ .github/workflows/release.yaml | 49 +++++++++++++++++++--- docker/arm64v8/alpine/Dockerfile | 71 ++++++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 7 deletions(-) mode change 100644 => 100755 .github/scripts/build.sh create mode 100644 docker/arm64v8/alpine/Dockerfile diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh old mode 100644 new mode 100755 index 33fab012..7a286d71 --- a/.github/scripts/build.sh +++ b/.github/scripts/build.sh @@ -21,7 +21,7 @@ GHC="ghc-${GHC_VER}" # build ecabal update -build_with_cache --project-file=cabal.project.release -w "${GHC}" --enable-tests +build_with_cache --project-file=cabal.project.release -w "${GHC}" --enable-tests "$@" # set up artifacts mkdir -p out diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 8be0faaf..530e9d4b 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -110,6 +110,14 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push (Alpine) + uses: docker/build-push-action@v3 + with: + context: ./docker/arm64v8/alpine + push: true + tags: hasufell/arm64v8-alpine-haskell:3.20 + platforms: linux/arm64 + - name: Build and push (debian buster) uses: docker/build-push-action@v3 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index edc1e187..e40b2fd6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -98,10 +98,17 @@ jobs: ARTIFACT: "armv7-linux-ghcup" GHC_VER: 9.2.8 ARCH: ARM + DISTRO: Debian - os: [self-hosted, Linux, ARM64, maerwald] ARTIFACT: "aarch64-linux-ghcup" GHC_VER: 9.6.6 ARCH: ARM64 + DISTRO: Debian + - os: [self-hosted, Linux, ARM64, maerwald] + ARTIFACT: "aarch64-linux-alpine-ghcup" + GHC_VER: 9.8.4 + ARCH: ARM64 + DISTRO: Alpine steps: - name: git config run: | @@ -122,13 +129,13 @@ jobs: ARTIFACT: ${{ matrix.ARTIFACT }} ARCH: ${{ matrix.ARCH }} GHC_VER: ${{ matrix.GHC_VER }} - DISTRO: Ubuntu + DISTRO: ${{ matrix.DISTRO }} AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} S3_HOST: ${{ env.S3_HOST }} LD: ld.gold - - if: matrix.ARCH == 'ARM64' + - if: matrix.ARCH == 'ARM64' && matrix.DISTRO == 'Debian' uses: docker://hasufell/arm64v8-debian-haskell:10 name: Run build (aarch64 linux) with: @@ -137,7 +144,21 @@ jobs: ARTIFACT: ${{ matrix.ARTIFACT }} ARCH: ${{ matrix.ARCH }} GHC_VER: ${{ matrix.GHC_VER }} - DISTRO: Ubuntu + DISTRO: ${{ matrix.DISTRO }} + AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ env.S3_HOST }} + + - if: matrix.ARCH == 'ARM64' && matrix.DISTRO == 'Alpine' + uses: docker://hasufell/arm64v8-alpine-haskell:3.20 + name: Run build (aarch64 linux) + with: + args: sh -c ".github/scripts/build.sh '--ghc-options=-split-sections -optl-static'" + env: + ARTIFACT: ${{ matrix.ARTIFACT }} + ARCH: ${{ matrix.ARCH }} + GHC_VER: ${{ matrix.GHC_VER }} + DISTRO: ${{ matrix.DISTRO }} AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} S3_HOST: ${{ env.S3_HOST }} @@ -366,12 +387,17 @@ jobs: ARTIFACT: "armv7-linux-ghcup" GHC_VER: 9.2.8 ARCH: ARM - DISTRO: Ubuntu + DISTRO: Debian - os: [self-hosted, Linux, ARM64, maerwald] ARTIFACT: "aarch64-linux-ghcup" GHC_VER: 9.6.6 ARCH: ARM64 - DISTRO: Ubuntu + DISTRO: Debian + - os: [self-hosted, Linux, ARM64, maerwald] + ARTIFACT: "aarch64-linux-alpine-ghcup" + GHC_VER: 9.6.6 + ARCH: ARM64 + DISTRO: Alpine steps: - name: Checkout code @@ -396,7 +422,7 @@ jobs: DISTRO: Ubuntu LD: ld.gold - - if: matrix.ARCH == 'ARM64' + - if: matrix.ARCH == 'ARM64' && matrix.DISTRO == 'Debian' uses: docker://hasufell/arm64v8-debian-haskell:10 name: Run test (aarch64 linux) with: @@ -407,6 +433,17 @@ jobs: GHC_VER: ${{ matrix.GHC_VER }} DISTRO: Ubuntu + - if: matrix.ARCH == 'ARM64' && matrix.DISTRO == 'Alpine' + uses: docker://hasufell/arm64v8-alpine-haskell:3.20 + name: Run test (aarch64 alpine) + with: + args: sh .github/scripts/test.sh + env: + ARTIFACT: ${{ matrix.ARTIFACT }} + ARCH: ${{ matrix.ARCH }} + GHC_VER: ${{ matrix.GHC_VER }} + DISTRO: Ubuntu + - if: failure() name: Upload artifact uses: actions/upload-artifact@v3 diff --git a/docker/arm64v8/alpine/Dockerfile b/docker/arm64v8/alpine/Dockerfile new file mode 100644 index 00000000..29944836 --- /dev/null +++ b/docker/arm64v8/alpine/Dockerfile @@ -0,0 +1,71 @@ +FROM alpine:3.20 + +ENV LANG C.UTF-8 + +RUN apk add --no-cache \ + curl \ + gcc \ + g++ \ + binutils \ + binutils-gold \ + coreutils \ + bsd-compat-headers \ + gmp-dev \ + ncurses-dev \ + libffi-dev \ + make \ + xz \ + tar \ + perl \ + bash \ + diffutils \ + git \ + gzip \ + gnupg && \ + apk add --no-cache \ + zlib \ + zlib-dev \ + zlib-static \ + bzip2 \ + bzip2-dev \ + bzip2-static \ + gmp \ + gmp-dev \ + openssl-dev \ + openssl-libs-static \ + xz \ + xz-dev \ + ncurses-static + +ARG GHCUP_VERSION=0.1.30.0 +ARG GPG_KEY="7D1E8AFD1D4A16D71FADA2F2CCC85C0E40C06A8C FFEB7CE81E16A36B3E2DED6F2DE04D4E97DB64AD 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 EAF2A9A722C0C96F2B431CA511AAD8CEDEE0CAEF" + + +# install ghcup +RUN gpg --batch --keyserver keys.openpgp.org --recv-keys $GPG_KEY && \ + curl -sSfL -O https://downloads.haskell.org/~ghcup/$GHCUP_VERSION/aarch64-linux-static-ghcup-$GHCUP_VERSION && \ + curl -sSfL -O https://downloads.haskell.org/~ghcup/$GHCUP_VERSION/SHA256SUMS && \ + curl -sSfL -O https://downloads.haskell.org/~ghcup/$GHCUP_VERSION/SHA256SUMS.sig && \ + gpg --verify SHA256SUMS.sig SHA256SUMS && \ + sha256sum -c --ignore-missing SHA256SUMS && \ + mv aarch64-linux-static-ghcup-$GHCUP_VERSION /usr/bin/ghcup && \ + chmod +x /usr/bin/ghcup && \ + rm -rf SHA256SUMS SHA256SUMS.sig ~/.gnupg/public-keys.d/pubring.db.lock + +ARG GHC=9.8.4 +ARG CABAL_INSTALL=3.12.1.0 + +ENV GHCUP_CURL_OPTS="--silent" +ENV NO_COLOR=1 + +# install haskell toolchain +RUN ghcup config set gpg-setting GPGStrict && \ + ghcup --verbose install ghc --isolate=/usr --force ${GHC} && \ + ghcup --verbose install cabal --isolate=/usr/bin --force ${CABAL_INSTALL} && \ + find "/usr/lib/ghc-${GHC}/" \( -name "*_p.a" -o -name "*.p_hi" \) -type f -delete && \ + rm -rf "/usr/share/doc/ghc-${GHC}" && \ + rm -rf /tmp/ghcup* && \ + ghcup gc -p -s -c -t + +ENV PATH /root/.cabal/bin:/root/.ghcup:/root/.local/bin:$PATH + From 268816d960b3b18898de80add78f8001836dc3c5 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Fri, 6 Dec 2024 14:54:42 +0800 Subject: [PATCH 2/6] Test --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e40b2fd6..bd7ca33f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -36,7 +36,7 @@ jobs: ARCH: 32 - os: ubuntu-latest ARTIFACT: "x86_64-linux-ghcup" - GHC_VER: 9.6.6 + GHC_VER: 9.8.4 ARCH: 64 steps: - name: Checkout code From c5e9d043b787f7ba8220d3635d962b0f5c2a4897 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Wed, 11 Dec 2024 00:41:45 +0800 Subject: [PATCH 3/6] Fix aarch64 build --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bd7ca33f..ce0c1612 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -153,7 +153,7 @@ jobs: uses: docker://hasufell/arm64v8-alpine-haskell:3.20 name: Run build (aarch64 linux) with: - args: sh -c ".github/scripts/build.sh '--ghc-options=-split-sections -optl-static'" + args: sh -c ".github/scripts/build.sh '--ghc-options=-split-sections' '--enable-executable-static'" env: ARTIFACT: ${{ matrix.ARTIFACT }} ARCH: ${{ matrix.ARCH }} From 5d7f87f0d53d68bd7d981d073763de96d9c0b467 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Fri, 13 Dec 2024 12:57:15 +0800 Subject: [PATCH 4/6] Fix CI --- .github/workflows/cabal.project.yaml | 6 ++++++ .github/workflows/release.yaml | 2 +- .github/workflows/stack.yaml | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cabal.project.yaml b/.github/workflows/cabal.project.yaml index 42899c3d..a67e8d0a 100644 --- a/.github/workflows/cabal.project.yaml +++ b/.github/workflows/cabal.project.yaml @@ -38,6 +38,12 @@ jobs: with: submodules: 'true' + - if: runner.os == 'Linux' + name: Install prerequisites + run: | + sudo apt update + sudo apt install -y libbz2-dev + - name: Run build run: | env diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ce0c1612..ff54b7fe 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -395,7 +395,7 @@ jobs: DISTRO: Debian - os: [self-hosted, Linux, ARM64, maerwald] ARTIFACT: "aarch64-linux-alpine-ghcup" - GHC_VER: 9.6.6 + GHC_VER: 9.8.4 ARCH: ARM64 DISTRO: Alpine diff --git a/.github/workflows/stack.yaml b/.github/workflows/stack.yaml index 2e231d60..1b5fc59b 100644 --- a/.github/workflows/stack.yaml +++ b/.github/workflows/stack.yaml @@ -26,6 +26,12 @@ jobs: with: submodules: 'true' + - if: runner.os == 'Linux' + name: Install prerequisites + run: | + sudo apt update + sudo apt install -y libbz2-dev + - name: Run build run: | env From 6b21f79c5ec218cb58104a57f6209155d1768424 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Fri, 13 Dec 2024 14:27:46 +0800 Subject: [PATCH 5/6] Update metadata --- data/metadata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/metadata b/data/metadata index c1517b4c..dd266687 160000 --- a/data/metadata +++ b/data/metadata @@ -1 +1 @@ -Subproject commit c1517b4c60f127d935e3740fcdbec4ae34e7bbe4 +Subproject commit dd266687b0de126d0d2ea81b1b197cd6cb0f3466 From 7a39c3c369ddd297acc3794dc6e89482cbb2cc69 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Fri, 13 Dec 2024 16:06:44 +0800 Subject: [PATCH 6/6] Fix CI tests --- .github/scripts/test.sh | 3 +++ .github/workflows/release.yaml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/scripts/test.sh b/.github/scripts/test.sh index 687a1ce2..4f9cb114 100644 --- a/.github/scripts/test.sh +++ b/.github/scripts/test.sh @@ -105,6 +105,9 @@ if [ "${OS}" = "macOS" ] && [ "${ARCH}" = "ARM64" ] ; then elif [ "${OS}" = "FreeBSD" ] ; then # not enough space echo +elif [ "${OS}" = "Linux" ] && [ "${ARCH}" = "ARM64" ] && [ "${DISTRO}" = "Alpine" ]; then + # missing bindists + echo else # test installing new ghc doesn't mess with currently set GHC # https://gitlab.haskell.org/haskell/ghcup-hs/issues/7 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ff54b7fe..4f4ab0a7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -419,7 +419,7 @@ jobs: ARTIFACT: ${{ matrix.ARTIFACT }} ARCH: ${{ matrix.ARCH }} GHC_VER: ${{ matrix.GHC_VER }} - DISTRO: Ubuntu + DISTRO: ${{ matrix.DISTRO }} LD: ld.gold - if: matrix.ARCH == 'ARM64' && matrix.DISTRO == 'Debian'