Merge pull request #1 from reillymck/ben #5
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 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
pylint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get Diff Action | |
uses: technote-space/get-diff-action@v6 | |
with: | |
PATTERNS: | | |
+(scripts|resources|bfasst)/**/*.py | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
if: env.GIT_DIFF | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
if: env.GIT_DIFF | |
- name: Check for syntax errors with pylint | |
run: | | |
pylint --errors-only $(git ls-files --directory scripts --directory bfasst | grep -e ".py$") | |
if: env.GIT_DIFF | |
- name: Analysing the code with pylint | |
run: | | |
pylint ${{ env.GIT_DIFF_FILTERED }} | |
if: env.GIT_DIFF | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Run format | |
run: | | |
make format | |
- name: Check for formatting errors | |
run: | | |
git diff --exit-code | |
if [ $? -eq 1 ]; then | |
echo "Formatting errors detected. Please run 'make format' and commit the changes." | |
exit 1 | |
fi | |