forked from htcondor/BLAH
-
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.
Merge pull request htcondor#58 from yongleyuan/HTCONDOR-522.update-py…
…lint-gha Update the blahp Python linting GitHub Action (HTCONDOR-522)
- Loading branch information
Showing
5 changed files
with
87 additions
and
42 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,74 @@ | ||
name: Run Python linters | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
python-files: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
filelist: ${{ steps.python-files.outputs.filelist }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- id: python-files | ||
run: | | ||
echo "::set-output name=filelist::$(find . -type f -exec awk ' /^#!.*python/{print FILENAME} {nextfile}' {} + | tr '\n' ' ')" | ||
pylint: | ||
runs-on: ubuntu-latest | ||
needs: [python-files] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.6 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.6 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/pip-cache | ||
key: pip-3.6-${{ github.sha }} | ||
# allow cache hits from previous runs of the current branch, | ||
# parent branch, then upstream branches, in that order | ||
restore-keys: | | ||
pip-3.6- | ||
- name: Install Requirements | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip --cache-dir ~/pip-cache install pylint | ||
- name: Run Pylint | ||
env: | ||
PYTHON_FILES: ${{ needs.python-files.outputs.filelist }} | ||
run: | | ||
export PYTHONPATH=$PYTHONPATH:$PWD/src/scripts | ||
pylint --errors-only $PYTHON_FILES | ||
flake8: | ||
runs-on: ubuntu-latest | ||
needs: [python-files] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.6 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.6 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/pip-cache | ||
key: pip-3.6-${{ github.sha }} | ||
# allow cache hits from previous runs of the current branch, | ||
# parent branch, then upstream branches, in that order | ||
restore-keys: | | ||
pip-3.6- | ||
- name: Install Requirements | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip --cache-dir ~/pip-cache install flake8 | ||
- name: Run flake8 | ||
env: | ||
PYTHON_FILES: ${{ needs.python-files.outputs.filelist }} | ||
run: | | ||
export PYTHONPATH=$PYTHONPATH:$PWD/src/scripts | ||
flake8 --select F $PYTHON_FILES |
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