-
Notifications
You must be signed in to change notification settings - Fork 23
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
[WIP] Introduce code-quality checks to the repo (details TBD) #1099
base: master
Are you sure you want to change the base?
Conversation
.github/workflows/main.yml
Outdated
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/*requirements.txt') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This speeds up the CI requirements install process for code-quality and tests jobs that run in parallel.
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can save some time on packages downloading. Don't know if this is worth it.
@@ -145,7 +145,7 @@ def build( | |||
model=model, machine=machine, output_dir=output_dir # type: ignore | |||
) | |||
logger.info(f"Built model, and deposited at {self.cached_model_path}") | |||
logger.info(f"Writing model-location to model registry") | |||
logger.info("Writing model-location to model registry") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cause of this tests were failing.
Codecov Report
@@ Coverage Diff @@
## master #1099 +/- ##
=======================================
Coverage 94.63% 94.63%
=======================================
Files 62 62
Lines 2965 2965
=======================================
Hits 2806 2806
Misses 159 159
Continue to review full report at Codecov.
|
flake8-bugbear = ["+*"] | ||
flake8-builtins = ["+*"] | ||
# - C812 exclude trailing comma for one line expression (black conflicts) | ||
flake8-commas = ["+*", "-C812"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can add exclude that is logical from our perspective of view.
flakehell~=0.7.0 | ||
flake8-broken-line~=0.3 | ||
flake8-bugbear~=20.11 | ||
flake8-builtins~=1.5 | ||
flake8-commas~=2.0 | ||
flake8-comprehensions~=3.3 | ||
darglint~=1.5 | ||
flake8-debugger~=4.0 | ||
flake8-docstrings~=1.5 | ||
flake8-eradicate~=1.0 | ||
flake8-isort~=4.0 | ||
flake8-mutable~=1.2 | ||
flake8-string-format~=0.3 | ||
mccabe~=0.6 | ||
pep8-naming~=0.11.1 | ||
pycodestyle~=2.6 | ||
pyflakes~=2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versions should be low and freezed cause of the massive conflicts in the requirements files.
# Black formatting | ||
testformatting = pytest --addopts "tests/test_formatting.py" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
black will be checked now on the CI step at first place, not to wait for the tests to end.
.github/workflows/main.yml
Outdated
|
||
- name: Run code quality checks | ||
run: | | ||
FILES_TO_CHECK=$(git diff origin/master..origin/${{ steps.extract_branch.outputs.branch }} --name-only --diff-filter=ACM '*py') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request could be created to another branch except for master
. Also, it would not work with push
into the branch which will not be merged into master.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, good point. I'll see how to make origin/master
dynamical.
About push
- what do you mean? Diff will compare target
branch with the current one and get the diff
. Even if it push
or pull_request
.
.github/workflows/main.yml
Outdated
pip install --upgrade pip-tools | ||
pip install -r requirements/test_requirements.txt | ||
|
||
- name: Run code quality checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is better to reuse code from Makefile in this step:
run: |
make ${{ matrix.code-check }}-check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's different for CI approach and local. Locally we should check for any changes (not event committed), on the other hand on CI we should compare two remote branches.
So it'll be different diffs
with different info needed to it.
So I split them not to make logic hard to understand and get lost among params.
What this PR offers:
code-quality
steps fromtests
pythonLocation
speeds up the process. If I missed any downsides/risks of usingpythonLocation
instead ofpip cache
- please let me know. We should fix cache limit range.Motivation:
P.S. Previous PR was closed due to some un-reverted issues :) Here's lates comment from @flikka about this idea.
P.S.2. Feel free to add your opinion :)