mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Refactor tools/actions_local_runner.py to allow custom remote/branch names
Currently this script assumes origin/master as the branch for comparison when --changed-only flag is used. Although this is reasonable for PyTorch build infrastructure, external contributors that fork PyTorch may have different remotes/branch names, such as upstream/master Assuming users have a `origin` remote for their PyTorch fork and a `upstream` remote pointing to the original PyTorch repo For external contributions, by running ``` make quick_checks CHANGED_ONLY=--changed-only make flake8 CHANGED_ONLY=--changed-only make mypy CHANGED_ONLY=--changed-only make cmakelint CHANGED_ONLY=--changed-only make shellcheck CHANGED_ONLY=--changed-only make clang-tidy CHANGED_ONLY=--changed-only make quicklint -j ${CPUS} CHANGED_ONLY=--changed-only ``` would result in an incorrect git diff, forcing users to run a full test as opposed to just test changed files This PR introduces a --ref_branch argument that allows users to specify an arbitrary branch to detect changes in their own PyTorch forks which may have a remote for the upstream PyTorch repo. Given the proposed changes, this is how users could compare their changes to an arbitrary remote/branch ``` make quick_checks CHANGED_ONLY=--changed-only REF_BRANCH=--ref_branch=upstream/master make flake8 CHANGED_ONLY=--changed-only REF_BRANCH=--ref_branch=upstream/master make mypy CHANGED_ONLY=--changed-only REF_BRANCH=--ref_branch=upstream/master make cmakelint CHANGED_ONLY=--changed-only REF_BRANCH=--ref_branch=upstream/master make shellcheck CHANGED_ONLY=--changed-only REF_BRANCH=--ref_branch=upstream/master make clang-tidy CHANGED_ONLY=--changed-only REF_BRANCH=--ref_branch=upstream/master make quicklint -j ${CPUS} CHANGED_ONLY=--changed-only REF_BRANCH=--ref_branch=upstream/master ``` This change is BC, as it assigns origin/master as default argument to all existing methods that handle branches Pull Request resolved: https://github.com/pytorch/pytorch/pull/73387 Approved by: malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
b955a046cd
commit
cf143bdc57
4
Makefile
4
Makefile
@ -47,6 +47,7 @@ shellcheck:
|
||||
--step 'Extract scripts from GitHub Actions workflows'
|
||||
@$(PYTHON) tools/actions_local_runner.py \
|
||||
$(CHANGED_ONLY) \
|
||||
$(REF_BRANCH) \
|
||||
--job 'shellcheck'
|
||||
|
||||
setup_lint:
|
||||
@ -94,11 +95,13 @@ quick_checks:
|
||||
flake8:
|
||||
@$(PYTHON) tools/actions_local_runner.py \
|
||||
$(CHANGED_ONLY) \
|
||||
$(REF_BRANCH) \
|
||||
--job 'flake8-py3'
|
||||
|
||||
mypy:
|
||||
@$(PYTHON) tools/actions_local_runner.py \
|
||||
$(CHANGED_ONLY) \
|
||||
$(REF_BRANCH) \
|
||||
--job 'mypy'
|
||||
|
||||
cmakelint:
|
||||
@ -110,6 +113,7 @@ cmakelint:
|
||||
clang-tidy:
|
||||
@$(PYTHON) tools/actions_local_runner.py \
|
||||
$(CHANGED_ONLY) \
|
||||
$(REF_BRANCH) \
|
||||
--job 'clang-tidy'
|
||||
|
||||
toc:
|
||||
|
Reference in New Issue
Block a user