|
@@ -7,9 +7,31 @@ on:
|
|
|
branches: [main]
|
|
branches: [main]
|
|
|
|
|
|
|
|
jobs:
|
|
jobs:
|
|
|
|
|
+ # ──────────────────────────────────────────────
|
|
|
|
|
+ # Secret leak scan — first line of defense
|
|
|
|
|
+ # 在跑任何其他东西之前先扫秘钥,省 CI 分钟
|
|
|
|
|
+ # ──────────────────────────────────────────────
|
|
|
|
|
+ secret-scan:
|
|
|
|
|
+ runs-on: ubuntu-latest
|
|
|
|
|
+ steps:
|
|
|
|
|
+ - uses: actions/checkout@v4
|
|
|
|
|
+ with:
|
|
|
|
|
+ fetch-depth: 0 # gitleaks 需要完整历史
|
|
|
|
|
+ - name: Run gitleaks
|
|
|
|
|
+ uses: gitleaks/gitleaks-action@v2
|
|
|
|
|
+ env:
|
|
|
|
|
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
+ # GITLEAKS_LICENSE only needed for org-level; OSS repo runs free
|
|
|
|
|
+ GITLEAKS_CONFIG: .github/gitleaks.toml
|
|
|
|
|
+
|
|
|
|
|
+ # ──────────────────────────────────────────────
|
|
|
|
|
+ # Python tests on 3.10/3.11/3.12
|
|
|
|
|
+ # ──────────────────────────────────────────────
|
|
|
test:
|
|
test:
|
|
|
runs-on: ubuntu-latest
|
|
runs-on: ubuntu-latest
|
|
|
|
|
+ needs: secret-scan
|
|
|
strategy:
|
|
strategy:
|
|
|
|
|
+ fail-fast: false
|
|
|
matrix:
|
|
matrix:
|
|
|
python-version: ["3.10", "3.11", "3.12"]
|
|
python-version: ["3.10", "3.11", "3.12"]
|
|
|
steps:
|
|
steps:
|
|
@@ -18,23 +40,50 @@ jobs:
|
|
|
uses: actions/setup-python@v5
|
|
uses: actions/setup-python@v5
|
|
|
with:
|
|
with:
|
|
|
python-version: ${{ matrix.python-version }}
|
|
python-version: ${{ matrix.python-version }}
|
|
|
- - name: Install dependencies
|
|
|
|
|
|
|
+ cache: pip
|
|
|
|
|
+ - name: Install lambdagent (src-layout) + agentpaas
|
|
|
run: |
|
|
run: |
|
|
|
- pip install -e ".[dev]" 2>/dev/null || pip install pyyaml fastapi uvicorn pytest
|
|
|
|
|
|
|
+ pip install -e lambdagent/ 2>/dev/null || pip install pyyaml fastapi uvicorn pytest
|
|
|
|
|
+ pip install pytest pytest-asyncio pyyaml
|
|
|
- name: Run tests
|
|
- name: Run tests
|
|
|
run: python -m pytest tests/ -v --tb=short
|
|
run: python -m pytest tests/ -v --tb=short
|
|
|
- - name: Lint check
|
|
|
|
|
|
|
+ - name: Lint module loads
|
|
|
run: python -c "from lambdagent.fromconfig import lint_config; print('Lint module OK')"
|
|
run: python -c "from lambdagent.fromconfig import lint_config; print('Lint module OK')"
|
|
|
|
|
|
|
|
- lint:
|
|
|
|
|
|
|
+ # ──────────────────────────────────────────────
|
|
|
|
|
+ # Package import smoke test
|
|
|
|
|
+ # ──────────────────────────────────────────────
|
|
|
|
|
+ imports:
|
|
|
runs-on: ubuntu-latest
|
|
runs-on: ubuntu-latest
|
|
|
|
|
+ needs: secret-scan
|
|
|
steps:
|
|
steps:
|
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/checkout@v4
|
|
|
- uses: actions/setup-python@v5
|
|
- uses: actions/setup-python@v5
|
|
|
with:
|
|
with:
|
|
|
python-version: "3.12"
|
|
python-version: "3.12"
|
|
|
- - run: pip install pyyaml
|
|
|
|
|
- - name: Check imports
|
|
|
|
|
|
|
+ cache: pip
|
|
|
|
|
+ - run: |
|
|
|
|
|
+ pip install -e lambdagent/ 2>/dev/null || pip install pyyaml fastapi uvicorn
|
|
|
|
|
+ - name: Verify package surface
|
|
|
run: |
|
|
run: |
|
|
|
python -c "import lambdagent; print(f'lambdagent OK: {len(lambdagent.__all__)} exports')"
|
|
python -c "import lambdagent; print(f'lambdagent OK: {len(lambdagent.__all__)} exports')"
|
|
|
python -c "from agentpaas.api.app import app; print(f'AgentPaaS OK: {len([r for r in app.routes if hasattr(r, \"methods\")])} routes')"
|
|
python -c "from agentpaas.api.app import app; print(f'AgentPaaS OK: {len([r for r in app.routes if hasattr(r, \"methods\")])} routes')"
|
|
|
|
|
+
|
|
|
|
|
+ # ──────────────────────────────────────────────
|
|
|
|
|
+ # Web UI build (catch broken frontend before merge)
|
|
|
|
|
+ # ──────────────────────────────────────────────
|
|
|
|
|
+ webui:
|
|
|
|
|
+ runs-on: ubuntu-latest
|
|
|
|
|
+ needs: secret-scan
|
|
|
|
|
+ defaults:
|
|
|
|
|
+ run:
|
|
|
|
|
+ working-directory: webui
|
|
|
|
|
+ steps:
|
|
|
|
|
+ - uses: actions/checkout@v4
|
|
|
|
|
+ - uses: actions/setup-node@v4
|
|
|
|
|
+ with:
|
|
|
|
|
+ node-version: "20"
|
|
|
|
|
+ cache: npm
|
|
|
|
|
+ cache-dependency-path: webui/package-lock.json
|
|
|
|
|
+ - run: npm ci
|
|
|
|
|
+ - run: npm run build
|