From df29ced9338a892e29f1a96dded8223e408b03b1 Mon Sep 17 00:00:00 2001 From: Srijan Upadhyay Date: Wed, 8 Jul 2026 14:04:17 +0530 Subject: [PATCH 1/2] Add CPU-only fork CI mirror for lint checks --- .github/workflows/fork-ci-mirror-fast.yml | 34 +++++++++++++++++++++++ CI_MIRROR_GAPS.md | 32 +++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/fork-ci-mirror-fast.yml create mode 100644 CI_MIRROR_GAPS.md diff --git a/.github/workflows/fork-ci-mirror-fast.yml b/.github/workflows/fork-ci-mirror-fast.yml new file mode 100644 index 00000000000000..e9467aed04f124 --- /dev/null +++ b/.github/workflows/fork-ci-mirror-fast.yml @@ -0,0 +1,34 @@ +# CPU-only fork CI mirror for lint validation before upstream PR submission +name: Fork CI Mirror (Lint) +on: + pull_request: + types: [opened, synchronize, reopened] + workflow_dispatch: + issue_comment: + types: [created] + +permissions: + contents: read + +jobs: + lint-check: + # Run on PR comments containing "/run-ci-mirror" or on regular PR events + if: | + github.event_name != 'issue_comment' || + (github.event.issue.pull_request && contains(github.event.comment.body, '/run-ci-mirror')) + name: PyLint Mirror + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Set up Python 3.9 + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + with: + python-version: "3.9" + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install pylint==2.13.9 numpy wheel + - name: Run PyLint on Python files + run: | + find tensorflow -name '*.py' -type f | head -200 | xargs pylint --rcfile=tensorflow/tools/ci_build/pylintrc diff --git a/CI_MIRROR_GAPS.md b/CI_MIRROR_GAPS.md new file mode 100644 index 00000000000000..44900f64d39964 --- /dev/null +++ b/CI_MIRROR_GAPS.md @@ -0,0 +1,32 @@ +# Fork CI Mirror Gaps + +This document lists the CPU-only subset of TensorFlow's CI that is mirrored on this fork, and the permanent gaps due to unavailable GPU/self-hosted runners. + +## What's Mirrored + +- **PyLint (lint check)** — CPU-only static analysis on Python files using `tensorflow/tools/ci_build/pylintrc` + - Runs on: `ubuntu-latest` (GitHub-hosted) + - Triggered by: PR events or manual workflow dispatch or `/run-ci-mirror` comment + +## Permanent Gaps (GPU/Specialized Runners Required) + +These jobs require CUDA, TensorFlow's self-hosted GPU runners, or other specialized infrastructure not available on fork: + +- **TensorFlow CPU build** — Full C++/CUDA build (requires self-hosted runner with build toolchain) +- **XLA compilation tests** — GPU-backed XLA/CUDA validation +- **TFLite build and tests** — Requires specific build environment +- **GPU-accelerated unit tests** — CUDA compute capability, cuDNN, TensorRT dependencies +- **Wheel builds** — Requires self-hosted infrastructure for cross-platform builds +- **ARM/architecture-specific builds** — Requires ARM runners +- **Distributed training tests** — Requires multi-GPU setup + +The fork CI mirror provides a lightweight validation gate for code quality (lint) without committing to expensive build/test infrastructure. Full CI validation happens on the upstream repository. + +## Usage + +Trigger lint check on a fork PR: +1. Open or update a PR in this fork +2. Manually trigger with workflow dispatch, OR +3. Comment `/run-ci-mirror` on an open PR + +The workflow will run PyLint on Python files and report any style violations. From 809dd02cc5d631617fedda407f69f71fc923b33d Mon Sep 17 00:00:00 2001 From: Srijan Upadhyay Date: Wed, 8 Jul 2026 14:30:30 +0530 Subject: [PATCH 2/2] Scope PyLint mirror to changed files like upstream presubmit --- .github/workflows/fork-ci-mirror-fast.yml | 37 ++++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/fork-ci-mirror-fast.yml b/.github/workflows/fork-ci-mirror-fast.yml index e9467aed04f124..10e6dc049608d5 100644 --- a/.github/workflows/fork-ci-mirror-fast.yml +++ b/.github/workflows/fork-ci-mirror-fast.yml @@ -1,4 +1,7 @@ -# CPU-only fork CI mirror for lint validation before upstream PR submission +# CPU-only fork CI mirror for lint validation before upstream PR submission. +# Mirrors tensorflow/tensorflow's PyLint presubmit (.github/workflows/pylint-presubmit.yml), +# which lints only the Python files changed in the PR — not the whole tree — using +# the upstream pylintrc. Runs on GitHub-hosted ubuntu-latest; no GPU/CUDA needed. name: Fork CI Mirror (Lint) on: pull_request: @@ -12,7 +15,7 @@ permissions: jobs: lint-check: - # Run on PR comments containing "/run-ci-mirror" or on regular PR events + # Run on regular PR events, manual dispatch, or a "/run-ci-mirror" PR comment. if: | github.event_name != 'issue_comment' || (github.event.issue.pull_request && contains(github.event.comment.body, '/run-ci-mirror')) @@ -21,6 +24,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: 0 - name: Set up Python 3.9 uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: @@ -29,6 +34,30 @@ jobs: run: | python -m pip install --upgrade pip pip install pylint==2.13.9 numpy wheel - - name: Run PyLint on Python files + - name: Determine changed Python files + id: changed + run: | + set -euo pipefail + BASE_SHA="${{ github.event.pull_request.base.sha }}" + if [ -z "$BASE_SHA" ]; then + # No PR payload (workflow_dispatch / comment): compare against origin default branch. + git fetch origin master --depth=50 || git fetch origin main --depth=50 || true + BASE_SHA="$(git rev-parse origin/master 2>/dev/null || git rev-parse origin/main)" + fi + CHANGED="$(git diff --name-only --diff-filter=d "$BASE_SHA" HEAD | grep '\.py$' || true)" + { + echo "files<> "$GITHUB_OUTPUT" + echo "Changed Python files:" + echo "$CHANGED" + - name: Run PyLint on changed Python files run: | - find tensorflow -name '*.py' -type f | head -200 | xargs pylint --rcfile=tensorflow/tools/ci_build/pylintrc + set -euo pipefail + FILES="${{ steps.changed.outputs.files }}" + if [ -z "$(echo "$FILES" | tr -d '[:space:]')" ]; then + echo "No Python files changed — nothing to lint." + exit 0 + fi + echo "$FILES" | xargs pylint --rcfile=tensorflow/tools/ci_build/pylintrc