Update code and docs about CCNP #178
Workflow file for this run
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
name: Python Code Scan | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'cnap/**/*.py' | |
- 'tests/**/*.py' | |
pull_request: | |
paths: | |
- 'cnap/**/*.py' | |
- 'tests/**/*.py' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
codescan: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install pylint pydocstyle | |
python3 -m pip install -r ./cnap/requirements.txt | |
python3 -m pip install -r ./cnap/requirements-test.txt | |
sudo apt update | |
sudo apt install redis | |
- name: Analyze python code | |
run: | | |
set -ex | |
export PYTHONPATH=$PWD/cnap:$PYTHONPATH | |
python_files=$(find ./cnap -name "*.py" -print) | |
if [[ -n "$python_files" ]]; then | |
echo "$python_files" | xargs -n 1 python3 -m pylint --rcfile=.github/pylintrc | |
echo "$python_files" | xargs -n 1 python3 -m pydocstyle --convention=google | |
else | |
echo "No python files found." | |
fi | |
- name: Analyze python test code | |
run: | | |
set -ex | |
export PYTHONPATH=$PWD/cnap:$PYTHONPATH | |
test_files=$(find ./tests -name "*.py" -print) | |
if [[ -n "$test_files" ]]; then | |
echo "$test_files" | xargs -n 1 python3 -m pylint --rcfile=.github/pylintrc | |
else | |
echo "No python test files found." | |
fi | |
- name: Run unit tests | |
run: | | |
set -ex | |
export PYTHONPATH=$PWD/cnap:$PYTHONPATH | |
python3 -m pytest --cov=cnap tests | |
- name: Display detailed coverage report | |
run: | | |
coverage report -m |