Add agentic harness program #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| harness-validate: | |
| name: harness-validate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: pip | |
| - run: python -m pip install --upgrade pip | |
| - run: python -m pip install -r requirements.txt | |
| - run: python -m pip install -r requirements-dev.txt | |
| - run: python scripts/agent_harness/validate_harness.py | |
| - run: python scripts/agent_harness/validate_references.py | |
| - run: python scripts/agent_harness/validate_pr.py --ci | |
| lint: | |
| name: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: pip | |
| - run: python -m pip install --upgrade pip | |
| - run: python -m pip install -r requirements.txt | |
| - run: python -m pip install -r requirements-dev.txt | |
| - run: python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| - run: python -m pydocstyle --count --convention=numpy | |
| - run: python -m black --check -l 99 dphtools tests scripts setup.py versioneer.py | |
| tests: | |
| name: tests (${{ matrix.os }}, py${{ matrix.python-version }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ["3.10"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - run: python -m pip install --upgrade pip | |
| - run: python -m pip install -r requirements.txt | |
| - run: python -m pip install -r requirements-dev.txt | |
| - run: python -m pip install . | |
| - run: python -m pytest --doctest-modules dphtools tests | |
| coverage: | |
| name: coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: pip | |
| - run: python -m pip install --upgrade pip | |
| - run: python -m pip install -r requirements.txt | |
| - run: python -m pip install -r requirements-dev.txt | |
| - run: python -m pip install . | |
| - run: python -m pytest --cov=dphtools --cov-branch --cov-report=term-missing --cov-report=xml tests | |
| - run: python scripts/agent_harness/coverage_gate.py | |
| - run: python scripts/agent_harness/diff_coverage_gate.py --enabled | |
| package: | |
| name: package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: pip | |
| - run: python -m pip install --upgrade pip | |
| - run: python -m pip install -r requirements.txt | |
| - run: python -m pip install -r requirements-dev.txt | |
| - run: python setup.py sdist bdist_wheel | |
| - run: python -m twine check dist/* | |
| ci-required: | |
| name: ci-required | |
| runs-on: ubuntu-latest | |
| needs: [harness-validate, lint, tests, coverage, package] | |
| if: always() | |
| steps: | |
| - name: Fail if required jobs failed, skipped, or were cancelled | |
| env: | |
| NEEDS_JSON: ${{ toJson(needs) }} | |
| run: | | |
| python - <<'PY' | |
| import json | |
| import os | |
| import sys | |
| needs = json.loads(os.environ["NEEDS_JSON"]) | |
| bad = { | |
| name: data["result"] | |
| for name, data in needs.items() | |
| if data["result"] != "success" | |
| } | |
| if bad: | |
| print("Required CI jobs did not succeed:", bad) | |
| sys.exit(1) | |
| print("All required CI jobs succeeded.") | |
| PY |