Merge pull request #40 from dongx1x/bump-version #6
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: | |
- 'sdk/python3/ccnp/**.py' | |
pull_request: | |
paths: | |
- 'sdk/python3/ccnp/**.py' | |
workflow_dispatch: | |
jobs: | |
scan_python: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout PR | |
uses: actions/checkout@v3 | |
- name: Setup Python action | |
uses: actions/setup-python@v4 | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install pylint | |
python3 -m pip install -r ./sdk/python3/requirements.txt | |
- name: Analyze python code | |
run: | | |
set -ex | |
export PYTHONPATH=$PWD/ccnp:$PYTHONPATH | |
python_files=$(find . -path ./sdk/python3/tests -prune -o -name "*.py" -print) | |
if [[ -n "$python_files" ]]; then | |
echo "$python_files" | xargs -n 1 python3 -m pylint --rcfile=.github/pylintrc | |
else | |
echo "No Python files found." | |
fi |