Try out ty for type checking #200
This file contains hidden or 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: Lint and Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| python: | |
| name: Python linting | |
| strategy: | |
| matrix: | |
| py_version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| dependencies: ["constrained", "unconstrained"] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: Enable Python ${{ matrix.py_version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.py_version }} | |
| - name: Use Python ${{ matrix.py_version }} with Poetry | |
| run: poetry env use python${{ matrix.py_version }} | |
| - name: Poetry self-check | |
| run: poetry check | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Update dependencies | |
| if: matrix.dependencies == 'unconstrained' | |
| run: poetry update | |
| - name: Check ruff formating | |
| run: poetry run ruff format --diff ssh_zone_handler/ tests/ | |
| - name: Check ruff linting | |
| run: poetry run ruff check ssh_zone_handler/ tests/ | |
| - name: Use ty to verify type hints | |
| run: poetry run ty check --output-format=github | |
| - name: Use mypy to verify type hints | |
| run: poetry run mypy --strict ssh_zone_handler/ | |
| - name: Run Pytest | |
| run: poetry run pytest | |
| secondary: | |
| name: Secondary linting | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Secondary Linters | |
| uses: andreaso/setup-secondary-linters@main | |
| - name: Lint GitHub Actions workflows | |
| run: actionlint | |
| - name: Analyze GitHub Actions | |
| run: zizmor --format=github . | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Markdown lint README | |
| run: markdownlint --disable MD012 MD013 MD040 -- README.md |