GitHub Actions is a feature of GitHub which allows automated task execution in response to events such as new commits being pushed to a Pull Request. GitHub Actions allows developers to quickly set up continuous integration testing and continuous deployments without needing to maintain separate infrastructure for it. For more information about GitHub Actions in general, check out the official GitHub documentation for GitHub Actions.
Getting Started with GitHub Actions
As of March 8th, 2022, GitHub Actions are available to all users and organizations of the NC State GitHub service!
Repositories have an Actions tab at the top of the page. This tab will walk you through setting up your first workflow, and will give recommendations for workflows based on the type of code in the repository. The workflow walkthrough will result in a new commit in the repository, and will probably automatically trigger your first workflow run.
There are a lot of different types of workflows to choose from, and you are free to customize them or even write your own from scratch. We highly recommend reviewing the GitHub documentation for workflow syntax before diving too deep into customizing your workflows. The NC State GitHub Service Team does not provide support for writing or customizing workflows.
Configuring Action Runners
In order to execute a workflow, a repository must have an Action Runner available which will do the actual work described in the workflow. An Action Runner is a special piece of software running on a machine which will interact with GitHub and execute workflows when they come in. Action Runners can be registered against an individual repository, an organization, or for the whole GitHub service to use.
Once the workflow has been added to the repository, it should immediately kick off a workflow run if it was configured to execute on a push or PR. The workflow run will likely fail, stating that it was unable to locate a runner. By default, organizations are only configured to use self-hosted runners that have been registered with the organization. Please review the following GitHub documentation for self-hosted runners before setting up your own. Note that the NC State GitHub Service Team is not responsible for the maintenance, security, or support of self-hosted runners, and users who opt to set up and use a self-hosted runner do so at their own risk. It is NOT recommend to allow public repositories to use self-hosted runners which have access to sensitive resources.
The NC State GitHub Service Team offers a pool of Action Runners which are available for anyone to use; however, the organization settings must be configured to allow the repositories within the organization to use them. Navigate to the organization settings page, then select Actions on the left side. Review the Policies section and ensure that the settings are to your liking. Next scroll down to the “Self-hosted runners” section. In the box labeled “Runners shared with this organization” there should be an entry titled “Global”. Click the three dots to the right, and then “Edit repository access”. This should pop open a modal window.
Change the drop-down at the top to “All repositories”, check the box that says “Allow public repositories”, and then click “Save group”.
This will allow all your repositories in the organization to utilize the Global Action Runners provided by the NC State GitHub Service Team.
Global Action Runners
The Global Action Runners provided by the NC State GitHub Service Team are available for anyone to use. The workflows are executed in a GitHub Action Runner container, which is based on an Ubuntu base container. There is also a docker environment available within the container, which allows workflows to execute their own containers if needed.
The Global Action Runners currently have the following software available for use in workflows:
- PHP 8.1 (available via php8.1)
- PHP 8.0 (default)
- PHP 7.4 (available via php7.4)
- Composer 2.0
- NodeJS v16 / NPM
- Python 2
- Python 3 (available via python3)
- Ruby 2.7
- Java 11 (default)
- Java 8 (available at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java)
- Build Tools (gcc, make, etc)
- Google Cloud SDK (gcloud, gsutil, bq, kubectl)
- Docker v20.10.9 / Docker Compose v2.2.3
New software is added upon request, or you can make a pull request to the global actions runner repository.