Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
60 changes: 40 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
name: CI

permissions:
contents: read
pull-requests: write

on:
push:
branches: ["main"]
branches: [ "main" ]
pull_request:
branches: ["main"]
branches: [ "main" ]

env:
UV_FROZEN: true
COVERAGE_PYTHON: "3.12"
Comment thread
kaitj marked this conversation as resolved.

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: "true"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
pyproject-file: pyproject.toml
- name: Install the project
run: uv sync --all-extras
- uses: astral-sh/setup-uv@v8.1.0
- run: uv sync --all-extras
- name: Check quality
run: |
uv run ruff check bids2table tests
Expand All @@ -32,26 +33,45 @@ jobs:
needs: format
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
python-version: [ "3.11", "3.12", "3.13", "3.14" ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: "true"
- name: Install uv with python version
uses: astral-sh/setup-uv@v6
- uses: astral-sh/setup-uv@v8.1.0
with:
python-version: ${{ matrix.python-version }}

- name: Run tests without cloudpathlib
run: |
uv run pytest tests
uv run pytest \
-m "not cloud" \
--junitxml=pytest-cloudless.xml \
--cov-report=xml:coverage.xml \
--cov bids2table \
tests

- name: Run tests with cloudpathlib
run: |
uv run --all-extras pytest \
--junitxml=pytest.xml \
uv run --extra cloud pytest \
-m "cloud" \
--junitxml=pytest-cloud.xml \
--cov-report=xml:coverage.xml \
--cov=bids2table tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
--cov=bids2table \
--cov-append \
tests

- name: Merge JUnit XML reports
run: |
uvx junitparser merge \
pytest-cloudless.xml \
pytest-cloud.xml \
pytest.xml

- name: Pytest coverage comment
if: github.event_name == 'pull_request' && matrix.python-version ==
env.COVERAGE_PYTHON
uses: MishaKav/pytest-coverage-comment@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
pytest-xml-coverage-path: ./coverage.xml
junitxml-path: ./pytest.xml
9 changes: 2 additions & 7 deletions tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pytest import LogCaptureFixture

import bids2table._indexing as indexing
from bids2table._pathlib import cloudpathlib_is_available

BIDS_EXAMPLES = Path(__file__).parents[1] / "bids-examples"

Expand Down Expand Up @@ -52,9 +51,7 @@ def test_find_bids_datasets():
assert datasets_no_derivatives == expected_datasets_no_derivatives


@pytest.mark.skipif(
not cloudpathlib_is_available(), reason="cloudpathlib not installed"
)
@pytest.mark.cloud
def test_find_bids_datasets_s3():
root = "s3://openneuro.org"
datasets = list(islice(indexing.find_bids_datasets(root, maxdepth=2), 10))
Expand All @@ -80,9 +77,7 @@ def test_index_dataset(root: str, expected_count: int):
assert len(table) == expected_count


@pytest.mark.skipif(
not cloudpathlib_is_available(), reason="cloudpathlib not installed"
)
@pytest.mark.cloud
def test_index_dataset_s3():
root = "s3://openneuro.org/ds000102"
expected_count = 130
Expand Down
5 changes: 1 addition & 4 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pytest

from bids2table._metadata import load_bids_metadata
from bids2table._pathlib import cloudpathlib_is_available

BIDS_EXAMPLES = Path(__file__).parents[1] / "bids-examples"

Expand All @@ -24,9 +23,7 @@ def test_load_bids_metadata(inherit: bool):
assert metadata == expected_metadata


@pytest.mark.skipif(
not cloudpathlib_is_available(), reason="cloudpathlib not installed"
)
@pytest.mark.cloud
def test_load_bids_metadata_s3():
path = (
"s3://openneuro.org/ds000102/sub-01/func/sub-01_task-flanker_run-1_bold.nii.gz"
Expand Down