forked from openvinotoolkit/openvino_notebooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code quality CI test (openvinotoolkit#272)
* Add Code Quality CI check Run nbqa flake8 to check for common code quality issues Move nbqa and nbval from ci-requirements to dev-requirements since they are useful for local development too Also remove pre-commit since it is not currently used
- Loading branch information
1 parent
800e1b3
commit bbd4c59
Showing
10 changed files
with
416 additions
and
386 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,8 +1,3 @@ | ||
-r ../requirements.txt | ||
-r dev-requirements.txt | ||
|
||
# Packages for testing/validating notebooks | ||
nbval | ||
nbqa[toolchain] | ||
pandoc | ||
pre-commit | ||
|
This file contains 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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# Recommended packages for notebook developers | ||
|
||
-r ci-requirements.txt # packages for validation of notebooks | ||
|
||
# black==21.8 requires typing-extensions>3.10 which is incompatible | ||
# with other packages | ||
-r ../requirements.txt | ||
black==21.7b0 # format Python code | ||
isort # sort imports | ||
jupyterlab-code-formatter # format code in notebooks in Jupyter Lab | ||
jupyterlab-git # checkout and commit code in Jupyter Lab | ||
|
||
nbqa[toolchain] # automatic code quality checking | ||
nbval # pytest plugin for automatic notebook testing |
This file contains 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,47 @@ | ||
name: code_check | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
paths: | ||
- 'notebooks/**.ipynb' | ||
- 'notebooks/**.py' | ||
- 'requirements.txt' | ||
- '.ci/*' | ||
- '.github/workflows/codequality.yml' | ||
push: | ||
branches: | ||
- 'main' | ||
paths: | ||
- 'notebooks/**.ipynb' | ||
- 'notebooks/**.py' | ||
- 'requirements.txt' | ||
- '.ci/*' | ||
- '.github/workflows/codequality.yml' | ||
|
||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -r .ci/dev-requirements.txt | ||
python -m ipykernel install --user --name openvino_env | ||
- name: Flake8 | ||
run: | | ||
nbqa flake8 --ignore=E124,E203,E266,E402,E501,F821,W503,W291,W293 --nbqa-exclude="(301.*)|(302.*)|(208.*)" notebooks | ||
- name: Check READMEs | ||
run: | | ||
python -m pytest .ci/test_notebooks.py |
This file contains 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 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 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 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 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 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
Oops, something went wrong.