Note: GitHub-hosted runners are not currently supported on GitHub Enterprise Server. You can see more information about planned future support on the GitHub public roadmap.
Introduction
CircleCI and GitHub Actions both allow you to create workflows that automatically build, test, publish, release, and deploy code. CircleCI and GitHub Actions share some similarities in workflow configuration:
- Workflow configuration files are written in YAML and stored in the repository.
- Workflows include one or more jobs.
- Jobs include one or more steps or individual commands.
- Steps or tasks can be reused and shared with the community.
For more information, see "Core concepts for GitHub Actions."
Key differences
When migrating from CircleCI, consider the following differences:
- CircleCI’s automatic test parallelism automatically groups tests according to user-specified rules or historical timing information. This functionality is not built into GitHub Actions.
- Actions that execute in Docker containers are sensitive to permissions problems since containers have a different mapping of users. You can avoid many of these problems by not using the
USER
instruction in your Dockerfile. For more information about the Docker filesystem on GitHub Enterprise Server-hosted runners, see "About GitHub-hosted runners."
Migrating workflows and jobs
CircleCI defines workflows
in the config.yml file, which allows you to configure more than one workflow. GitHub Enterprise Server requires one workflow file per workflow, and as a consequence, does not require you to declare workflows
. You'll need to create a new workflow file for each workflow configured in config.yml.
Both CircleCI and GitHub Actions configure jobs
in the configuration file using similar syntax. If you configure any dependencies between jobs using requires
in your CircleCI workflow, you can use the equivalent GitHub Actions needs
syntax. For more information, see "Workflow syntax for GitHub Actions."
Migrating orbs to actions
Both CircleCI and GitHub Actions provide a mechanism to reuse and share tasks in a workflow. CircleCI uses a concept called orbs, written in YAML, to provide tasks that people can reuse in a workflow. GitHub Actions has powerful and flexible reusable components called actions, which you build with either JavaScript files or Docker images. You can create actions by writing custom code that interacts with your repository in any way you'd like, including integrating with GitHub Enterprise Server's APIs and any publicly available third-party API. For example, an action can publish npm modules, send SMS alerts when urgent issues are created, or deploy production-ready code. For more information, see "Creating actions."
CircleCI can reuse pieces of workflows with YAML anchors and aliases. GitHub Actions supports the most common need for reusability using matrices. For more information about matrices, see "Using a matrix for your jobs."
Using Docker images
Both CircleCI and GitHub Actions support running steps inside of a Docker image.
CircleCI provides a set of pre-built images with common dependencies. These images have the USER
set to circleci
, which causes permissions to conflict with GitHub Actions.
We recommend that you move away from CircleCI's pre-built images when you migrate to GitHub Actions. In many cases, you can use actions to install the additional dependencies you need.
For more information about the Docker filesystem, see "About GitHub-hosted runners."
For more information about the tools and packages available on GitHub-hosted runner images, see "Specifications for GitHub-hosted runners".
Using variables and secrets
CircleCI and GitHub Actions support setting variables in the configuration file and creating secrets using the CircleCI or GitHub Enterprise Server UI.
For more information, see "Variables" and "Creating and using encrypted secrets."
Caching
CircleCI and GitHub Actions provide a method to manually cache files in the configuration file.
GitHub Actions caching is only available for repositories hosted on GitHub.com or GitHub Enterprise Server 3.5 and later. For more information, see "Caching dependencies to speed up workflows."
GitHub Actions does not have an equivalent of CircleCI’s Docker Layer Caching (or DLC).
Persisting data between jobs
Both CircleCI and GitHub Actions provide mechanisms to persist data between jobs.
Below is an example in CircleCI and GitHub Actions configuration syntax.
CircleCI | GitHub Actions |
---|---|
|
|
For more information, see "Persisting workflow data using artifacts."
Using databases and service containers
Both systems enable you to include additional containers for databases, caching, or other dependencies.
In CircleCI, the first image listed in the config.yaml is the primary image used to run commands. GitHub Actions uses explicit sections: use container
for the primary container, and list additional containers in services
.
Below is an example in CircleCI and GitHub Actions configuration syntax.
CircleCI | GitHub Actions |
---|---|
|
|
For more information, see "About service containers."
Complete Example
Below is a real-world example. The left shows the actual CircleCI config.yml for the thoughtbot/administrator repository. The right shows the GitHub Actions equivalent.
CircleCI | GitHub Actions |
---|---|
|
|