Skip to content

Use Windows 2022 rather than deprecated Windows 2019 on azure #1438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2025

Conversation

tpaviot
Copy link
Owner

@tpaviot tpaviot commented Jun 12, 2025

Summary by Sourcery

Switch CI to use Windows Server 2022 instead of the deprecated 2019 image, migrate all Ubuntu builds to 24.04, and refactor the conda-build workflow to consolidate environment setup and build steps.

Enhancements:

  • Consolidate the conda environment creation step across platforms and remove legacy Windows-2019 logic

CI:

  • Update all Windows pipeline jobs to use windows-2022 and rename them accordingly
  • Remove Ubuntu 22.04 references and migrate all Linux jobs to ubuntu-24.04 for Python 3.10, 3.11, and 3.12
  • Refactor the Windows-2022 job in conda-build.yml to set VS2022 variables, activate the conda env, and run the build inline
  • Ensure non-Windows jobs still run conda-build under the created environment with the adjusted failOnStderr settings

Copy link

sourcery-ai bot commented Jun 12, 2025

Reviewer's Guide

This PR migrates all Windows Azure VM images from the deprecated 2019 version to 2022, refactors conda environment creation and build steps into a more unified workflow, and updates Ubuntu job definitions to use Ubuntu 24.04.

Sequence Diagram: Updated Windows Build Process

sequenceDiagram
    participant AzurePipelines
    participant WindowsVM2022 as "Windows VM (2022)"

    AzurePipelines->>WindowsVM2022: Trigger Build Job
    WindowsVM2022->>WindowsVM2022: Initial Setup (Add conda to PATH, Create 'build_env')
    opt If OS is Windows 2022
        WindowsVM2022->>WindowsVM2022: Call vcvars64.bat (VS 2022)
        WindowsVM2022->>WindowsVM2022: Set CC=cl.exe, CXX=cl.exe
        WindowsVM2022->>WindowsVM2022: Activate 'build_env' (using 'call activate')
        WindowsVM2022->>WindowsVM2022: Execute conda-build
    end
    WindowsVM2022-->>AzurePipelines: Build Complete
Loading

Flow Diagram: Refactored Conditional Build Execution Logic

graph TD
    Start["Start CI Job"] --> CondaConfig["Conda Config & Info"]
    CondaConfig --> CreateEnv["Create Anaconda Environment ('build_env')"]
    CreateEnv --> CheckOS{"Is VM Windows?"}

    CheckOS -- "Yes (Windows 2022)" --> WinScript_Header["Windows Build Steps"]
    WinScript_Header --> WinScript_vcvars["call vcvars64.bat (VS 2022)"]
    WinScript_vcvars --> WinScript_setenv["set CC=cl.exe, CXX=cl.exe"]
    WinScript_setenv --> WinScript_activate["call activate build_env"]
    WinScript_activate --> WinScript_build["conda-build"]
    WinScript_build --> EndBuild["End Build"]

    CheckOS -- "No (e.g., Ubuntu)" --> NonWinScript_Header["Non-Windows Build Steps"]
    NonWinScript_Header --> NonWin_activate["source activate build_env"]
    NonWin_activate --> NonWin_build["conda-build"]
    NonWin_build --> EndBuild
Loading

File-Level Changes

Change Details Files
Updated Windows VM image and job names to use Windows 2022
  • Changed vmImage parameter from 'windows-2019' to 'windows-2022' for all Windows jobs
  • Renamed job names from Windows_VS2019_* to Windows_VS2022_*
  • Removed the old windows-2019 conditional block and consolidated under windows-2022
conda-build.yml
azure-pipelines.yml
Refactored conda environment creation and build steps
  • Moved the Anaconda environment creation step before platform-specific blocks
  • Merged Windows setup and build into one script: set PATH, verify cl.exe, activate env, and run conda-build
  • Consolidated Linux build step under a non-Windows conditional with shared env variables
conda-build.yml
Upgraded Ubuntu job definitions to 24.04
  • Renamed Ubuntu_22_04 jobs to Ubuntu_24_04
  • Updated vmImage for those jobs from 'ubuntu-22.04' to 'ubuntu-24.04'
azure-pipelines.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@tpaviot tpaviot merged commit 2fa10ec into master Jun 12, 2025
13 of 14 checks passed
@tpaviot tpaviot deleted the review/azure-improvements branch June 12, 2025 01:57
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @tpaviot - I've reviewed your changes - here's some feedback:

  • Verify that 'ubuntu-24.04' is actually supported in your Azure DevOps agent pool—if not, those new Ubuntu jobs will fail to spin up.
  • The env: block in the windows-2022 build step looks misaligned under the script—ensure CC, CXX, PYTHONBUFFERED, etc. are properly indented as top-level env mappings, not inside the script body.
  • Consider extracting the common conda-build invocation into a shared template or step to reduce duplication between Windows and non-Windows jobs.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

where cl.exe
set CC=cl.exe
set CXX=cl.exe
call activate build_env
Copy link

Choose a reason for hiding this comment

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

suggestion: Prefer 'conda activate' over 'activate' on Windows

'conda activate' is the recommended approach for newer Conda versions and ensures future compatibility.

Suggested change
call activate build_env
conda activate build_env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant