浏览代码

Use pre-commit for CI tests, add black hook (#2163)

* WIP precommit on top level

* update CI

* circleci fixes

* intentionally fail black

* use --show-diff-on-failure in CI

* fix command order

* rebreak a file

* apply black

* run on whole repo
/develop-generalizationTraining-TrainerController
GitHub 6 年前
当前提交
e910ccc5
共有 3 个文件被更改,包括 13 次插入6 次删除
  1. 6
      .circleci/config.yml
  2. 6
      utils/validate_meta_files.py
  3. 7
      .pre-commit-config.yaml

6
.circleci/config.yml


pip install --upgrade setuptools
cd ml-agents-envs && pip install -e .
cd ../ml-agents && pip install -e .
pip install black pytest-cov==2.6.1 codacy-coverage==1.3.11
pip install pre-commit pytest-cov==2.6.1 codacy-coverage==1.3.11
cd ../gym-unity && pip install -e .
- save_cache:

name: Check Code Style for ml-agents and gym_unity using black
command: |
. venv/bin/activate
black --check ml-agents
black --check ml-agents-envs
black --check gym-unity
pre-commit run --show-diff-on-failure --all-files
- run:
name: Verify there are no hidden/missing metafiles.

6
utils/validate_meta_files.py


num_matched += 1
if unmatched:
raise Exception(f"Mismatch between expected files and their .meta files: {sorted(unmatched)}")
raise Exception(
f"Mismatch between expected files and their .meta files: {sorted(unmatched)}"
)
main()
main()

7
.pre-commit-config.yaml


exclude: '^$'
fail_fast: false
repos:
- repo: https://github.com/python/black
rev: '19.3b0'
hooks:
- id: black
正在加载...
取消
保存