This file provides guidance for Claude Code and engineers working with the CI/CD infrastructure and GitHub Actions workflows in Foundry Python Core.
This project uses a comprehensive CI/CD pipeline built on GitHub Actions with:
- Reusable workflow architecture (entry points + reusable workflows)
- Comprehensive quality gates (lint, audit, test)
- Claude Code integration (automated PR reviews)
- Scheduled security auditing
+-------------------------------------------------------------+
| ci-cd.yml (Main Orchestrator) |
| Triggered on: push, PR, workflow_dispatch |
+-------------------------------------------------------------+
| |
| +--------+ +-------+ +--------+ |
| | Lint | | Audit | | Test | |
| | (5 min)| |(3 min)| |(15 min)| |
| +---+----+ +---+---+ +---+----+ |
| | | | |
| +-----------+----------+ |
| | |
| Quality Gate Pass |
+-------------------------------------------------------------+
+-----------------------------------------------------------+
| Parallel Entry Points |
+-----------------------------------------------------------+
| claude-code-*.yml -> PR reviews |
| codeql-scheduled.yml -> Security scanning (weekly) |
| scheduled-audit-*.yml -> Security audit |
| git-conventions.yml -> Commit message validation |
| labels-sync.yml -> GitHub labels management |
+-----------------------------------------------------------+
Purpose: Orchestrate quality checks
Triggers:
pull_requesttomain- Opens PR, updates PR, reopens PRpushtomainorrelease/v*branchesworkflow_dispatch- Manual trigger
Concurrency:
group: cicd-${{ github.ref }}
cancel-in-progress: trueCancels in-progress runs for same branch
Skip Conditions:
- Commit message contains
[skip ci]
Workflow: _lint.yml
Duration: ~5 minutes
What it does:
- Ruff format check
- Ruff lint check
- PyRight type checking
- MyPy type checking
Fail conditions: Any check fails
Workflow: _audit.yml
Duration: ~3 minutes
What it does:
pip-auditfor vulnerability scanningpip-licensesfor license compliance- SBOM generation (CycloneDX + SPDX)
Fail conditions: Vulnerabilities found or non-compliant licenses
Workflow: _test.yml
Duration: ~15 minutes
What it does:
- Unit tests (parallel)
- Integration tests (parallel)
- E2E tests
- Coverage reporting (Codecov + SonarCloud)
Secrets required:
CODECOV_TOKENSONAR_TOKEN
Purpose: Code quality checks
Steps:
- Checkout code
- Setup Python + uv
- Run
mise run lint:ruff format --checkruff checkpyright
Exit on: First failure
Purpose: Security and license compliance
Steps:
- Setup environment
- Run
mise run audit:pip-auditwith JSON outputpip-licenseswith allowed list from.license-types-allowed- SBOM generation via Trivy
Artifacts:
reports/vulnerabilities.jsonreports/licenses.csvreports/sbom.json(CycloneDX)reports/sbom.spdx(SPDX)
Purpose: Run test suite with coverage
Note: This workflow does not create GitHub deployment environments, as it is designed for library projects.
Steps:
- Setup environment (Python, uv)
- Run test categories:
mise run test_unitmise run test_integrationmise run test_e2e
- Upload coverage to Codecov and SonarCloud
Purpose: Automated PR code review by Claude
Trigger: PR opened/synchronized (excluding bot PRs)
Review focus:
- Code quality
- Test coverage
- Security
- Adherence to AGENTS.md guidelines
Secrets required:
ANTHROPIC_API_KEY
Purpose: Validate branch names, commit messages, and PR titles
Trigger: PR opened/edited/synchronized/reopened
Checks:
- Branch name format (e.g.,
feat/description,fix/description) - Conventional commit format for all PR commits
- PR title format (for squash merges)
Conventional commit types:
feat:- New featurefix:- Bug fixdocs:- Documentationrefactor:- Code refactoringtest:- Test changeschore:- Maintenanceci:- CI/CD changes
Purpose: Synchronize GitHub labels from .github/labels.yml
Trigger: Push to main, manual
Features:
- Creates missing labels
- Updates existing labels
- Removes unlisted labels (optional)
Purpose: Static analysis for security vulnerabilities
Trigger: Weekly schedule (Tuesdays at 3:22 AM UTC)
What it does:
- Analyzes Python code for security vulnerabilities
- Analyzes GitHub Actions workflow files for misconfigurations
- Reports findings to GitHub Security tab
Languages scanned:
- Python (build-mode: none)
- GitHub Actions (build-mode: none)
No secrets required: Uses built-in GitHub token
Purpose: Reusable CodeQL analysis workflow
Steps:
- Checkout code
- Initialize CodeQL
- Autobuild (minimal for Python)
- Perform analysis
Permissions:
actions: readcontents: readpackages: readsecurity-events: write
Required GitHub Secrets:
Code Quality:
CODECOV_TOKEN- Codecov coverage reportingSONAR_TOKEN- SonarCloud analysis
Claude Code:
ANTHROPIC_API_KEY- Claude API access
Reproduce locally:
mise run lintCommon issues:
- Formatting:
ruff format . - Linting:
ruff check . --fix - Type errors: Check PyRight/MyPy output
Reproduce locally:
mise run test_unit
mise run test_integration
mise run test_e2eCheck CI logs:
- Go to Actions tab
- Select failed workflow
- Expand failed test job
- Review pytest output
Problem: Missing or invalid secrets
Symptoms:
- Authentication failures
- "Secret not found" errors
Solution:
- Verify secret exists in GitHub Settings > Secrets
- Check secret name matches workflow reference
- Verify secret value is correct
| Job | Duration | Notes |
|---|---|---|
| Lint | ~5 min | Ruff + PyRight + MyPy |
| Audit | ~3 min | pip-audit + licenses + SBOM |
| Test | ~15 min | Unit + integration + e2e |
| Full pipeline | ~25 min | All quality gates |
- uv dependencies: Cached via
astral-sh/setup-uvaction - Docker layers: Cached by build system
- Test matrix: Python 3.11-3.14
- Test parallelization: Via pytest-xdist
- Job parallelization: Lint, audit, test run in parallel
- Always add conventional commit messages for changelog generation
- Use PR labels to control pipeline behavior (skip long tests, etc.)
- Test locally first before pushing (
mise run lint,mise run test) - Keep PRs small for faster reviews
- Document breaking changes in PR description
- Run full test suite before merging to main
Built with operational excellence practices.