Skip to content

[BE?] Move torchci pythons scripts to tools #2344

[BE?] Move torchci pythons scripts to tools

[BE?] Move torchci pythons scripts to tools #2344

Workflow file for this run

name: Lint
on:
push:
branches:
- main
tags:
- v*
pull_request:
# A caveat https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions:
# If you define a path with the ! character, you must also define at least one path without
# the ! character. If you only want to exclude paths, use paths-ignore instead
paths-ignore:
- 'tools/torchfix/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true
jobs:
lintrunner:
name: lintrunner
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python_version: ["3.11"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Install Lintrunner
run: |
pushd tools/lintrunner
pip install .
popd
lintrunner init
- name: Run lintrunner on all files - Linux
run: |
set +e
if ! lintrunner -v --force-color --all-files --tee-json=lint.json --take ACTIONLINT,MYPY,RUSTFMT,COPYRIGHT,LINTRUNNER_VERSION,UFMT; then
echo ""
echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner -m main\`.\e[0m"
exit 1
fi
- name: Produce SARIF
if: always() && matrix.os == 'ubuntu-latest'
run: |
python tools/lintrunner/tools/convert_to_sarif.py --input lint.json --output lintrunner.sarif
- name: Upload SARIF file
if: always() && matrix.os == 'ubuntu-latest'
continue-on-error: true
uses: github/codeql-action/upload-sarif@v2
with:
# Path to SARIF file relative to the root of the repository
sarif_file: lintrunner.sarif
category: lintrunner
checkout_path: ${{ github.workspace }}