Skip to content

Enhance GitHub Actions CI and deploy workflow#122

Merged
C-Achard merged 2 commits into
cy/py-312-supportfrom
cy/update-ci-312
May 19, 2026
Merged

Enhance GitHub Actions CI and deploy workflow#122
C-Achard merged 2 commits into
cy/py-312-supportfrom
cy/update-ci-312

Conversation

@C-Achard
Copy link
Copy Markdown
Collaborator

Update CI following changes in #120 to run with latest python versions, and other tiny workflow improvements.

CI/CD Workflow Modernization and Expansion:

  • Expanded the test matrix to include ubuntu-latest, windows-latest, and macos-latest platforms, and Python versions 3.10, 3.11, and 3.12, increasing test coverage and compatibility.
  • Updated action versions (actions/checkout, actions/setup-python, codecov/codecov-action) to the latest major versions for improved reliability and security.
  • Added pip caching to speed up dependency installation.

Testing Improvements:

  • Simplified dependency installation by focusing on tox and removing direct installs of other libraries, delegating to tox for environment management.

Deployment Workflow Enhancements:

  • Updated deployment steps: now uses latest actions, splits package build and publish steps, and uses python -m build for package creation before uploading with twine.

@C-Achard C-Achard requested a review from Copilot May 19, 2026 13:12
@C-Achard C-Achard self-assigned this May 19, 2026
@C-Achard C-Achard added the enhancement New feature or request label May 19, 2026
@C-Achard C-Achard marked this pull request as ready for review May 19, 2026 13:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Modernizes the repository’s GitHub Actions CI/CD by expanding the test matrix to newer Python versions and multiple OSes, and by refreshing the packaging/deploy steps for PyPI releases.

Changes:

  • Expanded CI matrix to ubuntu-latest, windows-latest, macos-latest and Python 3.103.12, with pip caching enabled.
  • Refactored CI install/test steps to install only tox/tox-gh-actions and run tox (with Linux using Xvfb).
  • Updated release deploy job to build via python -m build and publish via twine.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/test_and_deploy.yml
C-Achard added 2 commits May 19, 2026 15:17
Modernize and expand the test-and-deploy workflow: bump action versions (checkout/setup-python), enable pip caching, and broaden the matrix to ubuntu, windows, and macos with Python 3.10–3.12. Add fail-fast:false and platform-specific steps (Linux Qt libs, Windows OpenGL with pwsh). Install tox centrally and run tests per-OS with appropriate Qt/PyQt and PyVista env vars; upload coverage with codecov v6. Adjust deploy job to trigger on semver-style tags (refs/tags/v*), update setup actions, split build and publish steps (build then twine upload), and simplify dependency installs.
@C-Achard C-Achard changed the base branch from cy/update-pre-commit-hooks to cy/py-312-support May 19, 2026 13:17
@C-Achard C-Achard force-pushed the cy/update-ci-312 branch from 8f63720 to 6cc0c75 Compare May 19, 2026 13:19
@C-Achard C-Achard merged commit 533a0ce into cy/py-312-support May 19, 2026
C-Achard added a commit that referenced this pull request May 19, 2026
* Consolidate project config into pyproject and modernize CI

Remove legacy packaging and test config files (setup.cfg, requirements.txt, .isort.cfg, napari_cellseg3d/_tests/pytest.ini, and its conftest). Migrate and update metadata in pyproject.toml: bump supported Python classifiers to 3.10–3.12, add napari manifest entry-point, include napari.yaml in package data, simplify dynamic fields, adjust optional dependencies (add PyQt6, pyside6, move pydensecrf2 to crf extra) and streamline dev dependencies (remove black/isort as direct dev deps). Update tooling rules (ruff token change) and remove redundant tool configs. Update tox.ini to target py310/311/312 across linux/windows/macos, expose platform mappings for GH Actions, and switch to using extras for test/crf/pyqt6 while keeping usedevelop and running pytest as the test command.

* Disable flaky test; use ndarray.reshape; fix viewer

Skip a test that causes GitHub Actions to freeze by importing pytest and marking it skipped (needs to be fixed or removed). In worker_inference, replace np.reshape(...) with the ndarray.reshape(...) call and remove an obsolete commented reshape for clarity. In dev_scripts/correct_labels, initialize a napari.Viewer and add the image via viewer.add_image instead of calling napari.view_image(), ensuring the image layer is properly created.

* Enhance GitHub Actions CI and deploy workflow (#122)

* Enhance GitHub Actions CI and deploy workflow

Modernize and expand the test-and-deploy workflow: bump action versions (checkout/setup-python), enable pip caching, and broaden the matrix to ubuntu, windows, and macos with Python 3.10–3.12. Add fail-fast:false and platform-specific steps (Linux Qt libs, Windows OpenGL with pwsh). Install tox centrally and run tests per-OS with appropriate Qt/PyQt and PyVista env vars; upload coverage with codecov v6. Adjust deploy job to trigger on semver-style tags (refs/tags/v*), update setup actions, split build and publish steps (build then twine upload), and simplify dependency installs.

* Fix missing OSs in tox.ini

* Add setuptools_scm versioning and CI improvements

Enable setuptools_scm-based versioning and tighten CI/build checks. Updates include:

- Use setuptools_scm: add setuptools-scm to build-system requires and configure version_file in pyproject.toml so package version is generated into napari_cellseg3d/_version.py.
- Make package import version dynamically: __init__.py now prefers the generated _version and falls back to importlib.metadata.version.
- Bump minimum Python to >=3.10 in pyproject.
- CI/workflow changes: fetch full Git history (fetch-depth: 0), restrict Codecov upload to ubuntu-latest + Python 3.12, pin the build job to Python 3.12, and add a twine check step before publishing.
- Minor dev script cleanup: remove unused assignment when adding image to napari viewer.

These changes improve reproducible versioning, ensure the build uses an appropriate Python/tooling set, and add a safety check before publishing.

* Skip weight download test on CI

Use the generic CI environment variable when skipping the weight download test (os.getenv("CI") instead of "GITHUB_ACTIONS") and update the skip reason to mention CI. Also add a small formatting tweak (blank line after import) and adjust file ending.

* Add tests for plugin_base SingleImage/Folder

Expand unit test coverage for napari_cellseg3d.code_plugins.plugin_base. Rename a test for updating default paths and add many new tests covering: results path creation/validation, _build not implemented, navigation buttons, dock widget removal (including LookupError handling), dataset path extraction, folder plugin default path updates, dataset loading (images, labels, unsupervised), dataset load warnings, file/folder dialog integrations (filetype and path updates), and visibility helpers. Also add necessary imports and use plugin_base for monkeypatching ui/utils/logger behaviors.

* Set Windows env vars in tox.ini

Add Windows-specific environment variables to tox.ini passenv: set USERNAME to 'runneradmin' and TORCHINDUCTOR_CACHE_DIR to {envtmpdir}/torchinductor. Ensures Windows test runs use a consistent username and place TorchInductor cache in the temporary directory.

* Use qtbot and QWidget in navigation test

Update test_make_navigation_buttons to use real QWidget instances and the qtbot fixture instead of SimpleNamespace. The test now accepts qtbot, creates two QWidgets, registers them with qtbot.addWidget, and adds them as tabs before checking navigation buttons—ensuring proper Qt widget management and avoiding teardown/warning issues.

* Add setenv header to tox.ini

Insert the missing `setenv` key in tox.ini so the Windows-specific environment variables (USERNAME, TORCHINDUCTOR_CACHE_DIR) are declared under the correct section. This fixes configuration formatting and ensures those variables are applied in tox runs on Windows.

* Fix optional PyQt deps

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Update tox.ini

* Revert "Update tox.ini"

This reverts commit 89921c7.

* Use napari viewer fixture in test_relabel

Update test_relabel to use the make_napari_viewer_proxy fixture: create a viewer instance and pass it to cl.relabel via viewer=viewer. This ensures the relabel test runs with a proxied Napari viewer (e.g. for headless/test environments) and verifies behavior when a viewer is provided.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants