A test that nobody runs protects nothing. Continuous integration makes sure that API endpoints, database checks and any other defined execution run continuously and unattended, and that a failure reaches someone while the change that caused it is still fresh. I build these pipelines with GitHub Actions, and with Jenkins when the work needs a self-hosted runner.
Scheduled API test pipeline
This workflow runs the backend circuit on a schedule, with different cron expressions for different days, and uploads an HTML report:
name: API Tests
on:
schedule:
- cron: '0 7-15/2 * * 1-4' # Monday to Thursday, every two hours from 07:00 to 15:00 UTC
- cron: '0 7-12/2 * * 5' # Friday, until noon
workflow_dispatch:
jobs:
api_tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
defaults:
run:
working-directory: Jenkins-CI/backend-tests
env:
API_KEY: ${{ secrets.API_KEY }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Write the Firestore service account key # kept as a repository secret
uses: jsdaniell/create-json@v1.2.3
with:
name: "serviceAccountKey.json"
json: ${{ secrets.ACCOUNT_KEY }}
dir: 'Jenkins-CI/backend-tests'
- name: Run the API tests
run: python -m pytest --html=api_test_report.html --self-contained-html
- name: Upload the HTML report
if: always()
uses: actions/upload-artifact@v4
with:
name: api_test_report
path: Jenkins-CI/backend-tests/*.html
Design decisions
- Secrets never touch the repository. The API key and the service account key live in GitHub secrets and are injected at run time.
- Schedules follow working hours. Different cron expressions for different days keep the feedback frequent when people are around and quiet when they are not.
- A matrix for versions. Adding a Python version, or an operating system, is one line.
- The report is uploaded with
if: always(). A failed run still leaves evidence. - Manual dispatch on every workflow, so any run can be reproduced on demand.
Pipelines for AI systems
The same approach scales to LLM evaluation. A dedicated workflow runs unit tests, DeepEval, Promptfoo and a Garak vulnerability scan in parallel jobs, evaluates a deliberately vulnerable agent to prove the tests can fail, builds an HTML report and commits a daily run history. The full walkthrough is in LLM evaluation in CI/CD.
Related: backend test automation, frontend test automation and performance testing in the pipeline.
