-
Notifications
You must be signed in to change notification settings - Fork 7.1k
port lint workflows from CircleCI to GHA #7401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e78b04c
port lint workflows from CircleCI to GHA
pmeier d31f3bb
remove lint workflows from CircleCI
pmeier 1932bfb
fix syntax
pmeier ba9cb06
add conda env to type check job
pmeier 28e3f30
display needed changes
pmeier f017fe8
fix conda for type checks
pmeier 6d7f5c6
increase timeout for clang format
pmeier c4b27a4
fix clang format job
pmeier 9295084
remove debug timeout
pmeier 80a4d2a
group job commands
pmeier c0cb637
[REVERTME] intentionally fail lint workflows to showcase
pmeier 0ab8bf7
install deps from conda-forge to avoid warnings
pmeier c0006d0
Revert "install deps from conda-forge to avoid warnings"
pmeier 27821b1
Revert "[REVERTME] intentionally fail lint workflows to showcase"
pmeier af7f768
cleanup
pmeier 4da80c1
Merge branch 'main' into lint-ci
pmeier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
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::' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.