Skip to content

Commit

Permalink
Merge branch 'alpine-aarch64-2'
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Dec 14, 2024
2 parents 93dd3b9 + 7a39c3c commit 3b363c8
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .github/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/cabal.project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
53 changes: 45 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand All @@ -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:
Expand All @@ -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' '--enable-executable-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 }}
Expand Down Expand Up @@ -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.8.4
ARCH: ARM64
DISTRO: Alpine

steps:
- name: Checkout code
Expand All @@ -393,10 +419,10 @@ jobs:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Ubuntu
DISTRO: ${{ matrix.DISTRO }}
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:
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
71 changes: 71 additions & 0 deletions docker/arm64v8/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3b363c8

Please sign in to comment.