Skip to content

Commit 3750d22

Browse files
authored
chore: add CI tests workflow (#37)
* chore: add ci tests and doc checks Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com> * docs: minor update Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com> * tests: added click.unstyle() to strip ANSI codes from the help output in the CLI before asserting Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com> --------- Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
1 parent 03734d9 commit 3750d22

6 files changed

Lines changed: 125 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ jobs:
2222
lint:
2323
name: Lint & Static Analysis
2424
uses: ./.github/workflows/lint.yml
25+
26+
test:
27+
name: Tests
28+
uses: ./.github/workflows/tests.yaml
29+
30+
docs:
31+
name: Docs Build
32+
uses: ./.github/workflows/docs-build.yaml

.github/workflows/docs-build.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# ===============================================================
2+
# Docs Build - Verify documentation builds without errors
3+
# ===============================================================
4+
5+
name: Docs Build
6+
7+
on:
8+
workflow_call:
9+
push:
10+
branches: ["main"]
11+
paths:
12+
- "docs/**"
13+
- ".github/workflows/docs-build.yaml"
14+
pull_request:
15+
types: [opened, synchronize, ready_for_review]
16+
branches: ["main"]
17+
paths:
18+
- "docs/**"
19+
- ".github/workflows/docs-build.yaml"
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
docs-build:
26+
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
27+
name: Hugo Build
28+
runs-on: ubuntu-latest
29+
timeout-minutes: 10
30+
31+
steps:
32+
- name: Checkout source
33+
uses: actions/checkout@v5
34+
with:
35+
submodules: recursive
36+
fetch-depth: 1
37+
38+
- name: Setup Hugo
39+
uses: peaceiris/actions-hugo@v3
40+
with:
41+
hugo-version: "latest"
42+
extended: true
43+
44+
- name: Build docs
45+
working-directory: docs
46+
run: hugo --minify
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Deploy Documentation to GitHub Pages
33
# ===============================================================
44

5-
name: Docs
5+
name: Docs Deploy
66

77
on:
88
push:

.github/workflows/tests.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# ===============================================================
2+
# Tests - Run the test suite
3+
# ===============================================================
4+
5+
name: Tests
6+
7+
on:
8+
workflow_call:
9+
push:
10+
branches: ["main"]
11+
paths:
12+
- "cpex/**"
13+
- "tests/**"
14+
- "pyproject.toml"
15+
- ".github/workflows/tests.yaml"
16+
pull_request:
17+
types: [opened, synchronize, ready_for_review]
18+
branches: ["main"]
19+
paths:
20+
- "cpex/**"
21+
- "tests/**"
22+
- "pyproject.toml"
23+
- ".github/workflows/tests.yaml"
24+
workflow_dispatch:
25+
26+
permissions:
27+
contents: read
28+
29+
jobs:
30+
test:
31+
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
python-version: ["3.11", "3.12", "3.13"]
36+
os: [ubuntu-latest]
37+
38+
name: "Python ${{ matrix.python-version }}"
39+
runs-on: ${{ matrix.os }}
40+
timeout-minutes: 30
41+
42+
steps:
43+
- name: Checkout source
44+
uses: actions/checkout@v5
45+
with:
46+
fetch-depth: 1
47+
48+
- name: Set up Python ${{ matrix.python-version }}
49+
uses: actions/setup-python@v6
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
cache: pip
53+
54+
- name: Install dependencies
55+
run: |
56+
python3 -m pip install --upgrade pip
57+
pip install -e ".[dev,all]"
58+
59+
- name: Run tests
60+
run: |
61+
PYTHONPATH=cpex pytest -n auto tests

docs/content/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type: docs
55

66
# CPEX
77

8-
**A lightweight, composable plugin framework for building extensible AI systems.**
8+
**A lightweight plugin framework for building extensible AI systems**
99

1010
CPEX lets you intercept, enforce, and extend application behavior through plugins — without modifying core logic. Define hook points in your application, write plugins that attach to them, and compose enforcement pipelines that run automatically.
1111

tests/unit/cpex/tools/test_cli.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from unittest.mock import MagicMock, patch
1313

1414
# We use typer's CliRunner for testing typer apps
15+
import click
1516
from typer.testing import CliRunner
1617

1718
# Third-Party
@@ -124,12 +125,13 @@ def test_help_exits_zero(self):
124125

125126
def test_help_contains_options(self):
126127
result = runner.invoke(app, ["bootstrap", "--help"])
127-
assert "--destination" in result.output
128-
assert "--template_type" in result.output
129-
assert "--template_url" in result.output
130-
assert "--vcs_ref" in result.output
131-
assert "--no_input" in result.output
132-
assert "--dry_run" in result.output
128+
output = click.unstyle(result.output)
129+
assert "--destination" in output
130+
assert "--template_type" in output
131+
assert "--template_url" in output
132+
assert "--vcs_ref" in output
133+
assert "--no_input" in output
134+
assert "--dry_run" in output
133135

134136

135137
class TestBootstrapDryRun:

0 commit comments

Comments
 (0)