From d8f6ff50634b8fd5712c613c732be84edcd17903 Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Sat, 18 Jan 2025 20:09:49 +0000 Subject: [PATCH] Move aarch64 from QEMU to native aarch64 machines --- .../Dockerfile | 35 +++++++++++++++++++ .../build-and-push.bash | 17 +++++++++ .ci-dockerfiles/cross-aarch64/Dockerfile | 31 ---------------- .../cross-aarch64/build-and-push.bash | 15 -------- .github/workflows/pr.yml | 20 +++++------ .github/workflows/stress-test-runtime.yml | 27 ++++++-------- .github/workflows/update-lib-cache.yml | 27 +++++++++++++- 7 files changed, 96 insertions(+), 76 deletions(-) create mode 100644 .ci-dockerfiles/aarch64-unknown-linux-ubuntu24.04-builder/Dockerfile create mode 100644 .ci-dockerfiles/aarch64-unknown-linux-ubuntu24.04-builder/build-and-push.bash delete mode 100644 .ci-dockerfiles/cross-aarch64/Dockerfile delete mode 100644 .ci-dockerfiles/cross-aarch64/build-and-push.bash diff --git a/.ci-dockerfiles/aarch64-unknown-linux-ubuntu24.04-builder/Dockerfile b/.ci-dockerfiles/aarch64-unknown-linux-ubuntu24.04-builder/Dockerfile new file mode 100644 index 0000000000..368f31c43a --- /dev/null +++ b/.ci-dockerfiles/aarch64-unknown-linux-ubuntu24.04-builder/Dockerfile @@ -0,0 +1,35 @@ +FROM ubuntu:24.04 + +# Keep annoying tzdata prompt from coming up +# Thanks cmake! +ENV DEBIAN_FRONTEND=noninteractive +ENV DEBCONF_NONINTERACTIVE_SEEN=true + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + apt-transport-https \ + build-essential \ + clang \ + cmake \ + git \ + libclang-rt-dev \ + lldb \ + make \ + xz-utils \ + zlib1g-dev \ + curl \ + python3-pip \ + wget \ + systemtap-sdt-dev \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get -y autoremove --purge \ + && apt-get -y clean \ + && pip3 install --break-system-packages cloudsmith-cli + +# needed for GitHub actions +RUN git config --global --add safe.directory /__w/ponyc/ponyc + +# add user pony in order to not run tests as root +RUN useradd -u 1001 -ms /bin/bash -d /home/pony -g root pony +USER pony +WORKDIR /home/pony diff --git a/.ci-dockerfiles/aarch64-unknown-linux-ubuntu24.04-builder/build-and-push.bash b/.ci-dockerfiles/aarch64-unknown-linux-ubuntu24.04-builder/build-and-push.bash new file mode 100644 index 0000000000..840a91ec87 --- /dev/null +++ b/.ci-dockerfiles/aarch64-unknown-linux-ubuntu24.04-builder/build-and-push.bash @@ -0,0 +1,17 @@ +#!/bin/bash + +set -o errexit +set -o nounset + +# +# *** You should already be logged in to GHCR when you run this *** +# + +NAME="ghcr.io/ponylang/ponyc-ci-aarch64-unknown-linux-ubuntu24.04-builder" +TODAY=$(date +%Y%m%d) +DOCKERFILE_DIR="$(dirname "$0")" +BUILDER="aarch64-builder-$(date +%s)" + +docker buildx create --use --name "${BUILDER}" +docker buildx build --platform linux/arm64 --pull -t "${NAME}:${TODAY}" --output "type=image,push=true" "${DOCKERFILE_DIR}" +docker buildx stop "${BUILDER}" diff --git a/.ci-dockerfiles/cross-aarch64/Dockerfile b/.ci-dockerfiles/cross-aarch64/Dockerfile deleted file mode 100644 index bf269ce8e9..0000000000 --- a/.ci-dockerfiles/cross-aarch64/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-ubuntu24.04-builder:20240425 - -ARG CROSS_TRIPLE=aarch64-unknown-linux-gnu -ARG CROSS_CC=aarch64-linux-gnu-gcc -ARG CROSS_CXX=aarch64-linux-gnu-g++ -ARG CROSS_CFLAGS= -ARG CROSS_CXXFLAGS= -ARG CROSS_LDFLAGS= -ARG CROSS_BITS=64 -ARG CROSS_LINKER=aarch64-linux-gnu-gcc -ARG CROSS_TUNE=cortex-a53 - -USER root - -RUN curl -L --output gcc-linearo.tar.xz "https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz" \ - && tar xJf gcc-linearo.tar.xz -C /usr/local --strip 1 \ - && aarch64-linux-gnu-gcc --version \ - && rm gcc-linearo.tar.xz \ - && curl -L --output /usr/bin/qemu-aarch64-static https://github.com/multiarch/qemu-user-static/releases/download/v5.2.0-2/qemu-aarch64-static \ - && chmod +x /usr/bin/qemu-aarch64-static \ - && apt-get update \ - && apt-get install -y --no-install-recommends \ - lldb \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get -y autoremove --purge \ - && apt-get -y clean - -RUN cmake --version - -USER pony -WORKDIR /home/pony diff --git a/.ci-dockerfiles/cross-aarch64/build-and-push.bash b/.ci-dockerfiles/cross-aarch64/build-and-push.bash deleted file mode 100644 index fcbe082995..0000000000 --- a/.ci-dockerfiles/cross-aarch64/build-and-push.bash +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset - -# -# *** You should already be logged in to GHCR when you run this *** -# - -NAME="ghcr.io/ponylang/ponyc-ci-cross-aarch64" -TODAY=$(date +%Y%m%d) -DOCKERFILE_DIR="$(dirname "$0")" - -docker build --pull -t "${NAME}:${TODAY}" "${DOCKERFILE_DIR}" -docker push "${NAME}:${TODAY}" diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0cc523ce9f..53da54ec7a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -280,13 +280,13 @@ jobs: run: make test-cross-ci config=release PONYPATH=../armv7-a/release cross_triple=arm-unknown-linux-gnueabihf cross_arch=armv7-a cross_cpu=cortex-a9 cross_linker=arm-linux-gnueabihf-gcc cross_runner="qemu-arm-static -cpu cortex-a9 -L /usr/local/arm-linux-gnueabihf/libc" aarch64-linux: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04-arm strategy: fail-fast: false matrix: include: - - image: ghcr.io/ponylang/ponyc-ci-cross-aarch64:20240427 + - image: ghcr.io/ponylang/ponyc-ci-aarch64-unknown-linux-ubuntu24.04-builder:20250118 name: aarch64 Linux glibc name: ${{ matrix.name }} @@ -313,20 +313,16 @@ jobs: key: libs-${{ matrix.image }}-${{ hashFiles('Makefile', 'CMakeLists.txt', 'lib/CMakeLists.txt') }} - name: Build Debug Runtime run: | - make configure config=debug + make configure arch=armv8-a config=debug make build config=debug - - name: Build Debug Cross-Compiled Runtime - run: make cross-libponyrt config=debug CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ arch=armv8-a cross_cflags="-march=armv8-a -mtune=cortex-a53" cross_lflags="-O3;-march=aarch64" - - name: Test with Debug Cross-Compiled Runtime - run: make test-cross-ci config=debug PONYPATH=../armv8-a/debug cross_triple=aarch64-unknown-linux-gnu cross_arch=armv8-a cross_cpu=cortex-a53 cross_linker=aarch64-linux-gnu-gcc cross_runner="qemu-aarch64-static -cpu cortex-a53 -L /usr/local/aarch64-linux-gnu/libc" + - name: Test with Debug Runtime + run: make test-ci config=debug usedebugger=lldb - name: Build Release Runtime run: | - make configure config=release + make configure arch=armv8-a config=release make build config=release - - name: Build Release Cross-Compiled Runtime - run: make cross-libponyrt config=release CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ arch=armv8-a cross_cflags="-march=armv8-a -mtune=cortex-a53" cross_lflags="-O3;-march=aarch64" - - name: Test with Release Cross-Compiled Runtime - run: make test-cross-ci config=release PONYPATH=../armv8-a/release cross_triple=aarch64-unknown-linux-gnu cross_arch=armv8-a cross_cpu=cortex-a53 cross_linker=aarch64-linux-gnu-gcc cross_runner="qemu-aarch64-static -cpu cortex-a53 -L /usr/local/aarch64-linux-gnu/libc" + - name: Test with Release Runtime + run: make test-ci config=release usedebugger=lldb x86_64-macos: runs-on: macos-13 diff --git a/.github/workflows/stress-test-runtime.yml b/.github/workflows/stress-test-runtime.yml index 1bc449d654..eabeec2c90 100644 --- a/.github/workflows/stress-test-runtime.yml +++ b/.github/workflows/stress-test-runtime.yml @@ -87,31 +87,26 @@ jobs: content: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }}failed. aarch64-linux: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04-arm strategy: fail-fast: false matrix: include: - # these don't currently use a debugger as cross compilation hasn't - # been set up to do 'run in debugger' - - image: ghcr.io/ponylang/ponyc-ci-cross-aarch64:20240427 + - image: ponyc-ci-aarch64-unknown-linux-ubuntu24.04-builder:20250118 name: aarch64-unknown-linux-ubuntu24.04 [release] - target: test-cross-stress-release - - image: ghcr.io/ponylang/ponyc-ci-cross-aarch64:20240427 + target: test-stress-release + debugger: lldb + - image: ponyc-ci-aarch64-unknown-linux-ubuntu24.04-builder:20250118 name: aarch64-unknown-linux-ubuntu24.04 [debug] - target: test-cross-stress-debug - - image: ghcr.io/ponylang/ponyc-ci-cross-aarch64:20240427 - name: aarch64-unknown-linux-ubuntu24.04 [cd] [release] - target: test-cross-stress-with-cd-release - - image: ghcr.io/ponylang/ponyc-ci-cross-aarch64:20240427 - name: aarch64-unknown-linux-ubuntu24.04 [cd] [debug] - target: test-cross-stress-with-cd-debug + target: test-stress-debug + debugger: lldb name: ${{ matrix.name }} container: image: ${{ matrix.image }} options: --user pony --cap-add=SYS_PTRACE --security-opt seccomp=unconfined + steps: - name: Checkout uses: actions/checkout@v4.1.1 @@ -132,12 +127,10 @@ jobs: key: libs-${{ matrix.image }}-${{ hashFiles('Makefile', 'CMakeLists.txt', 'lib/CMakeLists.txt') }} - name: Build Debug Runtime run: | - make configure config=debug + make configure arch=armv8-a config=debug make build config=debug - - name: Build Debug Cross-Compiled Runtime - run: make cross-libponyrt config=debug CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ arch=armv8-a cross_cflags="-march=armv8-a -mtune=cortex-a53" cross_lflags="-O3;-march=aarch64" - name: Run Stress Test - run: make ${{ matrix.target }} config=debug PONYPATH=../armv8-a/debug cross_triple=aarch64-unknown-linux-gnu cross_arch=armv8-a cross_cpu=cortex-a53 cross_linker=aarch64-linux-gnu-gcc cross_runner="qemu-aarch64-static -cpu cortex-a53 -L /usr/local/aarch64-linux-gnu/libc" + run: make ${{ matrix.target }} config=debug usedebugger='${{ matrix.debugger }}' - name: Send alert on failure if: ${{ failure() }} uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 diff --git a/.github/workflows/update-lib-cache.yml b/.github/workflows/update-lib-cache.yml index d8901692bf..c1a68a5088 100644 --- a/.github/workflows/update-lib-cache.yml +++ b/.github/workflows/update-lib-cache.yml @@ -24,7 +24,32 @@ jobs: - image: ghcr.io/ponylang/ponyc-ci-cross-arm:20240427 - image: ghcr.io/ponylang/ponyc-ci-cross-armhf:20240427 - image: ghcr.io/ponylang/ponyc-ci-cross-riscv64:20240427 - - image: ghcr.io/ponylang/ponyc-ci-cross-aarch64:20240427 + + name: ${{ matrix.image }} + container: + image: ${{ matrix.image }} + options: --user pony + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + - name: Cache Libs + id: cache-libs + uses: actions/cache@v4 + with: + path: build/libs + key: libs-${{ matrix.image }}-${{ hashFiles('Makefile', 'CMakeLists.txt', 'lib/CMakeLists.txt') }} + - name: Build Libs + if: steps.cache-libs.outputs.cache-hit != 'true' + run: make libs build_flags=-j8 + + aarch64-linux: + runs-on: ubuntu-24.04-arm + + strategy: + fail-fast: false + matrix: + include: + - image: ghcr.io/ponylang/ponyc-ci-aarch64-unknown-linux-ubuntu24.04-builder:20250118 name: ${{ matrix.image }} container: