From 8a647e1e4f5071d637ee1d7b25504cacce8e9be5 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 +++++++++ .github/workflows/pr.yml | 20 +++++------ .github/workflows/stress-test-runtime.yml | 27 ++++++-------- .github/workflows/update-lib-cache.yml | 27 +++++++++++++- 5 files changed, 96 insertions(+), 30 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 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/.github/workflows/pr.yml b/.github/workflows/pr.yml index 55d67979f8..1de0b812de 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -277,13 +277,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 }} @@ -310,20 +310,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: