Give linting steps a unique prefix (#90705)

Give a unique prefix to all steps in lint.yml which catch valid linter errors. This will let retrybot identify lint.yml steps which should not be retried.

This is a prelude to https://github.com/pytorch/test-infra/pull/1275 which extends the retry-on-failure behavior to all PRs in addition to trunk.

This hadn't been an issue previously since we would always only linter failures on `master`, where linter failures were always safe to retry since legitimate linter failures there are virtually non-existent
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90705
Approved by: https://github.com/huydhn, https://github.com/malfet
This commit is contained in:
Zain Rizvi 2022-12-14 17:38:14 +00:00 committed by PyTorch MergeBot
parent f21cb7d77e
commit caa05e6f87

View File

@ -10,6 +10,8 @@ on:
- landchecks/* - landchecks/*
workflow_dispatch: workflow_dispatch:
# The names of steps that actually test the code should be suffixed with `(nonretryable)`.
# When any other step fails, it's job will be retried once by retryBot.
jobs: jobs:
lintrunner: lintrunner:
runs-on: linux.20_04.16x runs-on: linux.20_04.16x
@ -46,7 +48,7 @@ jobs:
--tags-path aten/src/ATen/native/tags.yaml \ --tags-path aten/src/ATen/native/tags.yaml \
--deprecated-functions-path "tools/autograd/deprecated.yaml" --deprecated-functions-path "tools/autograd/deprecated.yaml"
- name: Run lintrunner on all files - name: Run lintrunner on all files (nonretryable)
run: | run: |
set +e set +e
if ! lintrunner --force-color --all-files --tee-json=lint.json; then if ! lintrunner --force-color --all-files --tee-json=lint.json; then
@ -98,20 +100,20 @@ jobs:
# NB: We use 'printf' below rather than '\u000a' since bash pre-4.2 # NB: We use 'printf' below rather than '\u000a' since bash pre-4.2
# does not support the '\u000a' syntax (which is relevant for local linters) # does not support the '\u000a' syntax (which is relevant for local linters)
(! git --no-pager grep -In "$(printf '\xC2\xA0')" -- . || (echo "The above lines have non-breaking spaces (U+00A0); please convert them to spaces (U+0020)"; false)) (! git --no-pager grep -In "$(printf '\xC2\xA0')" -- . || (echo "The above lines have non-breaking spaces (U+00A0); please convert them to spaces (U+0020)"; false))
- name: Ensure cross-OS compatible file names - name: Ensure cross-OS compatible file names (nonretryable)
if: always() if: always()
run: | run: |
(! git ls-files | grep -E '([<>:"|?*]|[ .]$)' || (echo "The above file names are not valid across all operating systems. Please ensure they don't contain the characters '<>:""|?*' and don't end with a white space or a '.' "; false)) (! git ls-files | grep -E '([<>:"|?*]|[ .]$)' || (echo "The above file names are not valid across all operating systems. Please ensure they don't contain the characters '<>:""|?*' and don't end with a white space or a '.' "; false))
- name: Ensure no versionless Python shebangs - name: Ensure no versionless Python shebangs (nonretryable)
if: always() if: always()
run: | run: |
(! git --no-pager grep -In '#!.*python$' -- . || (echo "The above lines have versionless Python shebangs; please specify either python2 or python3"; false)) (! git --no-pager grep -In '#!.*python$' -- . || (echo "The above lines have versionless Python shebangs; please specify either python2 or python3"; false))
- name: C++ docs check - name: C++ docs check (nonretryable)
if: ${{ always() && steps.requirements.outcome == 'success' }} if: ${{ always() && steps.requirements.outcome == 'success' }}
run: | run: |
sudo apt-get install -y doxygen sudo apt-get install -y doxygen
cd docs/cpp/source && ./check-doxygen.sh cd docs/cpp/source && ./check-doxygen.sh
- name: CUDA kernel launch check - name: CUDA kernel launch check (nonretryable)
if: ${{ always() && steps.requirements.outcome == 'success' }} if: ${{ always() && steps.requirements.outcome == 'success' }}
run: | run: |
set -eux set -eux
@ -128,7 +130,7 @@ jobs:
with: with:
submodules: false submodules: false
fetch-depth: -1 fetch-depth: -1
- name: PR size check - name: PR size check (nonretryable)
env: env:
BASE: ${{ github.event.pull_request.base.sha }} BASE: ${{ github.event.pull_request.base.sha }}
HEAD: ${{ github.event.pull_request.head.sha }} HEAD: ${{ github.event.pull_request.head.sha }}
@ -162,10 +164,10 @@ jobs:
- name: Install Jinja2 - name: Install Jinja2
run: | run: |
pip install Jinja2==3.0.1 --user pip install Jinja2==3.0.1 --user
- name: Regenerate workflows - name: Regenerate workflows (nonretryable)
id: generate_workflows id: generate_workflows
run: .github/scripts/generate_ci_workflows.py run: .github/scripts/generate_ci_workflows.py
- name: Assert that regenerating the workflows didn't change them - name: Assert that regenerating the workflows didn't change them (nonretryable)
run: | run: |
if ! .github/scripts/report_git_status.sh .github/workflows; then if ! .github/scripts/report_git_status.sh .github/workflows; then
echo echo
@ -179,7 +181,7 @@ jobs:
echo 'onto a more recent commit from the PyTorch master branch.' echo 'onto a more recent commit from the PyTorch master branch.'
false false
fi fi
- name: Check that jobs will be cancelled - name: Check that jobs will be cancelled (nonretryable)
if: ${{ always() && steps.generate_workflows.outcome == 'success' }} if: ${{ always() && steps.generate_workflows.outcome == 'success' }}
run: | run: |
.github/scripts/ensure_actions_will_cancel.py .github/scripts/ensure_actions_will_cancel.py
@ -202,7 +204,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
- name: Install markdown-toc - name: Install markdown-toc
run: npm install -g markdown-toc run: npm install -g markdown-toc
- name: Regenerate ToCs and check that they didn't change - name: Regenerate ToCs and check that they didn't change (nonretryable)
run: | run: |
set -eu set -eu
export PATH=~/.npm-global/bin:"$PATH" export PATH=~/.npm-global/bin:"$PATH"
@ -262,7 +264,7 @@ jobs:
pip install -r requirements.txt --user pip install -r requirements.txt --user
pip install mypy==0.960 --user pip install mypy==0.960 --user
make setup_lint make setup_lint
- name: Test tools - name: Test tools (nonretryable)
run: | run: |
python3 -m unittest discover -vs tools/test -p 'test_*.py' python3 -m unittest discover -vs tools/test -p 'test_*.py'
python3 -m unittest discover -vs .github/scripts -p 'test_*.py' python3 -m unittest discover -vs .github/scripts -p 'test_*.py'
@ -308,7 +310,7 @@ jobs:
pip install -r requirements.txt pip install -r requirements.txt
# Doesn't really matter what torch version, we just need ANY torch installed # Doesn't really matter what torch version, we just need ANY torch installed
pip install 'torch==1.*' pip install 'torch==1.*'
- name: Run collect_env.py - name: Run collect_env.py (nonretryable)
run: | run: |
# All we need to see is that it passes # All we need to see is that it passes
python3 torch/utils/collect_env.py python3 torch/utils/collect_env.py