From 1ee56009c9120e22342c60fe58ae62d1abe21e1a Mon Sep 17 00:00:00 2001 From: David Son Date: Thu, 14 Sep 2023 17:40:24 +0000 Subject: [PATCH] Add ARM testing to workflow Signed-off-by: David Son --- .github/workflows/build.yml | 64 +++++++++++++++++++++++++++++++++++-- Dockerfile | 2 ++ 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f58906c14..8c16f673d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,8 @@ on: - 'Dockerfile' - 'integration/**' - 'scripts/**' +env: + GO_VERSION: '1.20.6' jobs: test: @@ -25,7 +27,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: '1.20.6' + go-version: ${{ env.GO_VERSION }} - run: make - run: make test integration: @@ -40,5 +42,63 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: '1.20.6' + go-version: ${{ env.GO_VERSION }} - run: make integration + + integration-arm64: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + containerd: ["1.7.0"] + arch: ["arm64"] + steps: + - uses: actions/checkout@v4 + - uses: uraimo/run-on-arch-action@v2.5.1 + id: integration-tests-arm64 + with: + arch: aarch64 + distro: ubuntu20.04 + env: | + DOCKER_BUILD_ARGS: "CONTAINERD_VERSION=${{ matrix.containerd }}" + dockerRunArgs: | + -v /tmp:/tmp + -v ${{ github.workspace }}:/soci-snapshotter + shell: /bin/bash + install: | + dpkg --add-architecture arm64 + + apt-get update + apt-get -y install curl gcc git make libz-dev wget + + wget -nv https://go.dev/dl/go${{ env.GO_VERSION }}.linux-arm64.tar.gz + rm -rf /usr/local/go && tar -C /usr/local -xzf go${{ env.GO_VERSION }}.linux-arm64.tar.gz + + curl -fsSL https://get.docker.com -o get-docker.sh + + # Force arm64 arch package installation + sed -i 's/arch=$(dpkg --print-architecture)/arch=arm64/g' get-docker.sh + sed -i 's/containerd.io/containerd.io:arm64/g' get-docker.sh + sed -i 's/pkg_version%=}/pkg_version%=}:arm64/g' get-docker.sh + sed -i 's/docker-compose-plugin/docker-compose-plugin:arm64/g' get-docker.sh + sed -i 's/docker-ce-rootless-extras$pkg_version/docker-ce-rootless-extras$pkg_version:arm64/g' get-docker.sh + sed -i 's/docker-buildx-plugin/docker-buildx-plugin:arm64/g' get-docker.sh + + sh ./get-docker.sh + + curl -SL https://github.com/docker/compose/releases/download/v2.19.0/docker-compose-linux-aarch64 -o /usr/local/bin/docker-compose + chmod +x /usr/local/bin/docker-compose + run: | + echo ${{ github.workspace }} + dpkg --add-architecture arm64 + export PATH=$PATH:/usr/local/go/bin + + uname -m + go version + docker info + docker-compose --version + containerd --version + go env + + cd /soci-snapshotter + STATIC=1 GOFLAGS="-buildvcs=false" make integration diff --git a/Dockerfile b/Dockerfile index 401550137..c37edb14d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,8 @@ ARG TARGETARCH COPY . $GOPATH/src/github.com/awslabs/soci-snapshotter ENV GOPROXY direct RUN apt-get update -y && apt-get install -y libbtrfs-dev libseccomp-dev libz-dev gcc fuse pigz +RUN if [ "$TARGETARCH" = "aarch64" ] ; then apt-get install -y glibc-static ; fi + RUN cp $GOPATH/src/github.com/awslabs/soci-snapshotter/out/soci /usr/local/bin/ && \ cp $GOPATH/src/github.com/awslabs/soci-snapshotter/out/soci-snapshotter-grpc /usr/local/bin/ && \ mkdir /etc/soci-snapshotter-grpc && \