mvp-ai's picture
download
raw
14.4 kB
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install workflow CLI dependencies
run: sudo apt-get update -qq && sudo apt-get install -y jq
- name: Install package with MCP runtime
run: python -m pip install --upgrade pip && python -m pip install -e ".[mcp]" && python -m pip install build ruff pyright pip-audit
- name: Lint core sources
run: ruff check src
- name: Type-check core sources
if: matrix.python-version == '3.12'
# Incrementally expanded while legacy Any-heavy evidence tooling is typed.
run: >-
pyright
src/aiworkstation_osi/_version.py
src/aiworkstation_osi/contracts.py
src/aiworkstation_osi/errors.py
src/aiworkstation_osi/selector_task_transport.py
src/aiworkstation_osi/release_promotion.py
src/aiworkstation_osi/alpha_bundle.py
src/aiworkstation_osi/codex_acceptance.py
src/aiworkstation_osi/evidence_readiness.py
src/aiworkstation_osi/hosted_evidence_readiness.py
src/aiworkstation_osi/hosted_public_remote_evidence.py
src/aiworkstation_osi/plugin_validation.py
src/aiworkstation_osi/release_readiness.py
src/aiworkstation_osi/remote_smoke.py
src/aiworkstation_osi/http_provider.py
src/aiworkstation_osi/full_radar_provider.py
src/aiworkstation_osi/strict_http_provider.py
src/aiworkstation_osi/mcp_server.py
src/aiworkstation_osi/fixture_validation.py
src/aiworkstation_osi/fixture_replay.py
src/aiworkstation_osi/probe.py
- name: Audit runtime dependencies
if: matrix.python-version == '3.12'
run: pip-audit . --strict
- name: Compile Python sources
run: python -m compileall -q src tests
- name: Validate JSON artifacts
run: |
python -m json.tool .codex-plugin/plugin.json >/dev/null
python -m json.tool .agents/plugins/marketplace.json >/dev/null
python -m json.tool schemas/tool-manifest.json >/dev/null
python -m json.tool schemas/hosted-tool-manifest.json >/dev/null
python -m json.tool schemas/tool-result.schema.json >/dev/null
python -m json.tool schemas/error.schema.json >/dev/null
python -m json.tool evals/cases.json >/dev/null
python -m json.tool evals/plugin-cases.json >/dev/null
- name: Run unit and in-memory MCP tests
run: python -m unittest discover -s tests -v
- name: Validate plugin package
run: osi-validate-plugin --root .
- name: Evaluate repository code readiness
run: |
set -euo pipefail
mkdir -p tmp
osi-readiness --root . --output tmp/readiness.json
python - <<'PY'
import json
from pathlib import Path
report = json.loads(Path("tmp/readiness.json").read_text(encoding="utf-8"))
if report.get("code_ready") is not True:
raise SystemExit(f"code readiness failed: {report.get('code_blockers')}")
if report.get("external_alpha_ready") is not False:
raise SystemExit("ordinary CI must not attest external-alpha evidence")
if report.get("hosted_private_alpha_ready") is not False:
raise SystemExit("ordinary CI must not attest hosted-private-alpha evidence")
PY
- name: Build deterministic one-Skill alpha bundle
run: |
set -euo pipefail
osi-build-alpha --root . --output-dir tmp/alpha-bundle
(
cd tmp/alpha-bundle
sha256sum --check SHA256SUMS
)
python - <<'PY'
import json
import zipfile
from pathlib import Path
root = Path("tmp/alpha-bundle")
report = json.loads((root / "bundle-report.json").read_text(encoding="utf-8"))
archive = Path(report["archive"])
if not archive.is_absolute():
archive = Path.cwd() / archive
with zipfile.ZipFile(archive) as bundle:
names = set(bundle.namelist())
required = {
"BUNDLE-MANIFEST.json",
".codex-plugin/plugin.json",
".agents/plugins/marketplace.json",
"skills/ai-open-source-intelligence/SKILL.md",
"skills/ai-open-source-intelligence/agents/openai.yaml",
"docs/evidence-readiness.md",
"examples/codex-config.toml",
"SECURITY.md",
"PRIVACY.md",
"SUPPORT.md",
}
missing = sorted(required - names)
legacy_skills = sorted(name for name in names if name.startswith("product-skills/"))
forbidden = sorted(
name for name in names
if name.startswith("src/") or name == "pyproject.toml"
)
if missing or legacy_skills or forbidden:
raise SystemExit(
f"invalid alpha archive: missing={missing} "
f"legacy_skills={legacy_skills} forbidden={forbidden}"
)
PY
- name: Build and clean-install wheel smoke
if: matrix.python-version == '3.12'
run: |
set -euo pipefail
python -m build --wheel --outdir tmp/wheel-smoke
wheel_env="$(mktemp -d)"
python -m venv "$wheel_env"
"$wheel_env/bin/python" -m pip install --upgrade pip
"$wheel_env/bin/python" -m pip install "tmp/wheel-smoke/"*.whl "mcp>=2,<3"
WHEEL_ENV="$wheel_env" PYTHONPATH='' python - <<'PY'
import json
import os
import subprocess
from pathlib import Path
env = os.environ.copy()
wheel_python = str(Path(env["WHEEL_ENV"]) / "bin" / "python")
code = """
import asyncio
import aiworkstation_osi
from aiworkstation_osi.mcp_server import build_mcp_server
from mcp import Client
assert aiworkstation_osi.__version__ == "0.3.3"
async def check():
async with Client(build_mcp_server()) as client:
tools = await client.list_tools()
assert len(tools.tools) == 9
assert {tool.name for tool in tools.tools} == set(aiworkstation_osi.TOOL_NAMES)
asyncio.run(check())
"""
subprocess.run([wheel_python, "-c", code], check=True, env=env)
PY
- name: Smoke test local commands
run: |
osi-m0 provider-info >/dev/null
osi-m0 list-tools >/dev/null
osi-m0 invoke search_ai_projects --arguments '{"query":"self-hosted RAG"}' >/dev/null
osi-mcp-http --check-config >/dev/null
osi-mcp-hosted --help >/dev/null
osi-remote-smoke --help >/dev/null
osi-probe --help >/dev/null
osi-capture-contracts --help >/dev/null
osi-validate-contracts --help >/dev/null
osi-replay-contracts --help >/dev/null
osi-validate-plugin --help >/dev/null
osi-build-alpha --help >/dev/null
osi-readiness --help >/dev/null
osi-codex-acceptance --help >/dev/null
osi-evidence-readiness --help >/dev/null
osi-hosted-evidence-readiness --help >/dev/null
python -c 'from aiworkstation_osi.mcp_server import mcp; assert mcp is not None'
- name: Validate public Hosted data-only configuration
if: matrix.python-version == '3.12'
env:
OSI_PROVIDER: http
OSI_HOSTED_ACCESS_MODE: public
AIWORKSTATION_RADAR_BASE_URL: https://aiworkstation.cn
OSI_RELEASE_COMMIT: ${{ github.sha }}
OSI_IMAGE_COMMIT: ${{ github.sha }}
OSI_MCP_HTTP_HOST: 0.0.0.0
OSI_MCP_HTTP_PORT: "8000"
OSI_MCP_HTTP_PUBLIC_BIND_ACK: reverse-proxy-or-private-network
OSI_MCP_HTTP_ALLOWED_HOSTS: mcp.example.com,mcp.example.com:*
OSI_MCP_HTTP_MAX_REQUEST_BODY_BYTES: "262144"
run: |
set -euo pipefail
osi-mcp-hosted --check-config >tmp/hosted-public-config.json
python - <<'PY'
import json
import os
from pathlib import Path
payload = json.loads(Path("tmp/hosted-public-config.json").read_text(encoding="utf-8"))
assert payload["release_commit"] == os.environ["GITHUB_SHA"]
assert payload["mode"] == "hosted-public"
assert payload["access_mode"] == "public"
assert payload["tool_count"] == 9
assert payload["premium_enabled"] is False
assert payload["server_model_enabled"] is False
assert payload["oauth_enabled"] is False
assert "oauth_issuer" not in payload
assert "backend_origin" not in payload
PY
- name: Reject OAuth or Premium Hosted runtime switch
if: matrix.python-version == '3.12'
env:
OSI_PROVIDER: http
OSI_HOSTED_ACCESS_MODE: oauth
AIWORKSTATION_RADAR_BASE_URL: https://aiworkstation.cn
OSI_RELEASE_COMMIT: ${{ github.sha }}
OSI_IMAGE_COMMIT: ${{ github.sha }}
OSI_MCP_HTTP_HOST: 0.0.0.0
OSI_MCP_HTTP_PORT: "8000"
OSI_MCP_HTTP_PUBLIC_BIND_ACK: reverse-proxy-or-private-network
OSI_MCP_HTTP_ALLOWED_HOSTS: mcp.example.com,mcp.example.com:*
OSI_MCP_HTTP_MAX_REQUEST_BODY_BYTES: "262144"
run: |
set -euo pipefail
if osi-mcp-hosted --check-config >tmp/hosted-oauth-rejected.json; then
echo "OAuth Hosted mode unexpectedly succeeded" >&2
cat tmp/hosted-oauth-rejected.json >&2
exit 1
fi
grep -qi 'disabled' tmp/hosted-oauth-rejected.json
- name: End-to-end Streamable HTTP MCP round trip
if: matrix.python-version == '3.12'
env:
OSI_PROVIDER: mock
OSI_MCP_HTTP_HOST: 127.0.0.1
OSI_MCP_HTTP_PORT: "8765"
run: |
set -euo pipefail
mkdir -p tmp
osi-mcp-http >tmp/mcp-http.log 2>&1 &
server_pid=$!
cleanup() {
kill "$server_pid" 2>/dev/null || true
wait "$server_pid" 2>/dev/null || true
}
trap cleanup EXIT
python - <<'PY'
import socket
import time
deadline = time.monotonic() + 15
while True:
try:
with socket.create_connection(("127.0.0.1", 8765), timeout=1):
break
except OSError:
if time.monotonic() >= deadline:
raise SystemExit("Streamable HTTP MCP server did not become ready")
time.sleep(0.2)
PY
if ! osi-remote-smoke \
--url http://127.0.0.1:8765/mcp \
--invoke-search \
--locale en \
--output tmp/mcp-http-smoke.json; then
cat tmp/mcp-http.log >&2
exit 1
fi
- name: Validate container packaging and Hosted config
if: matrix.python-version == '3.12'
run: |
set -euo pipefail
docker compose -f compose.hosted.example.yml config >/dev/null
export OSI_RELEASE_COMMIT="${GITHUB_SHA}"
docker compose -f compose.public-hosted.example.yml config >/dev/null
docker compose -f compose.hosted.example.yml build osi-mcp
docker compose -f compose.public-hosted.example.yml build osi-mcp-hosted
docker run --rm aiworkstation-osi-mcp:local \
osi-mcp-http --check-config >/dev/null
docker compose -f compose.hosted.example.yml run --rm --no-deps \
osi-mcp osi-mcp-http --check-config >/dev/null
docker compose -f compose.public-hosted.example.yml run --rm --no-deps \
osi-mcp-hosted osi-mcp-hosted --check-config \
>tmp/public-hosted-container-config.json
python - <<'PY'
import json
import os
from pathlib import Path
payload = json.loads(
Path("tmp/public-hosted-container-config.json").read_text(encoding="utf-8")
)
assert payload["release_commit"] == os.environ["GITHUB_SHA"]
assert payload["mode"] == "hosted-public"
assert payload["tool_count"] == 9
assert payload["server_model_enabled"] is False
assert payload["oauth_enabled"] is False
PY
evidence:
name: publish-ci-evidence
needs: test
runs-on: ubuntu-latest
if: ${{ success() }}
steps:
- name: Write candidate-bound CI evidence
env:
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
COMMIT_SHA: ${{ github.sha }}
REPOSITORY: ${{ github.repository }}
REF_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
mkdir -p tmp/ci-evidence
generated_at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
cat > tmp/ci-evidence/ci-evidence.json <<EOF
{
"schema_version": "osi.ci-evidence.v1",
"generated_at": "$generated_at",
"workflow": "ci",
"run_id": "$RUN_ID",
"run_attempt": "$RUN_ATTEMPT",
"commit": "$COMMIT_SHA",
"repository": "$REPOSITORY",
"ref_name": "$REF_NAME",
"python_versions": ["3.10", "3.12"],
"python310_passed": true,
"python312_passed": true
}
EOF
- name: Upload CI evidence
uses: actions/upload-artifact@v7
with:
name: ci-evidence-${{ github.run_id }}
path: tmp/ci-evidence/ci-evidence.json
if-no-files-found: error
retention-days: 30

Xet Storage Details

Size:
14.4 kB
·
Xet hash:
1ab21946384b44f5459fa362d11e2f38e55a2cb7d64a5b8b9ad933fe09d377a6

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.