ci(tests) Verify runtime deps #3276
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: tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - 'v*.x' | |
| tags: | |
| - '**' | |
| pull_request: | |
| branches: | |
| - '**' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.14'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Test runtime dependencies | |
| # libvcs.pytest_plugin is intentionally excluded: it is a pytest plugin | |
| # and imports pytest at module load. It is only meant to be used in test | |
| # environments where pytest is already a dependency. | |
| run: | | |
| uv run --no-dev -p python${{ matrix.python-version }} -- python -c ' | |
| from libvcs import _internal, cmd, data, sync, url, exc, logger, __version__ | |
| from libvcs._internal import dataclasses, module_loading, query_list, run, shortcuts, subprocess, types | |
| from libvcs.cmd import git as git_cmd, hg as hg_cmd, svn as svn_cmd | |
| from libvcs.sync import git as git_sync, hg as hg_sync, svn as svn_sync | |
| from libvcs.url import git as git_url, hg as hg_url, svn as svn_url | |
| print("libvcs version:", __version__) | |
| ' | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Lint with ruff check | |
| run: uv run ruff check . | |
| - name: Format with ruff | |
| run: uv run ruff format . --check | |
| - name: Lint with mypy | |
| run: uv run mypy . | |
| - name: Print python versions | |
| run: | | |
| python -V | |
| uv run python -V | |
| - name: Test with pytest | |
| run: uv run py.test --cov=./ --cov-append --cov-report=xml | |
| env: | |
| COV_CORE_SOURCE: . | |
| COV_CORE_CONFIG: .coveragerc | |
| COV_CORE_DATAFILE: .coverage.eager | |
| - uses: codecov/codecov-action@v6 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
| permissions: | |
| id-token: write | |
| attestations: write | |
| strategy: | |
| matrix: | |
| python-version: ['3.14'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Build package | |
| run: uv build | |
| - name: Publish package | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| attestations: true | |
| skip-existing: true |