diff --git a/.circleci/config.yml b/.circleci/config.yml index 4f806b00f..fd7708f8d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -84,11 +84,25 @@ jobs: command: make citest - store_test_results: path: test_libs/pyspec/test-reports + lint: + docker: + - image: circleci/python:3.6 + working_directory: ~/specs-repo + steps: + - restore_cache: + key: v1-specs-repo-{{ .Branch }}-{{ .Revision }} + - restore_cached_venv: + venv_name: v1-pyspec + reqs_checksum: '{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "test_libs/pyspec/requirements-testing.txt" }}' + - run: + name: Run linter + command: make install_lint && make pyspec && make lint workflows: version: 2.1 test_spec: jobs: - checkout_specs + - lint - install_test: requires: - checkout_specs diff --git a/Makefile b/Makefile index 73d8adea8..8cc889f21 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,13 @@ test: $(PY_SPEC_ALL_TARGETS) citest: $(PY_SPEC_ALL_TARGETS) cd $(PY_SPEC_DIR); mkdir -p test-reports/eth2spec; . venv/bin/activate; python -m pytest --junitxml=test-reports/eth2spec/test_results.xml . +install_lint: + cd $(PY_SPEC_DIR); python3 -m venv venv; . venv/bin/activate; pip3 install flake8==3.5.0 + +lint: + cd $(PY_SPEC_DIR); . venv/bin/activate; \ + flake8 --max-line-length=120 ./eth2spec; + # "make pyspec" to create the pyspec for all phases. pyspec: $(PY_SPEC_ALL_TARGETS)