ladybird/Documentation/SelfHostedRunners.md
Linus Groh bc2ebcadc0 Everywhere: Require version >= 12 for GCC host compiler
So far we've gotten away with using GCC 11 for Lagom and to compile the
toolchain, but via #15795 we discovered a compiler bug that has been
fixed in the latest version but would error the build with CI's GCC 11.
Time for an upgrade :^)

We already use ubuntu-22.04 images in most places, so this is pretty
straightforward. The only exception is Idan's self-hosted runner, which
uses Ubuntu Focal. LibJS should build fine with GCC 11, still.
2022-10-25 23:15:51 +01:00

3.2 KiB

SerenityOS self-hosted runner setup instructions

Requirements

Since these self hosted-runners are supposed to be a more performant alternative to the GitHub-provided runners, the bare minimum requirements are GitHub's own Linux runner hardware specification as well as guaranteed uptime.

As for recommended requirements, listed below are the specifications of the current SerenityOS runners, roughly matching these would eventually make running performance-regression related tests on these easier. (But this is not a hard requirement, as GitHub offers the ability to selectively choose which self-hosted runners run which workflow)

IdanHo runner:

  • Ryzen 5 3600 - 12 cores w/ KVM support
  • 64GB of RAM
  • 512GB of SSD space
This runner can be split into 2 runners with half the cores/RAM/space if needed.

Setup

These instructions assume the OS installed is Ubuntu 22.04 (Jammy), so they might not be compatible with other Linux flavours.

Install base dependencies

sudo add-apt-repository ppa:canonical-server/server-backports
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-focal-14 main'
apt update
apt install git build-essential make cmake clang-format-14 gcc-12 g++-12 libstdc++-12-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt

Force usage of GCC 12

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12

Create a new user account named 'runner'

adduser runner

Give it password-less sudo capabilities by adding the following line to /etc/sudoers:

runner ALL=(ALL) NOPASSWD:ALL

Add it to the kvm access group (if available):

adduser runner kvm

Switch to the new user and then create a workspace folder in its home directory:

mkdir actions-runner && cd actions-runner

Download the latest version of actions-runner-linux-x64 from https://github.com/rust-lang/gha-runner/releases

curl -o actions-runner-linux-x64-X.X.X.tar.gz -L https://github.com/rust-lang/gha-runner/releases/download/vX.X.X-rust1/actions-runner-linux-x64-X.X.X-rust1.tar.gz

Extract the tar archive

tar xzf ./actions-runner-linux-x64-X.X.X.tar.gz
./config.sh --url https://github.com/SerenityOS/serenity --token INSERT_SECRET_TOKEN_HERE

Configure the runner to protect against malicious PRs by adding the following line to .env:

RUST_WHITELISTED_EVENT_NAME=push

Configure the maximum runner threads by adding the following line to .env:

MAX_RUNNER_THREADS=XXX

If you are setting up multiple runners on the same machine, this setting can be used to divvy up the cores, if you're only setting up one runner, this can just be set to the server's core count

Install the runner as a service

sudo ./svc.sh install

Start the runner

sudo ./svc.sh start