Merge pull request #24 from williamnswanson/INF-2273.merge-local-mapf… #69
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: Run Python linters | |
on: [push, pull_request] | |
jobs: | |
python-files: | |
runs-on: ubuntu-20.04 | |
outputs: | |
filelist: ${{ steps.python-files.outputs.filelist }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: python-files | |
run: | | |
echo "filelist=$(find . -type f -exec awk ' /^#!.*python/{print FILENAME} {nextfile}' {} + | tr '\n' ' ')" >> $GITHUB_OUTPUT | |
pylint: | |
runs-on: ubuntu-20.04 | |
needs: [python-files] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.6 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.6.15 | |
- uses: actions/cache@v3 | |
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 | |
pip --cache-dir ~/pip-cache install ldap3 | |
- name: Run Pylint | |
env: | |
PYTHON_FILES: ${{ needs.python-files.outputs.filelist }} | |
run: | | |
pylint --errors-only $PYTHON_FILES | |
flake8: | |
runs-on: ubuntu-20.04 | |
needs: [python-files] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.6 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.6.15 | |
- uses: actions/cache@v3 | |
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: | # Change PYTHONPATH for different repo | |
flake8 --select F $PYTHON_FILES |