GithubActions: Build and test on HuaweiCloud ARM64

What are the alternatives ?

Github Actions is the new favorite cloud based CI for almost every OSS project out there. But it does not support ARM64! There were plans to add such but recently this ticket has been edited and the mentioning of “ARM64” has been removed from it! Also there are many issues at https://github.com/actions/virtual-environments/issues?q=arm closed with “Azure does not support ARM64 (Linux and Mac) and we (Github) don’t have plans to support it”. Not good!

- name: Enable QEMU/binfmt
run: |
docker run --rm --privileged multiarch/qemu-user-static --credential yes --persistent yes
- uses: actions/checkout@v2
with:
path: my-project
FROM arm64v8/ubuntu:focal

COPY my-project /my-project
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y openjdk-8-jdk

ENTRYPOINT [ "/my-project/.github/scripts/build-and-test.sh" ]
- name: Build new image
run: |
docker build --pull --tag ghcr.io/${{ github.repository }}/my-project-aarch64:${{ github.sha }} \
--cache-from ghcr.io/${{ github.repository }}/my-project-aarch64 \
--file my-project/.github/dockerfiles/Dockerfile \
.
- name: Docker login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Push the image
run: docker push ghcr.io/${{ github.repository }}/my-project-aarch64:${{ github.sha }}
- name: "Install kubectl"
uses: azure/setup-kubectl@v1
- name: Setup Huawei Cloud K8S environment
uses: huaweicloud/cce-cluster-credentials@v1
with:
region: "${{ secrets.REGION }}"
access-key-id: "${{ secrets.ACCESS_KEY_ID }}"
access-key-secret: "${{ secrets.SECRET_ACCESS_KEY }}"
project-id: "${{ secrets.PROJECT_ID }}"
cluster-id: "${{ secrets.CLUSTER_ID }}"
- name: Run the Docker image
run: |-
kubectl config use-context external # HuaweiCloud specific !
kubectl run my-project-on-arm64-${{ github.run_id }} --rm -i --image ghcr.io/${{ github.repository }}/my-project-aarch64:${{ github.sha }} --restart=Never --tty=false

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store