[Avg. reading time: 6 minutes]
CICD Tools
On-Prem & Web
- Jenkins
- Circle CI
Web Based
- GitHub Actions
- GitLab
Cloud Providers
- AWS CodeBuild
- Azure DevOps
- Google Cloud Build
GitHub Actions
Free and Popular
Five Concepts
Workflows
Automated processes that contain one or more logical jobs. Entire to-do list.
Jobs
Tasks you command GitHub Action to execute. It consists of steps that GitHub Actions will execute on a runner.
Events
Trigger the execution of the job.
- on push / pull
- on schedule
- on workflow_dispatch (Manual Trigger)
Actions
Reusable commands that can be used in your config file.
https://github.com/features/actions
Runners
Remote computer that GitHub Actions uses to execute the jobs.
Github-Hosted Runners
- ubuntu-latest
- windows-latest
- macos-latest
Self-Hosted Runners
- Specific OS that Github does not offer.
- Connection to a private network/environment.
- To save costs for projects with high usage. (Enterprise plans are expensive)
YAML (Yet Another Markup Language)
YAML is a human-friendly data serialization
language for all programming languages.
https://learnxinyminutes.com/docs/yaml/
Sample
name: Multi-Event Workflow
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
manualParam:
description: 'Input for manual triggers'
required: false
default: 'Default value'
schedule:
- cron: '0 0 * * *' # Runs at 00:00 UTC every day
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
echo "Run your tests or scripts here."
echo "Manual trigger parameter value: ${{ github.event.inputs.manualParam }}"
DEMO
Multiple Runners Demo
https://github.com/gchandra10/github-actions-multiple-runners-demo
https://github.com/gchandra10/python_cicd_calculator
````<span id='footer-class'>Ver 5.5.3</span>````