mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 12:07:34 +00:00
feat: add auto-generated CI documentation pre-commit hook (#2890)
# What does this PR do? Our CI is entirely undocumented, this commit adds a README.md file with a table of the current CI and what is does --------- Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
This commit is contained in:
parent
52201612de
commit
025163d8e6
20 changed files with 140 additions and 0 deletions
22
.github/workflows/README.md
vendored
Normal file
22
.github/workflows/README.md
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Llama Stack CI
|
||||||
|
|
||||||
|
Llama Stack uses GitHub Actions for Continous Integration (CI). Below is a table detailing what CI the project includes and the purpose.
|
||||||
|
|
||||||
|
| Name | File | Purpose |
|
||||||
|
| ---- | ---- | ------- |
|
||||||
|
| Update Changelog | [changelog.yml](changelog.yml) | Creates PR for updating the CHANGELOG.md |
|
||||||
|
| Coverage Badge | [coverage-badge.yml](coverage-badge.yml) | Creates PR for updating the code coverage badge |
|
||||||
|
| Installer CI | [install-script-ci.yml](install-script-ci.yml) | Test the installation script |
|
||||||
|
| Integration Auth Tests | [integration-auth-tests.yml](integration-auth-tests.yml) | Run the integration test suite with Kubernetes authentication |
|
||||||
|
| SqlStore Integration Tests | [integration-sql-store-tests.yml](integration-sql-store-tests.yml) | Run the integration test suite with SqlStore |
|
||||||
|
| Integration Tests | [integration-tests.yml](integration-tests.yml) | Run the integration test suite with Ollama |
|
||||||
|
| Vector IO Integration Tests | [integration-vector-io-tests.yml](integration-vector-io-tests.yml) | Run the integration test suite with various VectorIO providers |
|
||||||
|
| Pre-commit | [pre-commit.yml](pre-commit.yml) | Run pre-commit checks |
|
||||||
|
| Test Llama Stack Build | [providers-build.yml](providers-build.yml) | Test llama stack build |
|
||||||
|
| Python Package Build Test | [python-build-test.yml](python-build-test.yml) | Test building the llama-stack PyPI project |
|
||||||
|
| Check semantic PR titles | [semantic-pr.yml](semantic-pr.yml) | Ensure that PR titles follow the conventional commit spec |
|
||||||
|
| Close stale issues and PRs | [stale_bot.yml](stale_bot.yml) | Run the Stale Bot action |
|
||||||
|
| Test External Providers Installed via Module | [test-external-provider-module.yml](test-external-provider-module.yml) | Test External Provider installation via Python module |
|
||||||
|
| Test External API and Providers | [test-external.yml](test-external.yml) | Test the External API and Provider mechanisms |
|
||||||
|
| Unit Tests | [unit-tests.yml](unit-tests.yml) | Run the unit test suite |
|
||||||
|
| Update ReadTheDocs | [update-readthedocs.yml](update-readthedocs.yml) | Update the Llama Stack ReadTheDocs site |
|
2
.github/workflows/changelog.yml
vendored
2
.github/workflows/changelog.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Update Changelog
|
name: Update Changelog
|
||||||
|
|
||||||
|
run-name: Creates PR for updating the CHANGELOG.md
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [published, unpublished, created, edited, deleted, released]
|
types: [published, unpublished, created, edited, deleted, released]
|
||||||
|
|
2
.github/workflows/coverage-badge.yml
vendored
2
.github/workflows/coverage-badge.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Coverage Badge
|
name: Coverage Badge
|
||||||
|
|
||||||
|
run-name: Creates PR for updating the code coverage badge
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
2
.github/workflows/install-script-ci.yml
vendored
2
.github/workflows/install-script-ci.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Installer CI
|
name: Installer CI
|
||||||
|
|
||||||
|
run-name: Test the installation script
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
|
|
2
.github/workflows/integration-auth-tests.yml
vendored
2
.github/workflows/integration-auth-tests.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Integration Auth Tests
|
name: Integration Auth Tests
|
||||||
|
|
||||||
|
run-name: Run the integration test suite with Kubernetes authentication
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
name: SqlStore Integration Tests
|
name: SqlStore Integration Tests
|
||||||
|
|
||||||
|
run-name: Run the integration test suite with SqlStore
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
2
.github/workflows/integration-tests.yml
vendored
2
.github/workflows/integration-tests.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Integration Tests
|
name: Integration Tests
|
||||||
|
|
||||||
|
run-name: Run the integration test suite with Ollama
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
name: Vector IO Integration Tests
|
name: Vector IO Integration Tests
|
||||||
|
|
||||||
|
run-name: Run the integration test suite with various VectorIO providers
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
2
.github/workflows/pre-commit.yml
vendored
2
.github/workflows/pre-commit.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Pre-commit
|
name: Pre-commit
|
||||||
|
|
||||||
|
run-name: Run pre-commit checks
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
|
|
2
.github/workflows/providers-build.yml
vendored
2
.github/workflows/providers-build.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Test Llama Stack Build
|
name: Test Llama Stack Build
|
||||||
|
|
||||||
|
run-name: Test llama stack build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|
2
.github/workflows/python-build-test.yml
vendored
2
.github/workflows/python-build-test.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Python Package Build Test
|
name: Python Package Build Test
|
||||||
|
|
||||||
|
run-name: Test building the llama-stack PyPI project
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|
2
.github/workflows/semantic-pr.yml
vendored
2
.github/workflows/semantic-pr.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Check semantic PR titles
|
name: Check semantic PR titles
|
||||||
|
|
||||||
|
run-name: Ensure that PR titles follow the conventional commit spec
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types:
|
types:
|
||||||
|
|
2
.github/workflows/stale_bot.yml
vendored
2
.github/workflows/stale_bot.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Close stale issues and PRs
|
name: Close stale issues and PRs
|
||||||
|
|
||||||
|
run-name: Run the Stale Bot action
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * *' # every day at midnight
|
- cron: '0 0 * * *' # every day at midnight
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
name: Test External Providers Installed via Module
|
name: Test External Providers Installed via Module
|
||||||
|
|
||||||
|
run-name: Test External Provider installation via Python module
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
2
.github/workflows/test-external.yml
vendored
2
.github/workflows/test-external.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Test External API and Providers
|
name: Test External API and Providers
|
||||||
|
|
||||||
|
run-name: Test the External API and Provider mechanisms
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
2
.github/workflows/unit-tests.yml
vendored
2
.github/workflows/unit-tests.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Unit Tests
|
name: Unit Tests
|
||||||
|
|
||||||
|
run-name: Run the unit test suite
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
2
.github/workflows/update-readthedocs.yml
vendored
2
.github/workflows/update-readthedocs.yml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Update ReadTheDocs
|
name: Update ReadTheDocs
|
||||||
|
|
||||||
|
run-name: Update the Llama Stack ReadTheDocs site
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
|
|
|
@ -145,6 +145,15 @@ repos:
|
||||||
echo;
|
echo;
|
||||||
exit 1;
|
exit 1;
|
||||||
} || true
|
} || true
|
||||||
|
- id: generate-ci-docs
|
||||||
|
name: Generate CI documentation
|
||||||
|
additional_dependencies:
|
||||||
|
- uv==0.7.8
|
||||||
|
entry: uv run ./scripts/gen-ci-docs.py
|
||||||
|
language: python
|
||||||
|
pass_filenames: false
|
||||||
|
require_serial: true
|
||||||
|
files: ^.github/workflows/.*$
|
||||||
|
|
||||||
ci:
|
ci:
|
||||||
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
|
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
|
||||||
|
|
77
scripts/gen-ci-docs.py
Executable file
77
scripts/gen-ci-docs.py
Executable file
|
@ -0,0 +1,77 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
REPO_ROOT = Path(__file__).parent.parent
|
||||||
|
|
||||||
|
|
||||||
|
def parse_workflow_file(file_path):
|
||||||
|
"""Parse a workflow YAML file and extract name and run-name."""
|
||||||
|
try:
|
||||||
|
with open(file_path, encoding="utf-8") as f:
|
||||||
|
content = yaml.safe_load(f)
|
||||||
|
|
||||||
|
name = content["name"]
|
||||||
|
run_name = content["run-name"]
|
||||||
|
|
||||||
|
return name, run_name
|
||||||
|
except Exception as e:
|
||||||
|
raise Exception(f"Error parsing {file_path}") from e
|
||||||
|
|
||||||
|
|
||||||
|
def generate_ci_docs():
|
||||||
|
"""Generate the CI documentation README.md file."""
|
||||||
|
|
||||||
|
# Define paths
|
||||||
|
workflows_dir = REPO_ROOT / ".github/workflows"
|
||||||
|
readme_path = workflows_dir / "README.md"
|
||||||
|
|
||||||
|
# Header section to preserve
|
||||||
|
header = """# Llama Stack CI
|
||||||
|
|
||||||
|
Llama Stack uses GitHub Actions for Continous Integration (CI). Below is a table detailing what CI the project includes and the purpose.
|
||||||
|
|
||||||
|
| Name | File | Purpose |
|
||||||
|
| ---- | ---- | ------- |
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Get all .yml files in workflows directory
|
||||||
|
yml_files = []
|
||||||
|
for file_path in workflows_dir.glob("*.yml"):
|
||||||
|
yml_files.append(file_path)
|
||||||
|
|
||||||
|
# Sort files alphabetically for consistent output
|
||||||
|
yml_files.sort(key=lambda x: x.name)
|
||||||
|
|
||||||
|
# Generate table rows
|
||||||
|
table_rows = []
|
||||||
|
for file_path in yml_files:
|
||||||
|
name, run_name = parse_workflow_file(file_path)
|
||||||
|
filename = file_path.name
|
||||||
|
|
||||||
|
# Create markdown link in the format [filename.yml](filename.yml)
|
||||||
|
file_link = f"[{filename}]({filename})"
|
||||||
|
|
||||||
|
# Create table row
|
||||||
|
row = f"| {name} | {file_link} | {run_name} |"
|
||||||
|
table_rows.append(row)
|
||||||
|
|
||||||
|
# Combine header and table rows
|
||||||
|
content = header + "\n".join(table_rows) + "\n"
|
||||||
|
|
||||||
|
# Write to README.md
|
||||||
|
with open(readme_path, "w", encoding="utf-8") as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
|
print(f"Generated {readme_path} with {len(table_rows)} workflow entries")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
generate_ci_docs()
|
Loading…
Add table
Add a link
Reference in a new issue