Skip to content

Latest commit

 

History

History
88 lines (60 loc) · 4.52 KB

CI.md

File metadata and controls

88 lines (60 loc) · 4.52 KB

Setting up the GitHub-Runner

All following commands are meant to be executed on the machine you want your GitHub Runner to run on. This guide was written and tested for a fresh install of Ubuntu 20.04.2.0 LTS.

Installation & Configuration

The following guide explains how to add a runner to a repository. If you want to add a runner to an organization or an enterprise instead, refer to Adding self-hosted runners to an organization and Adding a self-hosted runner to an enterprise, respectively.

  1. On github.com, navigate to the main page of the repository.

  2. Under your repository name, click Settings.

  3. In the left sidebar, click Actions.

  4. In the left sidebar, under "Actions", click Runners.

  5. Click New self-hosted runner.

  6. Select the operating system image (Linux) and architecture (x64) for your self hosted runner.

  7. You will see instructions showing you how to download the runner application and install it on your self-hosted runner machine. Open a shell on your self-hosted runner machine and run each shell command in the order shown. The instructions walk you through completing these tasks:

    • Downloading and extracting the self-hosted runner application.
    • Running the config script to configure the self-hosted runner application and register it with GitHub Actions. The config script requires the destination URL and an automatically-generated time-limited token to authenticate the request. When asked to choose labels for your runner, choose "self-hosted", "linux" and "x64" (should be suggested by default).
    • Running the self-hosted runner application to connect the machine to GitHub Actions.

After completing the steps to add a self-hosted runner, the runner and its status are now listed under "Runners". The self-hosted runner application must be active for the runner to accept jobs.

If you wish to run your Runner in the background you can use, for example, nohup ./run.sh &. Any output generated by the created process will be sent to nohup.out (in the same directory).

Other Installs

The following packages are required for the tasks executed by the runner:

  • VirtualBox + extension pack

    sudo apt install -y virtualbox virtualbox-ext-pack
  • Packer v1.6.3

    export VER="1.6.3"
    sudo wget https://releases.hashicorp.com/packer/${VER}/packer_${VER}_linux_amd64.zip
    sudo unzip packer_${VER}_linux_amd64.zip -d /usr/local/bin
  • Requirements for the python package cryptography

    sudo apt install -y build-essential libssl-dev libffi-dev python3-dev
  • Python pip, virtual environments and tox

    sudo apt install -y python3-pip python3-venv tox
  • (optional) cowsay + fortunes

    # optional, but it looks nice
    sudo apt install -y cowsay fortunes

Other Configuration

  • Configure the management network interface:

    vboxmanage hostonlyif create # should create vboxnet0, else adapt following lines
    vboxmanage hostonlyif ipconfig vboxnet0 --ip 192.168.56.1 --netmask 255.255.255.0
    vboxmanage dhcpserver modify --ifname vboxnet0 --disable
  • Create the /usr/share/runner-dependencies-directory and its subfolders, place the provided Windows10 Pro .iso-file in the iso-directory (Windows version used for testing: Microsoft Windows 10 Pro 10.0.19041 Build 19041) and change permissions for the entire directory:

    sudo mkdir /usr/share/runner-dependencies
    sudo mkdir /usr/share/runner-dependencies/packer_cache
    sudo mkdir /usr/share/runner-dependencies/virtual_machines
    
    sudo mv /path/to/your/Windows.iso /usr/share/runner-dependecies/packer_cache/Win10.iso
    
    sudo chmod -R 777 /usr/share/runner-dependencies/
    # necessary, otherwise the runner process will be unable to provision VMs

The .github/workflows directory

When triggered, the behavior of all Runners is defined by the contents of the .github/workflows directory, which you can find in the root-directory of your repository. As-is, the Runner will perform unit tests whenever a commit is pushed, as well as scheduled system tests. If you wish to comprehend or modify the tasks performed by the Runner, please refer to the GitHub Actions Documentation.