Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/fork-ci-mirror-fast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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:
types: [opened, synchronize, reopened]
workflow_dispatch:
issue_comment:
types: [created]

permissions:
contents: read

jobs:
lint-check:
# 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'))
name: PyLint Mirror
runs-on: ubuntu-latest
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:
python-version: "3.9"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pylint==2.13.9 numpy wheel
- 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<<EOF"
echo "$CHANGED"
echo "EOF"
} >> "$GITHUB_OUTPUT"
echo "Changed Python files:"
echo "$CHANGED"
- name: Run PyLint on changed Python files
run: |
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
32 changes: 32 additions & 0 deletions CI_MIRROR_GAPS.md
Original file line number Diff line number Diff line change
@@ -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.