| name: QA | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| python-versions: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| versions: ${{ steps.python-versions.outputs.versions }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get Python versions | |
| id: python-versions | |
| run: | | |
| CLASSIFIERS="$(yq -p toml -o toml '.project.classifiers[]' pyproject.toml | grep "Programming Language :: Python :: " | grep "\.")" | |
| VERSIONS="$(echo "${CLASSIFIERS}" | sed -e 's/Programming Language :: Python :: \([0-9.]*\)$/"\1"/g' | tr '\n' ',' | sed -e 's/,$//g')" | |
| echo "versions=[${VERSIONS}]" > "${GITHUB_OUTPUT}" | |
| qa: | |
| name: Run QA checks | |
| runs-on: ubuntu-latest | |
| needs: python-versions | |
| strategy: | |
| matrix: | |
| python-version: ${{fromJson(needs.python-versions.outputs.versions)}} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v10.3.2 | |
| - name: Set up Node.js LTS | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "lts/*" | |
| - name: Install the world | |
| run: | | |
| uv python install "${{ matrix.python-version }}" | |
| uv sync | |
| - name: Run linting | |
| run: | | |
| uv run ruff format --check | |
| uv run ruff check | |
| uv run validate-pyproject ./pyproject.toml | |
| - name: Run pyright | |
| run: uv run npx pyright@latest | |
| - name: Run mypy | |
| run: uv run mypy --check-untyped-defs . | |
| - name: Run tests | |
| run: uv run pytest ./tests | |
| actionlint: | |
| name: Run actionlint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run actionlint | |
| uses: raven-actions/actionlint@v2 |