build #25
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: "build" | |
permissions: | |
contents: write # Grant write access to the repository contents | |
on: | |
push: | |
branches: | |
- "**" | |
pull_request: | |
branches: | |
- "**" | |
schedule: | |
- cron: "0 0 * * *" # Run every day | |
workflow_dispatch: | |
create: | |
delete: | |
release: | |
issues: | |
pull_request_review: | |
pull_request_review_comment: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install "nbqa[toolchain]" pylint isort "black[jupyter]" mypy pyupgrade flake8-variables-names pep8-naming flake8-functions-names pandas-stubs git+https://github.com/numpy/numpy-stubs mypy-extensions types-requests types-PyYAML types-setuptools | |
- name: Black | |
run: | | |
black --line-length=79 $(git ls-files '*.py' '*.ipynb') | |
nbqa black --line-length=79 $(git ls-files '*.py' '*.ipynb') | |
- name: Pylint | |
run: | | |
pylint --max-line-length=79 --const-naming-style=any --disable=E2515,C0303,E1101,R1716,E0401,W1514,C0200,C0114,C0301,E0602,W0104,C0302,R0801,E1136 --disable=import-error $(git ls-files '*.py' '*.ipynb') | |
nbqa pylint --max-line-length=79 --const-naming-style=any --disable=E2515,C0303,E1101,R1716,E0401,W1514,C0200,C0114,C0301,E0602,W0104,C0302,R0801,E1136 --disable=import-error $(git ls-files '*.py' '*.ipynb') | |
- name: Flake8 | |
run: | | |
flake8 --ignore=E203,E501,W291,F821,F401,E402,E121 $(git ls-files '*.py' '*.ipynb') | |
nbqa flake8 --ignore=E203,E501,W291,F821,F401,E402,E121 $(git ls-files '*.py' '*.ipynb') | |
- name: Mypy | |
run: | | |
nbqa mypy --exclude=^misc/ --ignore-missing-imports --explicit-package-bases --ignore-missing-imports --disallow-untyped-calls --disallow-untyped-defs --disallow-untyped-decorators --strict --extra-checks --disallow-any-decorated --disallow-any-generics --local-partial-types --pretty --force-uppercase-builtins --force-union-syntax --warn-unreachable --warn-redundant-casts --warn-return-any $(git ls-files '*.ipynb') | |
- name: isort | |
run: | | |
isort --check-only --diff $(git ls-files '*.py' '*.ipynb') | |
nbqa isort --check-only --diff $(git ls-files '*.py' '*.ipynb') | |
- name: pyupgrade | |
run: | | |
nbqa pyupgrade $(git ls-files '*.py' '*.ipynb') | |
- name: Commit changes | |
run: | | |
git config --local user.name "github-actions" | |
git config --local user.email "[email protected]" | |
git add . | |
git commit -m "Format code with Black, isort, and pyupgrade" || echo "No changes to commit" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |