name: Lint check run-name: Lint code on: pull_request: push: branches: - master env: PYTHON_VERSION: 3.8 jobs: changed-files: runs-on: ubuntu-latest name: Get changed files outputs: any_docs_changed: ${{ steps.changed-doc-files.outputs.any_changed }} any_python_changed: ${{ steps.changed-python-files.outputs.any_changed }} changed_doc_files: ${{ steps.changed-doc-files.outputs.all_changed_files }} changed_python_files: ${{ steps.changed-python-files.outputs.all_changed_files }} steps: - uses: actions/checkout@v4 with: fetch-depth: 2 - name: Get changed docs files id: changed-doc-files uses: tj-actions/changed-files@v44 with: files: | docs/** - name: Get changed docs files id: changed-python-files uses: tj-actions/changed-files@v44 with: files: | **.py python-setup: runs-on: ubuntu-latest name: Setup python and poetry steps: - uses: actions/checkout@v4 - name: Install Python tools - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} cache: poetry - uses: abatilo/actions-poetry@v2 - name: Install dependencies run: poetry install --all-extras format: if: needs.changed-files.outputs.any_python_changed == 'true' runs-on: ubuntu-latest name: Check formatting needs: [changed-files, python-setup] steps: - name: Check code formatting uses: liskin/gh-problem-matcher-wrap@v3 with: linters: isort run: poetry run poe check-format ${{ needs.changed-files.outputs.changed_python_files }} lint: if: needs.changed-files.outputs.any_python_changed == 'true' runs-on: ubuntu-latest name: Check linting needs: [changed-files, python-setup] steps: - name: Lint code uses: liskin/gh-problem-matcher-wrap@v3 with: linters: flake8 run: poetry run poe lint ${{ needs.changed-files.outputs.changed_python_files }} mypy: if: needs.changed-files.outputs.any_python_changed == 'true' runs-on: ubuntu-latest name: Check types with mypy needs: [changed-files, python-setup] steps: - name: Type check code uses: liskin/gh-problem-matcher-wrap@v3 continue-on-error: true with: linters: mypy run: poetry run poe check-types --show-column-numbers --no-error-summary ${{ needs.changed-files.outputs.changed_python_files }} docs: if: needs.changed-files.outputs.any_docs_changed == 'true' runs-on: ubuntu-latest name: Check docs needs: [changed-files, python-setup] steps: - uses: sphinx-doc/github-problem-matcher@master name: Build docs with: run: poetry run poe docs