You need to sign in or sign up before continuing.
Unverified Commit 82cf540b authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

port lint workflows from CircleCI to GHA (#7401)

parent a73285aa
...@@ -269,61 +269,6 @@ jobs: ...@@ -269,61 +269,6 @@ jobs:
python .circleci/regenerate.py python .circleci/regenerate.py
git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1) git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1)
lint_python_and_config:
docker:
- image: cimg/python:3.8
steps:
- checkout
- pip_install:
args: pre-commit
descr: Install lint utilities
- run:
name: Install pre-commit hooks
command: pre-commit install-hooks
- run:
name: Lint Python code and config files
command: pre-commit run --all-files
- run:
name: Required lint modifications
when: on_fail
command: git --no-pager diff
lint_c:
docker:
- image: cimg/python:3.8
steps:
- apt_install:
args: libtinfo5
descr: Install additional system libraries
- checkout
- run:
name: Install lint utilities
command: |
curl https://oss-clang-format.s3.us-east-2.amazonaws.com/linux64/clang-format-linux64 -o clang-format
chmod +x clang-format
sudo mv clang-format /opt/clang-format
- run:
name: Lint C code
command: ./.circleci/unittest/linux/scripts/run-clang-format.py -r torchvision/csrc --clang-format-executable /opt/clang-format
- run:
name: Required lint modifications
when: on_fail
command: git --no-pager diff
type_check_python:
docker:
- image: cimg/python:3.8
steps:
- checkout
- install_torchvision:
editable: true
- pip_install:
args: mypy
descr: Install Python type check utilities
- run:
name: Check Python types statically
command: mypy --install-types --non-interactive --config-file mypy.ini
unittest_onnx: unittest_onnx:
docker: docker:
- image: cimg/python:3.8 - image: cimg/python:3.8
...@@ -996,9 +941,6 @@ workflows: ...@@ -996,9 +941,6 @@ workflows:
lint: lint:
jobs: jobs:
- circleci_consistency - circleci_consistency
- lint_python_and_config
- lint_c
- type_check_python
build: build:
jobs: jobs:
......
...@@ -269,61 +269,6 @@ jobs: ...@@ -269,61 +269,6 @@ jobs:
python .circleci/regenerate.py python .circleci/regenerate.py
git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1) git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1)
lint_python_and_config:
docker:
- image: cimg/python:3.8
steps:
- checkout
- pip_install:
args: pre-commit
descr: Install lint utilities
- run:
name: Install pre-commit hooks
command: pre-commit install-hooks
- run:
name: Lint Python code and config files
command: pre-commit run --all-files
- run:
name: Required lint modifications
when: on_fail
command: git --no-pager diff
lint_c:
docker:
- image: cimg/python:3.8
steps:
- apt_install:
args: libtinfo5
descr: Install additional system libraries
- checkout
- run:
name: Install lint utilities
command: |
curl https://oss-clang-format.s3.us-east-2.amazonaws.com/linux64/clang-format-linux64 -o clang-format
chmod +x clang-format
sudo mv clang-format /opt/clang-format
- run:
name: Lint C code
command: ./.circleci/unittest/linux/scripts/run-clang-format.py -r torchvision/csrc --clang-format-executable /opt/clang-format
- run:
name: Required lint modifications
when: on_fail
command: git --no-pager diff
type_check_python:
docker:
- image: cimg/python:3.8
steps:
- checkout
- install_torchvision:
editable: true
- pip_install:
args: mypy
descr: Install Python type check utilities
- run:
name: Check Python types statically
command: mypy --install-types --non-interactive --config-file mypy.ini
unittest_onnx: unittest_onnx:
docker: docker:
- image: cimg/python:3.8 - image: cimg/python:3.8
...@@ -996,9 +941,6 @@ workflows: ...@@ -996,9 +941,6 @@ workflows:
lint: lint:
jobs: jobs:
- circleci_consistency - circleci_consistency
- lint_python_and_config
- lint_c
- type_check_python
build: build:
jobs: jobs:
......
name: Lint
on:
pull_request:
push:
branches:
- nightly
- main
- release/*
workflow_dispatch:
jobs:
python-source-and-configs:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/vision
script: |
set -euo pipefail
echo '::group::Setup environment'
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
conda create --name ci --quiet --yes python=3.8 pip
conda activate ci
echo '::endgroup::'
echo '::group::Install lint tools'
pip install --progress-bar=off pre-commit
echo '::endgroup::'
echo '::group::Lint Python source and configs'
set +e
pre-commit run --all-files
if [ $? -ne 0 ]; then
git --no-pager diff
exit 1
fi
echo '::endgroup::'
c-source:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/vision
script: |
set -euo pipefail
echo '::group::Setup environment'
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
# clang-format needs some shared libraries that conflict with the system ones. Thus, we install them from conda
# and prepend the libraries to linker path to prioritize them
conda create --name ci --quiet --yes python=3.8 ncurses=5 libgcc
conda activate ci
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}"
echo '::endgroup::'
echo '::group::Install lint tools'
curl https://oss-clang-format.s3.us-east-2.amazonaws.com/linux64/clang-format-linux64 -o ./clang-format
chmod +x ./clang-format
echo '::endgroup::'
echo '::group::Lint C source'
set +e
./.circleci/unittest/linux/scripts/run-clang-format.py -r torchvision/csrc --clang-format-executable ./clang-format
if [ $? -ne 0 ]; then
git --no-pager diff
exit 1
fi
echo '::endgroup::'
python-types:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/vision
script: |
set -euo pipefail
export PYTHON_VERSION=3.8
export GPU_ARCH_TYPE=cpu
./.github/scripts/setup-env.sh
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
conda activate ci
echo '::group::Install lint tools'
pip install --progress-bar=off mypy
echo '::endgroup::'
echo '::group::Lint Python types'
mypy --install-types --non-interactive --config-file mypy.ini
echo '::endgroup::'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment