Skip to content

Trigger CI only on code changes #11

Closed

Description

@Anya497

Trigger CI only on code changes.

Currently .github/workflows/install_and_test.yml runs on every PR push
(synchronize/opened/reopened), including non-code changes such as .gitignore
or the tasks/ plan churn, wasting a full ~15-minute suite run. Add a `paths`
filter to the `pull_request` trigger so CI runs only when the change can
affect its outcome (library code, tests, dependency metadata, the workflow
and its PySCF config, lint config).

Activity

  1. added
    taskA single task: one feature branch, one detailed plan, one integration
    on Oct 7, 2026
  2. Anya497 commented on Oct 7, 2026

    @Anya497
    OwnerAuthor

    Detailed Plan — #11 Trigger CI only on code changes

    Integration branch: agent_settings (stacked on main).
    Feature branch: ci_paths_filter (created from the integration branch).

    Problem: .github/workflows/install_and_test.yml triggers on every PR push
    (synchronize/opened/reopened) regardless of what changed. Non-code
    changes — e.g. .gitignore, the tasks/ plan churn removed in
    818500b — waste a full ~15-minute suite run per push. The workflow should
    run only when a change can affect its outcome.

    Reuse analysis

    • The pull_request trigger lives at the top of the existing workflow; only the
      on: block needs a paths: filter — no job/step changes.
    • "Can affect outcome" set, from the workflow's own inputs: the library
      (grad_dft/**), the tests (tests/**), dependency metadata it installs
      (requirements.txt, setup.py), the workflow itself and the PySCF config
      it consumes (PYSCF_CONFIG_FILE=.github/workflows/pyscf_conf.py → .github/**),
      and the lint configs (.pylintrc, .pre-commit-config.yaml) that The black/pylint hooks have never been enforced: reformat and add a lint job to CI #7 will
      put into CI.
    • Tests never read data/ or models/, so those are excluded (docs,
      notebooks, .gitignore, .opencode/skills/** etc. also skip CI).
    • No pyproject.toml exists — setup.py + requirements.txt are the only
      dependency sources (single source of truth per setup.py:18).

    Subtasks

    S1: Add a paths filter to the pull_request trigger

    Code: in .github/workflows/install_and_test.yml, replace the on: block:

    on:
      pull_request:
        types:
          - synchronize
          - opened
          - reopened
        # Only run CI when a change can affect its outcome: library code, tests,
        # dependency metadata, the workflow/config it consumes, or lint config.
        # Docs/notebooks/plan-file-only changes skip CI.
        paths:
          - 'grad_dft/**'
          - 'tests/**'
          - 'requirements.txt'
          - 'setup.py'
          - '.github/**'
          - '.pylintrc'
          - '.pre-commit-config.yaml'

    Notes:

    • .github/** covers both the workflow file and pyscf_conf.py, so editing
      either self-validates.
    • Whitelist semantics: a PR touching only non-listed paths skips CI entirely
      (paths-ignore would risk an empty-list skip on code-only PRs; whitelist is
      the requested "only on code changes").
    • Actions ignore paths for unchanged pushes naturally; the filter is purely
      additive to the existing types.

    Tests: no pytest surface exists for workflows (CI does not run pre-commit
    checks; the file is YAML). Validation instead:

    • YAML parses (python -c "import yaml; yaml.safe_load(...)").
    • Every tracked .py file under grad_dft/ and tests/ matches the
      grad_dft/** / tests/** globs (no exclusion holes).
    • The push that delivers this change itself triggers CI (.github/** is in
      the filter) — the filter is self-validating on the PR.

    Docs: no user-facing change; the inline comment in the workflow records
    the intent (single source of truth = the workflow file).

    Quality checks: no duplication (single on: block); no job logic touched;
    scope limited to the trigger.

    Commit: (#11-S1): run CI only when the change can affect its outcome
    plus a standalone Closes #11.

    Acceptance criteria mapping

    Criterion Where
    CI skips non-code pushes (.gitignore, tasks/, docs, notebooks) S1: paths whitelist on pull_request
    CI still runs on code, test, dependency, workflow, config changes S1: grad_dft/**, tests/**, requirements.txt, setup.py, .github/**, .pylintrc, .pre-commit-config.yaml
    The workflow change itself is validated S1: .github/** in the filter re-triggers CI on push
    No behavioral change to jobs/steps S1: only the on: block edited
    • S1: Implement (add paths filter to the pull_request trigger)
    • S1: Write tests (YAML parse + glob coverage check; self-validating push)
    • S1: Update Documentation (inline comment in the workflow only; no
      user-facing surface affected)
    • S1: Pre-Commit Check (no Python files changed → black/pylint untouched;
      pre-commit run --all-files no-op beyond Python scope)
    • S1: Quality checks (single on: block, no duplication, no job changes)
    • S1: Commit (Closes Trigger CI only on code changes #11)

    Design Notes

    • Correct Design: whitelist (paths) rather than paths-ignore, per the
      user's "only on code changes" — the listed paths are exactly the workflow's
      inputs.
    • No-tolerance/assertion impact: none — no test code touched.
  3. added a commit that references this issue on Oct 7, 2026
  4. Anya497 commented on Oct 7, 2026

    @Anya497
    OwnerAuthor

    PR #8 CI is green at `agent_settings` @ a4f1f89.\n\nAdded a `paths` whitelist to the `pull_request` trigger matching exactly the workflow's inputs: `grad_dft/`, `tests/`, `requirements.txt`, `setup.py`, `.github/` (workflow + pyscf_conf.py), `.pylintrc`, `.pre-commit-config.yaml`. Docs/notebooks/plan-file-only PRs now skip CI; the change is self-validating because `.github/` is in the filter.\n\nNote: the first run at a4f1f89 failed on `test_pw92[sol1]` — an `AssertionError: blksize > 0` inside pyscf `pbc/df/fft_ao2mo.py:198` (memory-estimate flake, unrelated to this change; same code was green at f969172 and locally). Rerun of the failed job passed. Proposed as a separate issue.

  5. added a commit that references this issue on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    taskA single task: one feature branch, one detailed plan, one integration

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions