Skip to content

[Enhencement] - Add mypy to GitHub Actions #34

[Enhencement] - Add mypy to GitHub Actions

[Enhencement] - Add mypy to GitHub Actions #34

Workflow file for this run

name: Lint
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
- master
permissions:
contents: read
jobs:
ruff-changes-in-file:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install Ruff
run: pip install ruff
- name: Run Ruff
run: ruff check $(git diff --name-only --cached -- '*.py')
mypy-files-that-changed:
runs-on: ubuntu-latest
name: Test changed-files
steps:
- uses: actions/checkout@v4
- name: Get changed files in the docs folder
id: changed-files-specific
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
with:
files: docs/*.{js,html} # Alternatively using: `docs/**`
files_ignore: docs/static.js
- name: Run step if any file(s) in the docs folder change
if: steps.changed-files-specific.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
run: |
echo "One or more files in the docs folder has changed."
echo "List all the files that have changed: $ALL_CHANGED_FILES"
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: '3.x'
- run: pip install mypy
- name: Get Python changed files
id: changed-py-files
uses: tj-actions/changed-files@v23
with:
files: |
*.py
**/*.py
- name: Run if any of the listed files above is changed
if: steps.changed-py-files.outputs.any_changed == 'true'
run: mypy ${{ steps.changed-py-files.outputs.all_changed_files }} --ignore-missing-imports