Skip to content

Setting up Github Actions

Dan Walkes edited this page Feb 4, 2023 · 33 revisions

Overview

This page details the requirements for setting up your build host to run Github Actions. Github Actions may be run on your build host or another host setup as shown below.

For build host requirements, see this page.

Initial setup

Setup automated testing for your assignment repository following the instructions at https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners.

  1. You must use a Linux (x86_64) based runner for the assignments.
  2. You must also ensure your runner machine has docker installed. See install instructions here for Ubuntu.
    • You must also configure Docker to run as a non-root user on your machine. See the Post install steps for Linux for instructions. Either reboot your machine, restart the command prompt associated with your runner, or run the newgrp command referenced in the instructions to apply group permissions.
    • Alternatively you can run this script to perform the above step docker_install.sh
  3. See instructions in the Setting up your host section of the assignment autotest repository to setup your host to run your tests outside self hosted runners.
    • Your runner should installed to a directory outside your repository, and you should not add any files associated with your self hosted runner setup to your assignment git repository.

Re-using a previously configured runner

To re-use a previously configured runner from a previous assignment you can remove it first using https://docs.github.com/en/actions/hosting-your-own-runners/removing-self-hosted-runners.

Then re-follow the instructions at https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners to add to your next assignment repository.

Using an SSH key with your runner

Assignments which use buildroot or yocto (assignments 4 and later) require a github secret to access your assignment 3 and earlier repository. This configuration must be set on each repository containing buildroot or yocto source. In other words, you must set this secret in the repository you use with buildroot or yocto build scripts.

  1. Generate an SSH key with with empty passphrase using these instructions. Tip: use a name like “aeld_id_rsa_nopassphrase” when creating.
  2. Add to your account using instructions here
  3. Copy the entire content of the private key file (including -----BEGIN RSA PRIVATE KEY----- and -----END RSA PRIVATE KEY-----) into a secret named SSH_PRIVATE_KEY using the instructions in this link

Github Runner Validation

When successfully configured, you should see a green checkbox indicating a successful check for the assignment automated tests. image

Browsing the "Actions" tab should show a successful result for the most recent commit image

Clicking on the most recent action and viewing the job logs for unit-test and/or full-test scripts should show the same result you see when running these scripts from your host build system, with all tests passing. image

Troubleshooting

SSH Access Issues

To verify your private key works with your repository clone: First use

ssh-agent

to start the SSH agent in your terminal window.

  • Then use ssh-add <path to keyfile> to add the same key you added to your github secret.
  • Finally, attempt to clone your repository using the SSH URL found in your target github repository.
  • If this works, your key should also work with github actions, provided you have included the full content of your private key file in the definition of the SSH_PRIVATE_KEY variable.
Clone this wiki locally