Skip to content

Reusable GitHub Actions CI for Python/TypeScript with SBOM, CodeQL, Dependabot auto-merge, and PyPI publishing (OIDC Trusted Publisher). Always-green CI ready for DevSecOps.

License

Notifications You must be signed in to change notification settings

CoderDeltaLAN/ci-matrix-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

97 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

⭐ ci-matrix-starter β€” Reusable CI Workflows (Python & TypeScript)

A lean, production-ready GitHub Actions starter that ships reusable CI workflows for Python (3.11/3.12) and TypeScript/Node 20. Designed for always-green CI with strict local gates mirroring CI, CodeQL out of the box, optional SBOM generation, and guard-rails for safe merges.

Core status
CI CodeQL release Python 3.11 | 3.12 License MIT

CI & automation
Python CI (badge) TS CI (badge) auto-assign (badge) pr-labeler (badge)

Security & supply-chain
OpenSSF Scorecard supply-chain Dependabot auto-merge (badge) Publish container to GHCR (badge)

Releases & packaging
PyPI release-sbom (badge) PyPI pyversions Wheel


Repo layout

.
β”œβ”€β”€ .github/workflows/
β”‚   β”œβ”€β”€ build.yml                     # aggregator (example)
β”‚   β”œβ”€β”€ codeql.yml                    # CodeQL analysis
β”‚   β”œβ”€β”€ supply-chain.yml              # SBOM + weekly gates
β”‚   β”œβ”€β”€ release-sbom.yml              # release SBOM publish
β”‚   β”œβ”€β”€ ghcr-publish.yml              # container to GHCR (example)
β”‚   β”œβ”€β”€ release-drafter.yml           # release notes draft
β”‚   β”œβ”€β”€ auto-assign.yml               # auto-assign reviewers
β”‚   β”œβ”€β”€ labeler.yml                   # PR labeler
β”‚   β”œβ”€β”€ dependabot-automerge.yml      # auto-merge Dependabot
β”‚   β”œβ”€β”€ ts-ci.yml                     # reusable TypeScript/Node CI
β”‚   β”œβ”€β”€ py-ci.yml                     # reusable Python CI
β”‚   └── py-ci-badge.yml               # wrapper for README badge
β”œβ”€β”€ docs/
β”‚   └── screens/
β”‚       └── local-sanity.png          # terminal screenshot (example)
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts                      # minimal TS example
β”‚   └── ci_matrix_starter/            # minimal Py package
β”œβ”€β”€ tests/                            # Python tests (example)
β”œβ”€β”€ package.json                      # Node scripts
β”œβ”€β”€ pyproject.toml                    # Python tooling
└── README.md

πŸ–₯️ Operating System Compatibility βœ…

| OS               | Status |
|------------------|:------:|
| Linux            |   βœ…   |
| macOS            |   βœ…   |
| Windows (WSL2)   |   βœ…   |
| FreeBSD          |   βœ…   |
| Android (Termux) |   βœ…   |
| Containers (CI)  |   βœ…   |

πŸš€ Quick Start (consumers)

Use the reusable workflows in your repo

Create .github/workflows/ci.yml:

name: CI
on:
  pull_request:
  push:
    branches: [main]

jobs:
  # Python matrix (3.11/3.12) with strict gates
  py:
    uses: CoderDeltaLAN/ci-matrix-starter/.github/workflows/py-ci.yml@v0.1.7
    with:
      python_versions: '["3.11","3.12"]'
      run_tests: true

  # TypeScript / Node 20
  ts:
    uses: CoderDeltaLAN/ci-matrix-starter/.github/workflows/ts-ci.yml@v0.1.7

The aggregator in this repo (build.yml) shows how to orchestrate multiple reusable jobs.

Local mirror (same gates as CI)

Node / TS

npx prettier --check .
npx eslint . --max-warnings=0
npx tsc --noEmit
npm test --silent

Python

python -m pip install --upgrade pip
pip install poetry
poetry install --no-interaction
poetry run ruff check .
poetry run black --check .
PYTHONPATH=src poetry run pytest -q --cov=src --cov-fail-under=100
poetry run mypy src

πŸ“¦ What the workflows expect

TypeScript

  • package.json with test script.
  • tsconfig.json (scope sources, e.g., src/**/*.ts).
  • eslint.config.mjs (flat) and Prettier 3.
  • Node 20.x.

Python

  • pyproject.toml with dev tools (ruff, black, pytest, mypy, poetry).
  • Tests under tests/; coverage threshold via cov-min. Matrix 3.11/3.12 (customizable with python_versions).

Optional SBOM & signing

  • SBOMs (CycloneDX) available. If COSIGN_KEY & COSIGN_PASSWORD are present, images/artifacts can be signed (safe-by-default: skipped when absent).

β›³ Required checks (CI gating)

Suggested branch-protection contexts:

  • CI / build (aggregator success)
  • CodeQL Analyze / codeql

Enable linear history, dismiss stale reviews on new pushes, and auto-merge when green.


πŸ§ͺ Local Developer Workflow (mirrors CI)

# Node
npx prettier --check . && npx eslint . --max-warnings=0 && npx tsc --noEmit && npm test --silent

# Python
python -m pip install --upgrade pip && pip install poetry
poetry install --no-interaction
poetry run ruff check . && poetry run black --check .
PYTHONPATH=src poetry run pytest -q --cov=src --cov-fail-under=100
poetry run mypy src

πŸ‘¨β€πŸ’» Local sanity (screenshot)

Local sanity (pre-commit, linters and smoke tests passing)


πŸ”§ CI (GitHub Actions)

  • Reusable jobs for Python and TypeScript; call them via uses: with a tag (e.g., @v0.1.7).
  • Built-in CodeQL example.
  • Strict, fast feedback suitable for PR auto-merge when green.

Python snippet

- run: python -m pip install --upgrade pip
- run: pip install poetry
- run: poetry install --no-interaction
- run: poetry run ruff check .
- run: poetry run black --check .
- env:
    PYTHONPATH: src
  run: poetry run pytest -q
- run: poetry run mypy src

TypeScript snippet

- run: npx prettier --check .
- run: npx eslint . --max-warnings=0
- run: npx tsc --noEmit
- run: npm test --silent || echo "no tests"

πŸ—Ί When to Use This Project

  • You need ready-to-use CI for Python + TypeScript with clean defaults.
  • You want reusable workflows referenced by tag.
  • You value security (CodeQL), SBOMs, and strict gates to keep main always green.

🧩 Customization

  • Pin a release tag, e.g., @v0.1.7.
  • Adjust Python matrix: with.python_versions.
  • Toggle tests in the wrapper: with.run_tests (true/false).
  • Provide secrets to enable optional cosign signing.
  • Extend jobs by adding steps after uses:.

πŸ”’ Security

  • Code scanning via CodeQL.
  • Recommend enabling: required conversations resolved, dismiss stale reviews, signed commits, and squash merges.
  • Avoid uploading sensitive artifacts to public PRs.

πŸ™Œ Contributing

  • Small, atomic PRs using Conventional Commits.
  • Keep local & CI gates green before review.
  • Use auto-merge once checks pass.

πŸ’š Donations & Sponsorship

Support open-source: your donations keep projects clean, secure, and evolving for the global community.

Donate with PayPal


πŸ”Ž SEO Keywords

reusable github actions workflows, python typescript ci starter, node 20 eslint 9 prettier 3, ruff black mypy pytest, cyclonedx sbom cosign signing, codeql security analysis, branch protection auto merge, always green ci, monorepo friendly ci, strict local gates mirror


πŸ‘€ Author

CoderDeltaLAN (Yosvel) GitHub: https://github.com/CoderDeltaLAN


πŸ“„ License

Released under the MIT License. See LICENSE.

About

Reusable GitHub Actions CI for Python/TypeScript with SBOM, CodeQL, Dependabot auto-merge, and PyPI publishing (OIDC Trusted Publisher). Always-green CI ready for DevSecOps.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors 2

  •  
  •