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
Currently, usage of GitHub Actions is limited to a small number of organizations on the NC State GitHub while we test out the feature and ensure that it will not cause problems if it were enabled for everyone. If you’d like to have your organization included in the pilot program to try out Actions, please send an email to email@example.com with the name of the organization you’d like to have Actions enabled on, and a brief description of how you anticipate using the feature.
Once your organization has been accepted into the pilot program, repositories in the organization will now 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.
The NC State GitHub Service Team offers two 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.0
- PHP 7.4 (available via php7.4)
- PHP 7.3 (available via php7.3)
- Composer 2.0
- NodeJS 14.16
- NPM 7.8
- Python 2
- Python 3 (available via python3)
- Ruby 2.7
- Java 11
- 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)
New software is added upon request, or you can make a pull request to the global actions runner repository.