Skip to content

Commit

Permalink
Drop usage of the ARM64 runners
Browse files Browse the repository at this point in the history
This was a "fun" experiment, but we're not going to use these runners
any time soon for the following reasons:

1. Alpine on ARM64 doesn't support Javascript actions, which is pretty
   much all of them. This was first reported back in 2020
   (actions/runner#801), and knowing how these
   things go it's unlikely to be resolved any time soon.

2. The lack of Alpine support on ARM64 means we have to resort to a
   somewhat hacky cross-compilation approach to run tests for musl.

3. The runners are flaky and will randomly fail with Docker related
   errors, and produce a ton of permission errors
   (https://github.com/orgs/community/discussions/148648#discussioncomment-11858098).

4. Building multi-arch Docker containers is messy and requires a bunch
   of cargo-cult copy-pasting to get things to work. I don't want to
   repeat that for the nightly and stable containers _just_ so _some_
   people can use those in CI jobs.

5. We already run tests on an ARM64 macOS host, so any ARM related
   errors are bound to pop up there, making all this effort rather
   redundant.

We'll reconsider using the ARM64 runners at some point in the future
when these issues are addressed and building multi-arch containers is
made easier.
  • Loading branch information
yorickpeterse committed Jan 17, 2025
1 parent 5046f63 commit b35ed86
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 167 deletions.
52 changes: 2 additions & 50 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,7 @@ env:

jobs:
build:
name: ${{ inputs.name }}-${{ matrix.target.arch }} build
strategy:
matrix:
target:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.target.runner }}
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
Expand All @@ -33,48 +25,8 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
id: build
uses: docker/build-push-action@v5
- uses: docker/build-push-action@v5
with:
context: ci/docker/${{ inputs.name }}
platforms: linux/${{ matrix.target.arch }}
push: true
tags: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}:${{ inputs.name }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.NAMESPACE }},name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ inputs.name }}-${{ matrix.target.arch }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1

merge:
runs-on: ubuntu-24.04
needs:
- build
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-${{ inputs.name }}-*
merge-multiple: true
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- name: Create and push manifest
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create \
-t "${{ env.REGISTRY }}/${{ env.NAMESPACE }}:${{ inputs.name }}" \
$(printf '${{ env.REGISTRY }}/${{ env.NAMESPACE }}@sha256:%s ' *)
14 changes: 13 additions & 1 deletion .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,16 @@ jobs:
fedora:
uses: ./.github/workflows/container.yml
with:
name: fedora
name: 'fedora'
alpine:
uses: ./.github/workflows/container.yml
with:
name: 'alpine'
debian-amd64:
uses: ./.github/workflows/container.yml
with:
name: 'debian-amd64'
debian-arm64:
uses: ./.github/workflows/container.yml
with:
name: 'debian-arm64'
12 changes: 2 additions & 10 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,8 @@ jobs:
uses: ./.github/workflows/tests.yml

nightly-container:
strategy:
matrix:
target:
- name: linux/amd64
runner: ubuntu-24.04
- name: linux/arm64
runner: ubuntu-24.04-arm
name: ${{ matrix.target.name }} container
runs-on: ${{ matrix.target.runner }}
name: Nightly container
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
Expand All @@ -54,7 +47,6 @@ jobs:
- uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.target.name }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,8 @@ jobs:
fi
container:
strategy:
matrix:
target:
- name: linux/amd64
runner: ubuntu-24.04
- name: linux/arm64
runner: ubuntu-24.04-arm
name: ${{ matrix.target.name }} container
runs-on: ${{ matrix.target.runner }}
name: Container
runs-on: ubuntu-24.04
needs:
- docs
- runtimes
Expand All @@ -139,7 +132,6 @@ jobs:
- uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.target.name }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
74 changes: 45 additions & 29 deletions .github/workflows/runtimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,65 @@ env:
RUSTUP_TOOLCHAIN: '1.78'

jobs:
linux:
strategy:
matrix:
target:
- image: ci:fedora
arch: amd64
runner: ubuntu-24.04
- image: ci:fedora
arch: arm64
runner: ubuntu-24.04-arm
name: ${{ matrix.target.arch }}-linux
runs-on: ${{ matrix.target.runner }}
amd64-linux:
runs-on: ubuntu-24.04
container:
image: ghcr.io/inko-lang/ci:debian-amd64
steps:
- uses: actions/checkout@v4
- name: Build runtimes
run: bash ci/runtimes.sh amd64-linux
- uses: actions/upload-artifact@v4
with:
name: amd64-linux
path: tmp/runtimes/*.tar.gz
overwrite: true
retention-days: 2
compression-level: 0

arm64-linux:
runs-on: ubuntu-24.04
container:
image: ghcr.io/inko-lang/${{ matrix.target.image }}
image: ghcr.io/inko-lang/ci:debian-arm64
steps:
- uses: actions/checkout@v4
- name: Build runtimes
run: bash ci/runtimes.sh ${{ matrix.target.arch }}-linux
run: bash ci/runtimes.sh arm64-linux
- uses: actions/upload-artifact@v4
with:
name: arm64-linux
path: tmp/runtimes/*.tar.gz
overwrite: true
retention-days: 2
compression-level: 0

amd64-mac:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: ./ci/mac.sh
- name: Build runtimes
run: bash ci/runtimes.sh amd64-mac
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target.arch }}-linux
name: amd64-mac
path: tmp/runtimes/*.tar.gz
overwrite: true
retention-days: 2
compression-level: 0

mac:
strategy:
matrix:
target:
- name: amd64-mac
runner: macos-13
- name: arm64-mac
runner: macos-14
name: ${{ matrix.target.name }}
runs-on: ${{ matrix.target.runner }}
arm64-mac:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: ./ci/mac.sh
- name: Build runtimes
run: bash ci/runtimes.sh ${{ matrix.target.name }}
run: bash ci/runtimes.sh arm64-mac
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target.name }}
name: arm64-mac
path: tmp/runtimes/*.tar.gz
overwrite: true
retention-days: 2
Expand Down Expand Up @@ -90,8 +104,10 @@ jobs:
RCLONE_S3_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }}
RCLONE_S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
needs:
- linux
- mac
- amd64-linux
- arm64-linux
- amd64-mac
- arm64-mac
- amd64-freebsd
steps:
- uses: actions/checkout@v4
Expand Down
42 changes: 15 additions & 27 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ jobs:
strategy:
matrix:
target:
- name: amd64-linux-gnu
runner: ubuntu-24.04
- name: arm64-linux-gnu
runner: ubuntu-24.04-arm
- image: 'ci:fedora'
name: amd64-linux-gnu
- image: 'ci:alpine'
name: amd64-linux-musl
name: ${{ matrix.target.name }} compiler
timeout-minutes: 15
runs-on: ${{ matrix.target.runner }}
runs-on: ubuntu-24.04
container:
image: ghcr.io/inko-lang/ci:fedora
image: ghcr.io/inko-lang/${{ matrix.target.image }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
Expand All @@ -91,38 +91,25 @@ jobs:
level:
- none
- balanced
- aggressive
target:
- name: amd64-linux-gnu
runner: ubuntu-24.04
triple: x86_64-unknown-linux-gnu
- name: amd64-linux-musl
runner: ubuntu-24.04
triple: x86_64-unknown-linux-musl
- name: arm64-linux-gnu
runner: ubuntu-24.04-arm
triple: aarch64-unknown-linux-gnu
- name: arm64-linux-musl
runner: ubuntu-24.04-arm
triple: aarch64-unknown-linux-musl
- image: 'ci:fedora'
name: amd64-linux-gnu
- image: 'ci:alpine'
name: amd64-linux-musl
name: ${{ matrix.target.name }} std --opt=${{ matrix.level }}
timeout-minutes: 15
runs-on: ${{ matrix.target.runner }}
runs-on: ubuntu-24.04
container:
image: ghcr.io/inko-lang/ci:fedora
env:
# This is needed because when setting an explicit target, "ring" looks for
# `aarch64-linux-musl-gcc` instead of using `musl-gcc`.
CC_aarch64_unknown_linux_musl: musl-gcc
image: ghcr.io/inko-lang/${{ matrix.target.image }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: '${{ env.CARGO_HOME }}'
key: ${{ matrix.target.name }}-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}
- name: Build the runtime and compiler
run: ./ci/linux.sh ${{ matrix.target.name }} ${{ matrix.target.triple }}
- name: Run tests
run: 'cd std && ../target/debug/inko test --opt=${{ matrix.level }} --target=${{ matrix.target.name }}'
run: 'cd std && cargo run -- test --opt=${{ matrix.level }}'

compiler-mac:
strategy:
Expand Down Expand Up @@ -156,6 +143,7 @@ jobs:
level:
- none
- balanced
- aggressive
target:
- runner: macos-13
name: amd64-mac-native
Expand Down
15 changes: 15 additions & 0 deletions ci/docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM alpine:3

ENV LLVM_VERSION 17
ENV RUST_VERSION 1.78

ENV PATH /opt/cargo/bin:$PATH
ENV RUSTUP_HOME /opt/rustup
ENV CARGO_HOME /opt/cargo

RUN apk add --update build-base tar git rustup \
llvm$LLVM_VERSION llvm$LLVM_VERSION-dev llvm$LLVM_VERSION-static \
libstdc++-dev zlib-static zstd-static libxml2-static

RUN rustup-init --quiet -y --no-modify-path --profile minimal \
--component clippy,rustfmt --default-toolchain $RUST_VERSION
25 changes: 25 additions & 0 deletions ci/docker/debian-amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM debian:12

ENV LLVM_VERSION 17
ENV RUST_VERSION 1.78

ENV PATH /opt/cargo/bin:$PATH
ENV CARGO_HOME /opt/cargo
ENV RUSTUP_HOME /opt/rustup

RUN apt update --quiet && apt install --quiet --yes curl build-essential tar git
RUN curl https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
RUN /usr/bin/echo -e "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-$LLVM_VERSION main" \
> /etc/apt/sources.list.d/llvm$LLVM_VERSION.list

RUN apt update --quiet && apt install --quiet --yes \
llvm-$LLVM_VERSION llvm-$LLVM_VERSION-dev \
libstdc++-11-dev libclang-common-$LLVM_VERSION-dev zlib1g-dev \
libpolly-$LLVM_VERSION-dev libzstd-dev

RUN curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location \
--silent --show-error --fail "https://sh.rustup.rs" | \
sh -s -- --quiet -y --no-modify-path --profile minimal \
--component clippy,rustfmt --default-toolchain $RUST_VERSION

RUN apt install --quiet --yes musl-tools
27 changes: 27 additions & 0 deletions ci/docker/debian-arm64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM debian:12

ENV LLVM_VERSION 17
ENV RUST_VERSION 1.78

ENV PATH /opt/cargo/bin:$PATH
ENV CARGO_HOME /opt/cargo
ENV RUSTUP_HOME /opt/rustup

RUN apt update --quiet && apt install --quiet --yes curl build-essential tar git
RUN curl https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
RUN /usr/bin/echo -e "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-$LLVM_VERSION main" \
> /etc/apt/sources.list.d/llvm$LLVM_VERSION.list

RUN apt update --quiet && apt install --quiet --yes \
llvm-$LLVM_VERSION llvm-$LLVM_VERSION-dev \
libstdc++-11-dev libclang-common-$LLVM_VERSION-dev zlib1g-dev \
libpolly-$LLVM_VERSION-dev libzstd-dev

RUN curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location \
--silent --show-error --fail "https://sh.rustup.rs" | \
sh -s -- --quiet -y --no-modify-path --profile minimal \
--component clippy,rustfmt --default-toolchain $RUST_VERSION

RUN dpkg --add-architecture arm64 \
&& apt update --quiet \
&& apt install --quiet --yes gcc-aarch64-linux-gnu musl-tools:arm64
Loading

0 comments on commit b35ed86

Please sign in to comment.