chore: migrate pymqrest to uv #7
Workflow file for this run
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: CI - Test and Validate | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - develop | |
| - 'release/**' | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| docs-only: | |
| name: docs-only | |
| runs-on: ubuntu-latest | |
| outputs: | |
| docs_only: ${{ steps.detect.outputs.docs_only }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect docs-only changes | |
| id: detect | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| if [ "${{ github.event_name }}" != "pull_request" ]; then | |
| echo "docs_only=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| files=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[].filename') | |
| if [ -z "$files" ]; then | |
| echo "docs_only=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| docs_only=true | |
| for file in $files; do | |
| if [[ "$file" == docs/* ]] || [[ "$file" == "README.md" ]] || [[ "$file" == "CHANGELOG.md" ]]; then | |
| continue | |
| fi | |
| docs_only=false | |
| break | |
| done | |
| echo "docs_only=$docs_only" >> "$GITHUB_OUTPUT" | |
| dependency-audit: | |
| name: dependency-audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.14 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - name: Install uv | |
| run: python3 -m pip install uv==0.9.26 | |
| - name: Cache uv | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/uv | |
| key: uv-${{ runner.os }}-py3.14-${{ hashFiles('uv.lock') }} | |
| restore-keys: | | |
| uv-${{ runner.os }}-py3.14- | |
| - name: Install dependencies | |
| run: uv sync --frozen --group dev | |
| - name: Run pip-audit (fail on any vulnerability) | |
| run: uv run pip-audit -r requirements.txt -r requirements-dev.txt | |
| test-and-validate: | |
| name: test-and-validate | |
| runs-on: ubuntu-latest | |
| needs: docs-only | |
| if: needs.docs-only.outputs.docs_only != 'true' | |
| strategy: | |
| matrix: | |
| python-version: ["3.14"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Fetch base branch for version checks | |
| if: github.event_name == 'pull_request' | |
| run: git fetch origin ${{ github.base_ref }} --depth=1 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Validate version string policy | |
| run: python3 scripts/dev/validate_version.py | |
| - name: Install uv | |
| run: python3 -m pip install uv==0.9.26 | |
| - name: Validate dependency specifications | |
| run: python3 scripts/dev/validate_dependency_specs.py | |
| - name: Verify uv.lock sync | |
| run: uv lock --check | |
| - name: Cache uv | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/uv | |
| key: uv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }} | |
| restore-keys: | | |
| uv-${{ runner.os }}-py${{ matrix.python-version }}- | |
| - name: Install dependencies | |
| run: uv sync --frozen --group dev | |
| - name: Run ruff check | |
| run: uv run ruff check | |
| - name: Run mypy | |
| run: uv run mypy src/ | |
| - name: Run tests with coverage | |
| run: | | |
| uv run pytest \ | |
| --cov=pymqrest \ | |
| --cov-report=term-missing \ | |
| --cov-branch \ | |
| --cov-fail-under=100 |