Unverified Commit 6c3cc16d authored by moto's avatar moto Committed by GitHub
Browse files

Separate style check from unit test (#664)

* Separate style check from unit test

* TEST flake8 fail

* TEST clang-format fail

* Revert "TEST flake8 fail"

This reverts commit 88d90185cefe294b9a662129a05c2e26a9844fe4.

* Revert "TEST clang-format fail"

This reverts commit 93517d1ccba650a6ccd813268fd73a4fd63b252c.
parent da59f597
......@@ -471,6 +471,37 @@ jobs:
- store_test_results:
path: test-results
stylecheck:
<<: *binary_common
docker:
- image: "pytorch/torchaudio_unittest_base:manylinux"
resource_class: medium
steps:
- checkout
- run:
name: Generate cache key
# This will refresh cache on Sundays, nightly build should generate new cache.
command: echo "$(date +"%Y-%U")" > .circleci-weekly
- restore_cache:
keys:
- env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
- run:
name: Setup
command: .circleci/unittest/linux/scripts/setup_env.sh
- save_cache:
key: env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
paths:
- conda
- env
- third_party/build
- run:
name: Run style check
command: .circleci/unittest/linux/scripts/run_style_checks.sh
workflows:
build:
jobs:
......@@ -534,6 +565,9 @@ workflows:
- unittest_linux_cpu:
name: unittest_linux_cpu_py3.6
python_version: '3.6'
- stylecheck:
name: stylecheck_py3.6
python_version: '3.6'
- unittest_linux_cpu:
name: unittest_linux_cpu_py3.7
python_version: '3.7'
......
......@@ -471,6 +471,37 @@ jobs:
- store_test_results:
path: test-results
stylecheck:
<<: *binary_common
docker:
- image: "pytorch/torchaudio_unittest_base:manylinux"
resource_class: medium
steps:
- checkout
- run:
name: Generate cache key
# This will refresh cache on Sundays, nightly build should generate new cache.
command: echo "$(date +"%Y-%U")" > .circleci-weekly
- restore_cache:
{% raw %}
keys:
- env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
{% endraw %}
- run:
name: Setup
command: .circleci/unittest/linux/scripts/setup_env.sh
- save_cache:
{% raw %}
key: env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
{% endraw %}
paths:
- conda
- env
- third_party/build
- run:
name: Run style check
command: .circleci/unittest/linux/scripts/run_style_checks.sh
workflows:
build:
jobs:
......
......@@ -114,7 +114,7 @@ def unittest_workflows(indentation=6):
jobs = []
for os_type in ["linux", "windows"]:
for device_type in ["cpu", "gpu"]:
for python_version in PYTHON_VERSIONS:
for i, python_version in enumerate(PYTHON_VERSIONS):
job = {
"name": f"unittest_{os_type}_{device_type}_py{python_version}",
"python_version": python_version,
......@@ -123,6 +123,14 @@ def unittest_workflows(indentation=6):
if device_type == 'gpu':
job['filters'] = gen_filter_branch_tree('master')
jobs.append({f"unittest_{os_type}_{device_type}": job})
if i == 0 and os_type == "linux" and device_type == "cpu":
jobs.append({
f"stylecheck": {
"name": f"stylecheck_py{python_version}",
"python_version": python_version,
}
})
return indent(indentation, jobs)
......
......@@ -10,5 +10,6 @@ dependencies:
- librosa
- pip
- pip:
- clang-format
- kaldi-io
- scipy
#!/usr/bin/env bash
set -u
eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env
# We want to run all the style checks even if one of them fail.
exit_status=0
printf "\x1b[34mRunning flake8: "
flake8 --version
printf "\x1b[0m\n"
flake8 torchaudio test build_tools/setup_helpers
status=$?
exit_status="$((exit_status+status))"
if [ "${status}" -ne 0 ]; then
printf "\x1b[31mflake8 failed. Check the format of Python files.\x1b[0m\n"
fi
printf "\x1b[34mRunning clang-format: "
clang-format --version
printf "\x1b[0m\n"
git-clang-format origin/master
git diff --exit-code
status=$?
exit_status="$((exit_status+status))"
if [ "${status}" -ne 0 ]; then
printf "\x1b[31mC++ files are not formatted. Please use git-clang-format to format CPP files.\x1b[0m\n"
fi
exit $exit_status
......@@ -7,4 +7,3 @@ conda activate ./env
python -m torch.utils.collect_env
pytest --cov=torchaudio --junitxml=test-results/junit.xml -v --durations 20 test
flake8 torchaudio test build_tools/setup_helpers
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