Skip to content

Commit

Permalink
chore: Update CI configuration to use more modern OS and python versi…
Browse files Browse the repository at this point in the history
…ons (#1207)

## Summary by Sourcery

Update CI configurations to use Ubuntu 24.04 and Python 3.12, ensuring
compatibility with the latest environments and dependencies.

Build:
- Update Azure Pipelines and GitHub Actions to use Ubuntu 24.04 as the
default operating system for CI jobs.

CI:
- Upgrade Python version to 3.12 across various CI workflows and update
dependencies accordingly.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Chores**
- Updated testing workflows to utilize a newer operating system version
(Ubuntu 24.04) and Python version (3.12) for enhanced testing
capabilities.
- Maintained existing job structures and configurations to ensure
continuity in testing processes.
- **New Features**
- Enhanced compatibility with the latest dependencies and testing
environments through updated configurations across various workflows,
including broader Python version support (3.9, 3.10, 3.11, 3.12).
- Introduced a new job for package checking in the testing workflow to
ensure package integrity.
- Added a new `SelectDirectoryDialog` class to improve file selection
handling.
- **Bug Fixes**
- Improved dependency management in the environment configuration by
removing outdated dependencies and refining the structure for better
compatibility and functionality.
- **Tests**
- Enhanced clarity and specificity of tests for loading and saving
dialogs, ensuring they accurately validate functionality with updated
method signatures and additional test cases.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
Czaki authored Oct 21, 2024
1 parent 895e629 commit 505808a
Show file tree
Hide file tree
Showing 16 changed files with 193 additions and 117 deletions.
6 changes: 3 additions & 3 deletions .azure-pipelines/pyinstaller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ parameters:
type: string

steps:
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.11', architecture: x64}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.12', architecture: x64}}
- template: pip_cache.yaml
parameters:
key: pyinstaller | requirements/constraints_py3.9.txt | "$(Agent.OS)" | "$(PY)"
key: pyinstaller | requirements/constraints_py3.12.txt | "$(Agent.OS)" | "$(PY)"
path: ${{ parameters.cache_dir }}
- bash: |
python -m pip install -U pip wheel setuptools
displayName: install libs
- bash: python -m pip install .[pyinstaller] -c requirements/constraints_py3.11.txt
- bash: python -m pip install .[pyinstaller] -c requirements/constraints_py3.12.txt
displayName: install partseg
- bash: |
python build_utils/create_and_pack_executable.py --no-simple-zip
Expand Down
53 changes: 48 additions & 5 deletions .github/workflows/base_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ on:
os:
required: false
type: string
default: "ubuntu-20.04"
default: "ubuntu-24.04"
tox_args:
required: false
type: string
default: ""
pytest_args:
required: false
type: string
default: ""
napari:
required: false
type: string
Expand All @@ -38,6 +42,10 @@ on:
required: false
type: string
default: ""
artifact_suffix:
required: false
type: string
default: ""


jobs:
Expand Down Expand Up @@ -85,21 +93,56 @@ jobs:
python -m pip install -r requirements/requirements_dev.txt tox-gh-actions>=2.12.0 tox-min-req tox-uv
pip list
- name: Test with tox
- name: Test with tox PartSegImage
if: ${{ inputs.napari == 'latest' }}
run: python -m tox ${{ inputs.tox_args }} -- package/tests/test_PartSegImage ${{ inputs.pytest_args }}
env:
PYVISTA_OFF_SCREEN: True # required for opengl on windows
NAPARI: ${{ inputs.napari }}
BACKEND: ${{ inputs.qt_backend }}
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}

- name: Test with tox PartSegCore
if: ${{ inputs.napari == 'latest' }}
run: python -m tox ${{ inputs.tox_args }} -- package/tests/test_PartSegCore ${{ inputs.pytest_args }}
env:
PYVISTA_OFF_SCREEN: True # required for opengl on windows
NAPARI: ${{ inputs.napari }}
BACKEND: ${{ inputs.qt_backend }}
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}

- name: Test with tox PartSeg
if: ${{ inputs.napari == 'latest' }}
uses: aganders3/headless-gui@v2
timeout-minutes: ${{ inputs.timeout }}
with:
run: python -m tox ${{ inputs.tox_args }}
run: python -m tox ${{ inputs.tox_args }} -- package/tests/test_PartSeg ${{ inputs.pytest_args }}
env:
PYVISTA_OFF_SCREEN: True # required for opengl on windows
NAPARI: ${{ inputs.napari }}
BACKEND: ${{ inputs.qt_backend }}
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}

- name: Test with tox all
if: ${{ inputs.napari != 'latest' }}
uses: aganders3/headless-gui@v2
timeout-minutes: ${{ inputs.timeout }}
with:
run: python -m tox ${{ inputs.tox_args }} -- ${{ inputs.pytest_args }}
env:
PYVISTA_OFF_SCREEN: True # required for opengl on windows
NAPARI: ${{ inputs.napari }}
BACKEND: ${{ inputs.qt_backend }}
PIP_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}
UV_CONSTRAINT: ${{ inputs.napari == 'latest' && format('requirements/constraints_py{0}{1}.txt', inputs.python_version, inputs.pydantic ) || '' }}


- uses: actions/upload-artifact@v4
with:
name: timing-report-${{ inputs.os }}-py-${{ inputs.python_version }}-${{ inputs.napari }}-${{ inputs.qt_backend }}-${{ inputs.coverage }}
name: timing-report-${{ inputs.os }}-py-${{ inputs.python_version }}-${{ inputs.napari }}-${{ inputs.qt_backend }}-${{ inputs.coverage }}${{ inputs.artifact_suffix }}
path: |
./report-*.json
retention-days: 7
Expand All @@ -108,7 +151,7 @@ jobs:
uses: actions/[email protected]
if: ${{ inputs.coverage }}
with:
name: cov-reports-${{ inputs.os }}-py-${{ inputs.python_version }}-${{ inputs.napari }}-${{ inputs.qt_backend }}
name: cov-reports-${{ inputs.os }}-py-${{ inputs.python_version }}-${{ inputs.napari }}-${{ inputs.qt_backend }}${{ inputs.artifact_suffix }}
include-hidden-files: 'true'
path: |
./.coverage.*
6 changes: 3 additions & 3 deletions .github/workflows/make_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- uses: tlambert03/setup-qt-libs@v1
- name: Install Windows OpenGL
if: runner.os == 'Windows'
Expand All @@ -44,12 +44,12 @@ jobs:
if (Test-Path -Path "C:\Windows\system32\opengl32.dll" -PathType Leaf) {Exit 0} else {Exit 1}
shell: powershell
- name: Install PartSeg
run: python -m pip install --editable ".[pyinstaller]" --constraint requirements/constraints_py3.10.txt
run: python -m pip install --editable ".[pyinstaller]" --constraint requirements/constraints_py3.12.txt

- name: compile numpy on macos-14
if: ${{ matrix.os == 'macos-14' }}
run: |
python -m pip install --no-binary numpy numpy --force-reinstall --constraint requirements/constraints_py3.10.txt
python -m pip install --no-binary numpy numpy --force-reinstall --constraint requirements/constraints_py3.12.txt
- name: Build PartSeg bundle
run: python build_utils/create_and_pack_executable.py
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_napari_repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
download_data:
name: Download test data
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- shell: bash
Expand All @@ -33,7 +33,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ ubuntu-22.04 ]
platform: [ ubuntu-24.04 ]
python: ['3.9' , '3.10', '3.11', '3.12']
napari_version: ['repo']
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_napari_widgets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
qt_backend: ["PyQt5", "PySide2"]
os: ["ubuntu-22.04"]
os: ["ubuntu-24.04"]
uses: ./.github/workflows/base_test_workflow.yml
with:
python_version: "3.10"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test_prereleases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
jobs:
download_data:
name: Download test data
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- shell: bash
Expand All @@ -41,7 +41,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [windows-2022, macos-14, ubuntu-22.04]
platform: [windows-2022, macos-14, ubuntu-24.04]
python: [3.12]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -108,9 +108,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python 3.11
name: Install Python 3.12
with:
python-version: 3.11
python-version: 3.12
- uses: tlambert03/setup-qt-libs@v1
- name: Install dependencies
run: |
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: "linux"
PYTHON: "3.11"
PYTHON: "3.12"
RUN_ID: ${{ github.run_id }}
TITLE: '[test-bot] pyinstaller bundle --pre is failing'
with:
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,24 @@ jobs:
fail-fast: false
matrix:
python_version: ["3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-20.04"]
os: ["ubuntu-24.04"]
qt_backend: ["PyQt5"]
tox_args: [ "" ]
include:
- python_version: "3.11"
os: "macos-13"
qt_backend: "PyQt5"
- python_version: "3.12"
os: "macos-14"
qt_backend: "PyQt6"
- python_version: "3.11"
os: "windows-2019"
os: "windows-latest"
qt_backend: "PyQt5"
- python_version: "3.10"
os: "ubuntu-20.04"
qt_backend: "PySide2"
- python_version: "3.10"
os: "ubuntu-22.04"
os: "ubuntu-24.04"
qt_backend: "PySide6"
- python_version: "3.12"
os: "ubuntu-22.04"
Expand All @@ -91,7 +94,7 @@ jobs:
fail-fast: false
matrix:
python_version: ["3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-20.04", "macos-13", "windows-2019"]
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
qt_backend: ["PySide2", "PyQt5"]
include:
- python_version: "3.12"
Expand All @@ -112,12 +115,18 @@ jobs:
qt_backend: "PySide2"
- python_version: "3.12"
qt_backend: "PySide2"
- os: "macos-14"
qt_backend: "PySide2"
- os: "macos-14"
python_version: "3.9"
with:
test_data: True
python_version: ${{ matrix.python_version }}
os: ${{ matrix.os }}
qt_backend: ${{ matrix.qt_backend }}
pydantic: ${{ matrix.pydantic }}
artifact_suffix: "-main"
pytest_args: "-v"

test_coverage:
needs: download_data
Expand Down Expand Up @@ -182,7 +191,7 @@ jobs:

test_conda:
name: Test PartSeg conda
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
needs: download_data
steps:
- uses: actions/checkout@v4
Expand All @@ -193,7 +202,7 @@ jobs:
use-mamba: true
channels: conda-forge
channel-priority: strict
python-version: "3.11"
python-version: "3.12"

- uses: tlambert03/setup-qt-libs@v1

Expand Down Expand Up @@ -236,7 +245,7 @@ jobs:
- name: Test with tox
uses: aganders3/headless-gui@v2
with:
run: conda run -n test --no-capture-output tox -e py311-PySide2-conda
run: conda run -n test --no-capture-output tox -e py312-PySide2-conda
timeout-minutes: 60

check-package:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upgrade-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
cache: pip
cache-dependency-path: 'pyproject.toml'
- name: Upgrade Python dependencies
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ formats: all
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"
apt_packages:
- graphviz


# Optionally set the version of Python and requirements required to build your docs
python:
install:
- requirements: requirements/constraints_py3.11_docs.txt
- requirements: requirements/constraints_py3.12_docs.txt
- method: pip
path: .
extra_requirements:
Expand Down
22 changes: 11 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ stages:
- stage: GetTestData
jobs:
- job: linux
pool: {vmImage: 'Ubuntu-22.04'}
pool: {vmImage: 'Ubuntu-24.04'}
steps:
- script: bash build_utils/download_data.sh
displayName: "download data"
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'
versionSpec: '3.12'
displayName: 'Use Python $(python.version)'
- script: python build_utils/cut_changelog.py changelog_cut.md
displayName: "Cut changelog"
Expand Down Expand Up @@ -59,9 +59,9 @@ stages:
- job: manifest_check
pool: {vmImage: 'Ubuntu-latest'}
steps:
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.10', architecture: x64}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.12', architecture: x64}}
- bash: |
python -m pip install check-manifest==0.49 numpy==1.22.3
python -m pip install check-manifest==0.50 numpy==2.0.2
displayName: InstallDeps
- bash: check-manifest
displayName: check-manifest
Expand All @@ -74,10 +74,10 @@ stages:
variables:
pip_cache_dir: $(Pipeline.Workspace)/.pip
steps:
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.11', architecture: x64}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.12', architecture: x64}}
- template: .azure-pipelines/pip_cache.yaml
parameters:
key: doc | requirements/constraints_py3.11_docs.txt | "$(PY)"
key: doc | requirements/constraints_py3.12_docs.txt | "$(PY)"
path: $(pip_cache_dir)
- bash: |
python -m pip install tox
Expand All @@ -91,24 +91,24 @@ stages:
artifactName: docs

- job: Notebook_check
pool: {vmImage: 'Ubuntu-22.04'}
pool: {vmImage: 'Ubuntu-24.04'}
continueOnError: true
variables:
DATA_PATH: typy_neuronow2
pip_cache_dir: $(Pipeline.Workspace)/.pip
steps:
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.11', architecture: x64}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.12', architecture: x64}}
- template: .azure-pipelines/pip_cache.yaml
parameters:
key: notebook | requirements/constraints_py3.11.txt | "$(PY)"
key: notebook | requirements/constraints_py3.12.txt | "$(PY)"
path: $(pip_cache_dir)
- bash: |
python -m pip install tox
displayName: "Install tox"
- bash: tox -e jupyter
displayName: "Run Notebook"
env:
PIP_CONSTRAINT: requirements/constraints_py3.11.txt
PIP_CONSTRAINT: requirements/constraints_py3.12.txt

- stage: Tests_linux
dependsOn: [GetTestData, formatting_check]
Expand All @@ -117,7 +117,7 @@ stages:
pip_cache_dir: $(Pipeline.Workspace)/.pip
jobs:
- job: test_linux
pool: { vmImage: 'ubuntu-22.04' }
pool: { vmImage: 'ubuntu-24.04' }
variables:
AZURE_PIPELINES: 1
DISPLAY: ':99.0'
Expand Down
Loading

0 comments on commit 505808a

Please sign in to comment.