This repository contains reusable GitHub Actions workflows and composite actions designed to standardize CI/CD processes across multiple repositories in the Eclipse OpenSOVD project.
- π Comprehensive Code Quality Checks: YAML, Python, Rust, and TOML formatting and linting
- π Automated License Headers: Automatically adds and validates Apache 2.0 license headers
- π Fast Execution: Uses modern tools like
uv,ruff, andtaplofor speed - π§ Auto-fix with Validation: Formatters fix issues automatically but fail when changes are made
- π Works Everywhere: Run the same checks locally and in CI/CD pipelines
- βοΈ Highly Configurable: Use default configs or provide your own
To use a reusable workflow, create a workflow file inside your repository (e.g., .github/workflows/ci.yml) and reference the appropriate workflow from this repository.
The checks.yml workflow provides standardized pre-commit checks and license header validation. Add the following to your .github/workflows/ci.yml:
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
checks:
uses: eclipse-opensovd/cicd-workflows/.github/workflows/checks.yml@main
with:
rust-nightly-version: "2025-07-14" # Optional, defaults to 2025-07-14
python-version: "3.13" # Optional, defaults to 3.13
pre-commit-config-path: "" # Optional, uses action's default config if not specified
copyright-text: "" # Optional, defaults to "The Contributors to Eclipse OpenSOVD (see CONTRIBUTORS)"
license: "" # Optional, defaults to "Apache-2.0"
reuse-template: "" # Optional, defaults to "opensovd"rust-nightly-version(optional): Rust nightly version to use for Rust formatting in the formatYYYY-MM-DD. Defaults to2025-07-14.python-version(optional): Python version to use for pre-commit environment. Defaults to3.13.pre-commit-config-path(optional): Path to a custom.pre-commit-config.ymlin your repository. If not provided, uses the action's default config.copyright-text(optional): Copyright holder text forreuse annotate(e.g."ACME Inc."). Defaults to"The Contributors to Eclipse OpenSOVD (see CONTRIBUTORS)".license(optional): SPDX license identifier forreuse annotate(e.g."MIT"). Defaults to"Apache-2.0".reuse-template(optional): Name of the Jinja2 template in.reuse/templates/(without.jinja2suffix). Consumer repos can provide their own template. Defaults to"opensovd".
You can also use the individual actions directly in your workflows:
Runs pre-commit hooks with standardized configuration:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: eclipse-opensovd/cicd-workflows/pre-commit-action@main
with:
python-version: "3.13" # Optional, defaults to 3.13
config-path: "" # Optional, uses action's default config if not specifiedProvides comprehensive code quality checks via uv and pre-commit. All formatters automatically fix issues and fail when changes are made.
File Validation:
- YAML syntax validation
- Merge conflict detection
- End-of-file fixer (ensures files end with a newline)
- Trailing whitespace removal
- Mixed line ending normalization
Code Formatting:
- YAML: Formatted with
yamlfmtusing basic formatter with retained line breaks - Python: Formatted with
ruff format(extremely fast Python formatter) - TOML: Formatted and linted with
taplo - Rust: Formatted with
cargo fmt(only ifCargo.tomlexists)- Long line and overflow checks
- Import order using
StdExternalCrategrouping - Import granularity using
Cratesetting
Linting:
- Python:
ruff checkfor linting and code quality
License Headers (Auto-fix):
- FSFE REUSE tool: Automatically adds and validates license headers per the REUSE Specification
reuse lintvalidates all files have proper SPDX headersreuse annotateauto-adds headers to new files with the current year
How Auto-fix Works: When a formatter makes changes to your code, the pre-commit hook fails, requiring you to review and commit the changes. This ensures:
- All code modifications are tracked in version control
- Developers can review formatting changes before committing
- CI pipelines fail if code is not properly formatted
Inputs:
python-version: Python version for pre-commit environment (default:3.13)config-path: Path to custom.pre-commit-config.yml(optional)copyright-text: Copyright holder text forreuse annotate(default:"The Contributors to Eclipse OpenSOVD (see CONTRIBUTORS)")license: SPDX license identifier forreuse annotate(default:"Apache-2.0")reuse-template: Name of Jinja2 template in.reuse/templates/(default:"opensovd")
uv is a fast Python package manager that can run Python scripts without needing to install dependencies globally.
To run pre-commit checks locally in this repository:
uv tool run pre-commit@4.2 run --all-files --config pre-commit-action/.pre-commit-config.ymlYou have two options to run the same checks locally that run in CI:
# Run with the default 'main' branch config
uv run https://raw.githubusercontent.com/eclipse-opensovd/cicd-workflows/main/run_checks.pyuv run https://raw.githubusercontent.com/eclipse-opensovd/cicd-workflows/main/run_checks.py your-branch-nameuv run https://raw.githubusercontent.com/eclipse-opensovd/cicd-workflows/main/run_checks.py --copyright="ACME Inc." --license=MIT --template=mytemplateThe script automatically fixes ruff lint violations and applies ruff formatting. In CI, issues are only reported without auto-fix.
Create a .pre-commit-config.yaml file in your repository root:
repos:
- repo: local
hooks:
- id: shared-checks
name: Shared pre-commit checks
entry: uv run https://raw.githubusercontent.com/eclipse-opensovd/cicd-workflows/main/run_checks.py
language: system
pass_filenames: falseThen install and use pre-commit normally:
# Install pre-commit hooks (runs automatically on git commit)
pre-commit install
# Run manually on all files
pre-commit run --all-files
# Run on staged files only
pre-commit runCustom Config: If you've specified a custom pre-commit-config-path in your workflow, you can run pre-commit directly:
uv tool run pre-commit@4.2 run --all-files --config .pre-commit-config.ymlRun Specific Hooks: To run only the shared checks:
pre-commit run shared-checks --all-filesInstall uv - Fast Python package manager and script runner.
Install reuse - Required for local license header validation. Install via pip install reuse.
Install Rust - Required if your project has a Cargo.toml file.