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
16 changes: 13 additions & 3 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
pull_request:
branches:
- main
workflow_dispatch: # Manual trigger for publishing docs

jobs:
build-docs:
Expand All @@ -24,7 +25,7 @@ jobs:
- uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-

Expand All @@ -38,16 +39,25 @@ jobs:
pip install -U nibabel
pip install -q ipython Sphinx sphinx-gallery numpydoc # TODO: move to pyproject.toml
pip install -e . --no-build-isolation --group dev
playwright install --with-deps --only-shell chromium
python -c 'import cortex; print(cortex.__full_version__)'

- name: Cache Playwright browsers
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pyproject.toml') }}

- name: Install Playwright Chromium
run: playwright install --with-deps --only-shell chromium

- name: Build documents
timeout-minutes: 20
run: |
cd docs && make html && cd ..
touch docs/_build/html/.nojekyll

- name: Publish to gh-pages if tagged
if: startsWith(github.ref, 'refs/tags')
if: startsWith(github.ref, 'refs/tags') || github.event_name == 'workflow_dispatch'
uses: JamesIves/github-pages-deploy-action@v4.8.0
with:
branch: gh-pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install_from_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-

Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Publish to PyPI
on:
release:
types: [published]
workflow_dispatch: # Manual trigger for testing TestPyPI

jobs:
build:
Expand Down Expand Up @@ -43,7 +42,6 @@ jobs:

publish-to-pypi:
name: Publish to PyPI
if: github.event_name == 'release' # Skip on manual workflow_dispatch
needs: build
runs-on: ubuntu-latest
environment:
Expand All @@ -61,25 +59,3 @@ jobs:

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

publish-to-testpypi:
name: Publish to TestPyPI
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/pycortex
permissions:
id-token: write # Required for trusted publishing

steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
19 changes: 13 additions & 6 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-

Expand All @@ -39,14 +39,21 @@ jobs:
# force using latest nibabel
pip install -U nibabel
pip install -e '.[headless]' --no-build-isolation
pip install -e . --no-build-isolation --group dev
python -c 'import cortex; print(cortex.__full_version__)'

- name: Cache Playwright browsers
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pyproject.toml') }}

- name: Install Playwright Chromium
run: playwright install --with-deps --only-shell chromium

- name: Test with pytest
timeout-minutes: 10 # in case webviewer tests hang
run: |
pip install -e . --no-build-isolation --group dev
playwright install --with-deps --only-shell chromium
pytest --cov=./
timeout-minutes: 20 # in case webviewer tests hang
run: pytest --cov=./

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
pycortex
========
[![Build Status](https://github.com/gallantlab/pycortex/actions/workflows/run_tests.yml/badge.svg)](https://github.com/gallantlab/pycortex/actions/workflows/run_tests.yml)
[![Python version](https://img.shields.io/badge/python-3.6%2B-blue)](https://www.python.org/downloads/release/python)
[![codecov](https://codecov.io/gh/gallantlab/pycortex/branch/main/graph/badge.svg)](https://codecov.io/gh/gallantlab/pycortex)
[![PyPI](https://img.shields.io/pypi/v/pycortex)](https://pypi.org/project/pycortex/)
[![Python version](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/downloads/release/python)
[![License](https://img.shields.io/badge/License-BSD%202--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)


Expand Down