Skip to content

Remove unnecessary pytest-mock dependency (#559) #193

Remove unnecessary pytest-mock dependency (#559)

Remove unnecessary pytest-mock dependency (#559) #193

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: ["*"]
tags: ["release/*"]
pull_request:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
enable-cache: true
- name: Install Python
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync -i https://pypi.org/simple # Ignore download URLs in uv.lock.
- name: Lint with ruff
run: |
uv run ruff check .
uv run ruff format --check .
- name: Test with pytest
run: uv run pytest tests --run-slow
pypi-publish:
name: Upload release to PyPI
needs: test
if: startsWith(github.ref, 'refs/tags/release')
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/cosmic-ray
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
enable-cache: true
- name: Install Python
run: uv python install 3.12
- name: "Build distribution"
run: |
uv pip install build
uv run python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1