Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Setup
description: Install uv and sync the project environment

inputs:
python-version:
description: Python version for uv to install (defaults to uv's own default)
required: false
default: ""

runs:
using: composite
steps:
- name: Install latest uv
uses: astral-sh/setup-uv@v8.2.0
with:
python-version: ${{ inputs.python-version }}
enable-cache: true

- name: Install dependencies
shell: bash
run: uv sync --all-groups

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose the point is to use the test group specifically? That should also be mentioned in docs/README.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is equivalent to running uv sync --group dev, but since uv sync by default looks for dev, hence equivalent to uv sync.

Adding all-groups is so that if we added more groups later, eg. docs, lint, they would all be included. Which I think is the right approach.

94 changes: 56 additions & 38 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: CI

on:
push:
Expand All @@ -14,49 +14,67 @@ permissions:
contents: read

jobs:
tests:
timeout-minutes: 45
runs-on: ${{ matrix.os }}
environment:
name: env1
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- uses: ./.github/actions/setup

- name: Run pre-commit
run: uvx pre-commit run --all-files

test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
pyv: ["3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pyv }}
cache: 'pip'

- name: install
run: |
pip install --upgrade pip wheel
pip install -e . pytest
pip list

- name: run tests
timeout-minutes: 15
env:
GDRIVE_FSSPEC_DRIVE: gdrivefs-testing
GDRIVE_FSSPEC_CREDENTIALS_PATH: ${{ secrets.GDRIVE_FSSPEC_CREDENTIALS_PATH }}
# Override the default marker filter so CI runs integration tests too.
run: pytest -vv -m ""
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}

- name: Run unit tests
run: uv run pytest -v

integration:
name: Integration tests
runs-on: ubuntu-latest
# Run only when Drive credentials are available: manual dispatch, pushes to
# master, or PRs from this repo (fork PRs are skipped — they cannot use secrets).
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository)
timeout-minutes: 15
environment:
name: env1

lint:
name: lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@main
- uses: actions/setup-python@main
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- uses: ./.github/actions/setup
with:
python-version: "3.11"
- uses: pre-commit/action@main
python-version: "3.13"

- name: Run integration tests
env:
GDRIVE_FSSPEC_DRIVE: gdrivefs-testing
GDRIVE_FSSPEC_CREDENTIALS_PATH: ${{ secrets.GDRIVE_FSSPEC_CREDENTIALS_PATH }}
run: uv run pytest -v -m integration
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ celerybeat-schedule
.venv
venv/
ENV/
uv.lock
.idea/

# Spyder project settings
Expand All @@ -105,5 +106,5 @@ ENV/
# mypy
.mypy_cache/

/gdrive_fsspec/_version.py
/src/gdrive_fsspec/_version.py
/tmp/*
10 changes: 4 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@ exclude: >
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-json
- id: check-yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.2
rev: v0.15.16
hooks:
# Run the linter.
- id: ruff
args: [ --fix, "--show-fixes"]
args: [--fix, --show-fixes]
- id: ruff-format
types_or: [python]
- repo: https://github.com/codespell-project/codespell
rev: v2.4.0
rev: v2.4.2
hooks:
- id: codespell
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ For a personal Drive (no Shared Drive), run tests with user OAuth instead: `GDRI
All tests use a directory named `gdrive_fsspec_testdir`.

```sh
pip install -e . pytest
uv sync
Comment thread
martindurant marked this conversation as resolved.
Resolved
pytest -v -m ""
```

Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ dynamic = ["version"]
description = "File system on GDrive"
readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">=3.10"
license = { file = "LICENSE" }
Comment thread
martindurant marked this conversation as resolved.
Resolved
license = "BSD-3-Clause"
license-files = ["LICENSE"]
maintainers = [
{name = "Martin Durant", email = "martin.durant@alumni.utoronto.ca"}
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -34,13 +34,14 @@ dependencies = [
[dependency-groups]
dev = [
"pytest>=9.0.3",
"ruff>=0.15.16",
]

[project.urls]
Source = "http://github.com/fsspec/gdrive-fsspec"

[tool.setuptools_scm]
version_file = "gdrive_fsspec/_version.py"
version_file = "src/gdrive_fsspec/_version.py"

[tool.pytest.ini_options]
addopts = """\
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from gdrive_fsspec.core import GoogleDriveFileSystem
from gdrive_fsspec import GoogleDriveFileSystem


@pytest.fixture()
Expand Down