CI Pipeline for Python Automation
A test suite nobody runs is documentation. This guide builds the pipeline as a shell script first - lint, format, test, coverage - watches each gate fail and get fixed, then expresses the same four commands as a GitHub Actions workflow and as a pre-commit hook. Including the YAML surprise in every workflow file ever written, and what happens when somebody uses --no-verify.
Remote Hosts and CI/CD Guide 37 of 39 Intermediate
- Control nodeUbuntu 26.04 LTS
- Python3.14.4
- requests2.34.2
- paramiko5.0.0
- TimeAbout 20 min
ruff 0.16.4, coverage 7.15.4, pytest 9.1.1, git 2.53. The workflow file targets actions/checkout@v4 and actions/setup-python@v5. coverage --fail-under exits 2, which is worth knowing before you write if [ $? -eq 1 ].
- pytest9.1.1
- PyYAML6.0.3
- boto3 / botocore1.43.78
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| RUNNER01 | 192.168.0.27 | Ubuntu 26.04 LTS | Control node - every script in this path runs here | 2 Core | 4 GB | 50 GB |
This guide includes
Use this because a test suite nobody runs is documentation. This matters because the pipeline is one shell script - the workflow file runs the same commands, and its only real difficulty is the YAML around them.
- writing the pipeline as one script, with four gates in order
- running a linter that fixes some of it itself, and a formatter with no opinion to argue with
- failing on coverage, and finding the branch nobody tested
- writing the same gates as a workflow file, and meeting the YAML trap in it
- installing a pre-commit hook, and seeing what
--no-verifycosts
Before you start
- guide 35 - the suite this runs.
- guide 5 - what gates a gate.
- guide 13 - and the reason the
on:key is not a string.
-
The project a pipeline runs against
-
One script that is the pipeline
-
Gate one, and a fix it can apply itself
-
Gate two, which has no opinion to argue with
-
Gate four, and the branch nobody tested
-
The same gates as a workflow file
-
Which is a YAML trap, not a GitHub one
-
The commands are the same commands
-
A pre-commit hook, so it fails before the push
-
And what --no-verify costs