Skip to content
Open
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
36 changes: 36 additions & 0 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Benchmark

permissions:
contents: read

on:
pull_request:
branches: ["main"]

jobs:
benchmark:
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true
ref: ${{ github.head_ref }}
- uses: astral-sh/setup-uv@v8.1.0
- run: uv sync --frozen --all-extras
- name: Run benchmarks
id: run-benchmarks
run: |
uv run python scripts/benchmark.py -b $BRANCH_NAME -o . -f benchmarks.md -t 0.05
- name: Record pr number
run: |
echo "${{ github.event.number }}" > pr-number.txt
- uses: actions/upload-artifact@v7
with:
name: benchmark
retention-days: 7
path: |
benchmarks.md
pr-number.txt
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ jobs:
python-version: ${{ matrix.python-version }}
- run: uv sync --all-extras

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

- name: Run tests with cloudpathlib
- name: Run cloud tests
run: |
uv run pytest \
-m "cloud" \
-m "cloud and not benchmark" \
--junitxml=pytest-cloud.xml \
--cov-report=xml:coverage.xml \
--cov=bids2table \
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/coverage.yaml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Report

on:
workflow_run:
workflows: ["CI", "Benchmark"]
types: [completed]

permissions:
pull-requests: write
actions: read

jobs:
report:
if: >-
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- name: Download CI artifact
if: github.event.workflow_run.name == 'CI'
continue-on-error: true
uses: actions/download-artifact@v8
with:
name: coverage
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Download Benchmark artifact
if: github.event.workflow_run.name == 'Benchmark'
continue-on-error: true
uses: actions/download-artifact@v8
with:
name: benchmark
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- id: pr
run: echo "number=$(cat pr-number.txt)" >> "$GITHUB_OUTPUT"

- name: Pytest coverage comment
if: github.event.workflow_run.name == 'CI'
uses: MishaKav/pytest-coverage-comment@v1
with:
issue-number: ${{ steps.pr.outputs.number }}
pytest-xml-coverage-path: ./coverage.xml
junitxml-path: ./pytest.xml

- name: Benchmark find comment
if: github.event.workflow_run.name == 'Benchmark'
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ steps.pr.outputs.number }}
comment-author: "github-actions[bot]"
body-includes: "Benchmark Results"

- name: Benchmark create / update comment
if: github.event.workflow_run.name == 'Benchmark'
uses: peter-evans/create-or-update-comment@v5
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ steps.pr.outputs.number }}
body-path: "benchmarks.md"
edit-mode: replace
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ htmlcov

# Local data and scratch
.scratch
benchmarks/

# Local virtual environment
.venv
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ pybids = ["pandas>=2.0.0"]
[dependency-groups]
dev = [
"pdoc>=16.0.0",
"polars>=1.40.1",
"pre-commit>=4.6.0",
"pytest>=9.0.3",
"pytest-benchmark>=5.2.3",
"pytest-cov>=7.1.0",
"ruff>=0.15.13",
]
Expand Down Expand Up @@ -68,4 +70,8 @@ lint.extend-select = ["I"]
[tool.pytest.ini_options]
log_cli = true
log_cli_level = "INFO"
markers = ["cloud: Tests requiring cloud group dependencies"]
addopts = "--import-mode=importlib"
markers = [
"benchmark: Tests used for benchmarking",
"cloud: Tests requiring cloud group dependencies",
]
Loading
Loading