diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 056d316..4e1e3a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,25 +5,75 @@ on: paths: - 'src/foundry/adapters/**' - 'tests/**' + - 'scripts/ci/**' + +permissions: + contents: read + pull-requests: write # needed only for the comment step; remove if you don't want comments + +concurrency: + group: tc06-${{ github.ref }} + cancel-in-progress: true jobs: tc-06: - name: TC-06 adapter contract & parity + name: TC-06 adapter contract & parity + brief runs-on: ubuntu-latest + timeout-minutes: 15 steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 # helpful for diffs/briefs - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.11' + cache: 'pip' - name: Install dependencies + shell: bash run: | python -m pip install --upgrade pip - pip install .[dev] ruff mypy pydantic + # editable install ensures tests import local src/ + pip install -e .[dev] + # make sure linters/type-checkers are present + pip install ruff mypy + + - name: Make CI scripts executable + shell: bash + run: chmod +x scripts/ci/check_tc06.sh - name: TC-06 adapter contract & parity + shell: bash + env: + # keeps repo root on sys.path for tests that import packages + PYTHONPATH: ${{ github.workspace }} run: scripts/ci/check_tc06.sh + + # ------- Review brief generation (module mode; no sys.path hacks) ------- + - name: Generate review brief + if: ${{ github.event_name == 'pull_request' }} + shell: bash + working-directory: ${{ github.workspace }} + run: | + python -m scripts.ci.review_brief \ + --base "${{ github.event.pull_request.base.sha }}" \ + --head "${{ github.event.pull_request.head.sha }}" \ + --pr "${{ github.event.pull_request.number }}" \ + --repo "${{ github.repository }}" > brief.md + + - name: Upload brief.md as artifact + if: ${{ github.event_name == 'pull_request' }} + uses: actions/upload-artifact@v4 + with: + name: review-brief + path: brief.md + + - name: Comment brief on PR + if: ${{ github.event_name == 'pull_request' }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + path: brief.md