Skip to content

Merge branch 'run-every' #1909

Merge branch 'run-every'

Merge branch 'run-every' #1909

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python lint and tests
on:
push:
pull_request:
branches: ["dev"]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv and set the python version
id: setup-uv
uses: astral-sh/setup-uv@v6
with:
version: "0.7.19" # It is considered best practice to pin to a specific uv version
# https://github.com/astral-sh/setup-uv?tab=readme-ov-file#enable-caching
enable-cache: true
cache-dependency-glob: |
**/*requirements*.txt
**/pyproject.toml
**/uv.lock
- name: Do something if the cache was restored
if: steps.setup-uv.outputs.cache-hit == 'true'
run: echo "Cache was restored"
- name: Install the project
run: uv sync --all-extras --dev
- name: Run pre-commit hooks
run: uv run pre-commit run --all-files --show-diff-on-failure --color=always
# - uses: pre-commit-ci/lite-action@v1.1.0
# if: always()
test:
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Install uv and set the python version
id: setup-uv
uses: astral-sh/setup-uv@v6
with:
# https://docs.astral.sh/uv/guides/integration/github/#multiple-python-versions
python-version: ${{ matrix.python-version }}
version: "0.7.19" # It is considered best practice to pin to a specific uv version
# https://github.com/astral-sh/setup-uv?tab=readme-ov-file#enable-caching
enable-cache: true
cache-dependency-glob: |
**/*requirements*.txt
**/pyproject.toml
**/uv.lock
- name: Do something if the cache was restored
if: steps.setup-uv.outputs.cache-hit == 'true'
run: echo "Cache was restored"
- name: Install the project
run: uv sync --all-extras --dev
- name: Run tests
# For example, using `pytest`
run: |
uv run pytest tests/unit
uv run pytest -m ci
# # https://github.com/actions/setup-python
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python-version }}
# cache: 'pip' # caching pip dependencies
# # Manually set 'dev-requirements.txt' as the file to use for dependencies, since `requirements.txt` contains runtime dependencies.
# cache-dependency-path: 'dev-requirements.txt'
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r dev-requirements.txt
# - name: Test with pytest
# run: |
# python -m pytest tests/unit
# python -m pytest -m ci