|
| 1 | +name: CI Pipeline |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, develop] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + python-version: ['3.10', '3.11', '3.12'] |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Set up Python ${{ matrix.python-version }} |
| 20 | + uses: actions/setup-python@v5 |
| 21 | + with: |
| 22 | + python-version: ${{ matrix.python-version }} |
| 23 | + |
| 24 | + - name: Cache pip dependencies |
| 25 | + uses: actions/cache@v4 |
| 26 | + with: |
| 27 | + path: ~/.cache/pip |
| 28 | + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} |
| 29 | + restore-keys: | |
| 30 | + ${{ runner.os }}-pip- |
| 31 | +
|
| 32 | + - name: Install dependencies |
| 33 | + run: | |
| 34 | + python -m pip install --upgrade pip |
| 35 | + pip install -r requirements.txt |
| 36 | +
|
| 37 | + - name: Run linting (ruff) |
| 38 | + run: | |
| 39 | + pip install ruff |
| 40 | + ruff check agents/ tests/ --ignore E501 |
| 41 | +
|
| 42 | + - name: Run type checking (mypy) |
| 43 | + run: | |
| 44 | + pip install mypy types-PyYAML |
| 45 | + mypy agents/agent_log_scorer.py --ignore-missing-imports || true |
| 46 | +
|
| 47 | + - name: Run tests with coverage |
| 48 | + run: | |
| 49 | + pytest tests/ -v --cov=agents --cov-report=xml --cov-report=term-missing |
| 50 | +
|
| 51 | + - name: Upload coverage to Codecov |
| 52 | + uses: codecov/codecov-action@v4 |
| 53 | + with: |
| 54 | + file: ./coverage.xml |
| 55 | + fail_ci_if_error: false |
| 56 | + |
| 57 | + integration-test: |
| 58 | + runs-on: ubuntu-latest |
| 59 | + needs: test |
| 60 | + |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v4 |
| 63 | + |
| 64 | + - name: Set up Python |
| 65 | + uses: actions/setup-python@v5 |
| 66 | + with: |
| 67 | + python-version: '3.11' |
| 68 | + |
| 69 | + - name: Install dependencies |
| 70 | + run: | |
| 71 | + pip install -r requirements.txt |
| 72 | +
|
| 73 | + - name: Run sample analysis |
| 74 | + run: | |
| 75 | + python agents/agent_log_scorer.py |
| 76 | +
|
| 77 | + - name: Run batch analysis |
| 78 | + run: | |
| 79 | + python agents/agent_log_scorer.py --batch tests/scorecards/ --stats |
| 80 | +
|
| 81 | + - name: Generate HTML report |
| 82 | + run: | |
| 83 | + python agents/agent_log_scorer.py --batch tests/scorecards/ --html report.html |
| 84 | +
|
| 85 | + - name: Upload HTML report |
| 86 | + uses: actions/upload-artifact@v4 |
| 87 | + with: |
| 88 | + name: html-report |
| 89 | + path: report.html |
| 90 | + |
| 91 | + security-scan: |
| 92 | + runs-on: ubuntu-latest |
| 93 | + |
| 94 | + steps: |
| 95 | + - uses: actions/checkout@v4 |
| 96 | + |
| 97 | + - name: Set up Python |
| 98 | + uses: actions/setup-python@v5 |
| 99 | + with: |
| 100 | + python-version: '3.11' |
| 101 | + |
| 102 | + - name: Install bandit |
| 103 | + run: pip install bandit |
| 104 | + |
| 105 | + - name: Run security scan |
| 106 | + run: | |
| 107 | + bandit -r agents/ -ll || true |
0 commit comments