GitHub Actions and Jenkins share multiple similarities, which makes migration to GitHub Actions relatively straightforward.
Jenkins and GitHub Actions both allow you to create workflows that automatically build, test, publish, release, and deploy code. Jenkins and GitHub Actions share some similarities in workflow configuration:
For more information, see Understanding GitHub Actions.
Jenkins lets you send builds to a single build agent, or you can distribute them across multiple agents. You can also classify these agents according to various attributes, such as operating system types.
Similarly, GitHub Actions can send jobs to GitHub-hosted or self-hosted runners, and you can use labels to classify runners according to various attributes. For more information, see Understanding GitHub Actions and Self-hosted runners.
Jenkins splits its Declarative Pipelines into multiple sections. Similarly, GitHub Actions organizes its workflows into separate sections. The table below compares Jenkins sections with the GitHub Actions workflow.
| Jenkins Directives | GitHub Actions |
|---|---|
agent |
jobs.<job_id>.runs-on jobs.<job_id>.container
|
post |
None |
stages |
jobs |
steps |
jobs.<job_id>.steps |
Jenkins uses directives to manage Declarative Pipelines. These directives define the characteristics of your workflow and how it will execute. The table below demonstrates how these directives map to concepts within GitHub Actions.
Jenkins can run the stages and steps in parallel, while GitHub Actions currently only runs jobs in parallel.
| Jenkins Parallel | GitHub Actions |
|---|---|
parallel |
jobs.<job_id>.strategy.max-parallel |
Both GitHub Actions and Jenkins let you use a matrix to define various system combinations.
| Jenkins | GitHub Actions |
|---|---|
axis |
strategy/matrix context
|
stages |
steps-context |
excludes |
None |
Jenkins groups steps together in stages. Each of these steps can be a script, function, or command, among others. Similarly, GitHub Actions uses jobs to execute specific groups of steps.
| Jenkins | GitHub Actions |
|---|---|
steps |
jobs.<job_id>.steps |
cron
cron
pipeline {
agent any
triggers {
cron('H/15 * * * 1-5')
}
}
cron
on:
schedule:
- cron: '*/15 * * * 1-5'
For more information about schedule events and accepted cron syntax, see Events that trigger workflows.
pipeline {
agent any
environment {
MAVEN_PATH = '/usr/local/maven'
}
}
jobs:
maven-build:
env:
MAVEN_PATH: '/usr/local/maven'
pipeline {
triggers {
upstream(
upstreamProjects: 'job1,job2',
threshold: hudson.model.Result.SUCCESS
)
}
}
jobs:
job1:
job2:
needs: job1
job3:
needs: [job1, job2]
pipeline {
agent none
stages {
stage('Run Tests') {
matrix {
axes {
axis {
name: 'PLATFORM'
values: 'macos', 'linux'
}
}
agent { label "${PLATFORM}" }
stages {
stage('test') {
tools { nodejs "node-20" }
steps {
dir("scripts/myapp") {
sh(script: "npm install -g bats")
sh(script: "bats tests")
}
}
}
}
}
}
}
}
name: demo-workflow
on:
push:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g bats
- run: bats tests
working-directory: ./scripts/myapp