I have been publishing linux-aarch64
of Neo4j-Migrations for a while now. I am unsure if there are many people using it, but one scenario is other CI/CD based on Linux ARM infrastructure in which those binaries might come in handy. Those binaries are build with GraalVM using the official setup-graalvm action from Oracle Labs.
For the above project I use the ubiquitous GitHub actions. GitHub actions supports Windows, Linux and macOS operating systems, but only on x86_64 platforms (see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources). So far I have not seen any indication that this will change in the near future.
For Linux on Arm Oracle Cloud Infrastructure (or in short OCI) offers a solution. The “Always-Free”-Cloud-Services gives you up to 4 instances of ARM Ampere A1 with 3,000 OCPU hours and 18,000 GB hours per month at the time of writing and you can sign up here. The sign up step are typical enterprise Oracle stuff, but alas, it’s free.
I’m not gonna screenshot all the steps, as I am pretty sure they have or will change over time, but this is the compute instance I set up for my purposes:
Make sure you don’t use the Oracle Linux image but something easier to deal with, like Ubuntu Linux or CentOS. I wasn’t able to setup the GitHub runner on the Oracle ones. It is currently hidden under “platform images” when you create new instance:
During creation you can either upload your own SSH public key or generate a new pair. If you do the latter, make sure to download it and store it safely, otherwise you can’t connect to the machine.
I basically followed the process and waited until the machine is ready.
Setting up the runner is dead simple and you can follow the official GitHub instructions: Adding self-hosted runners. I did this from the repository on, not from the org. I tagged the runner with “Linux” and “ARM64” like that:
GraalVM native image needs gcc and build essentials, which is the reason I needed to install them on the runner too. This is basically everything that was necessary in my case:
sudo apt-get install gcc libz-dev build-essential mkdir actions-runner && cd actions-runner curl -o actions-runner-linux-arm64-2.296.1.tar.gz -L https://github.com/actions/runner/releases/download/v2.296.1/actions-runner-linux-arm64-2.296.1.tar.gz echo "ce11e5d9c1cc299bd8a197b7807f6146fbe7494abb19765fb04664afbdb3755e actions-runner-linux-arm64-2.296.1.tar.gz" | shasum -a 256 -c tar xzf ./actions-runner-linux-arm64-2.296.1.tar.gz ./config.sh --url https://github.com/your-org/your-repo --token your-token ./run.sh sudo ./svc.sh install sudo ./svc.sh start sudo ./svc.sh status |
Please take note that the above runner version might be outdated, you’ll find fresh instructions when setting this up from your repository or organization.
Now, how to use this? Here’s my release script: release.yml; this is the relevant part:
create_native_arm_binaries: name: 'Build with Graal on ${{ matrix.os }} ARM64' strategy: fail-fast: true matrix: os: [ linux ] runs-on: - self-hosted - ${{ matrix.os }} - ARM64 |
Key being self-hosted
in the runs-on
block and the remaining, corresponding tags.
A similar approach would be feasible for macOS M1 binaries, but the only option to use them in the cloud I found was AWS with some price tag. It may or may not be worth it for your use case.
Thanks to Fabio Niephaus who brought this possibility to my attention for the first time way back in April this year.
Feature image ARMCortexA57A53.jpg.
No comments yet
One Trackback/Pingback
[…] >> Use Oracle Cloud Infrastructure Compute Instances As Custom GitHub Runners [info.michael-simons.eu] […]
Post a Comment