Skip to content

Deprecate scikit, simplify release process#527

Merged
fedorov merged 2 commits intoQIICR:masterfrom
fedorov:deprecate-scikit
Feb 25, 2026
Merged

Deprecate scikit, simplify release process#527
fedorov merged 2 commits intoQIICR:masterfrom
fedorov:deprecate-scikit

Conversation

@fedorov
Copy link
Copy Markdown
Member

@fedorov fedorov commented Feb 25, 2026

No description provided.

fedorov and others added 2 commits February 25, 2026 16:47
The ci_addons publish_github_release tool uses a latest/latest-tmp tag
rename mechanism that causes race conditions when multiple CI runs
execute concurrently. Replace with native gh release upload commands
which are atomic and don't require the Python dependency.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace hardcoded DCMQI_VERSION_MAJOR/MINOR/PATCH in CMakeLists.txt
with a new CMake module (dcmqiVersionFromGit) that extracts the version
from the nearest v* git tag. Add release trigger to all workflows so
creating a release in the GitHub UI automatically builds and attaches
packages. Use fetch-depth: 0 for reliable git describe.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@sonarqubecloud
Copy link
Copy Markdown

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

This PR updates DCMQI’s versioning and release automation to remove the scikit-ci-addons dependency, deriving the project version from git tags and switching GitHub Actions publishing to the gh CLI.

Changes:

  • Replace hard-coded DCMQI_VERSION_{MAJOR,MINOR,PATCH} with a CMake module that extracts version components from git tags.
  • Update Linux/macOS/Windows CI workflows to run on release.published, fetch full git history/tags, and publish release assets via gh release upload.
  • Remove scikit-ci-addons-based GitHub release publishing logic from workflows.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
CMakeLists.txt Switches version definition to be sourced from a git-tag extraction module.
CMake/dcmqiVersionFromGit.cmake New module that parses vX.Y.Z git tags into DCMQI_VERSION_* components with a fallback.
.github/workflows/cmake-win.yml Adds release trigger, fetches full history, and replaces scikit publishing with gh-based asset upload logic.
.github/workflows/cmake-macos.yml Adds release trigger, fetches full history, and replaces scikit publishing with gh-based asset upload logic.
.github/workflows/cmake-linux.yml Adds release trigger, fetches full history, and replaces scikit publishing with gh-based asset upload logic.

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

Comment on lines 110 to +126
if: ${{ (github.event_name != 'pull_request') && (github.repository_owner == 'QIICR')}}
env:
GH_TOKEN: ${{ secrets.GA_TOKEN }}
run: |
pip install -U "scikit-ci-addons>=0.22.0"
# python -m scikit-ci publish --package-name dcmqi --package-version `git
# describe --tags --exact-match 2> /dev/null || echo "latest"` --platform linux
# --commit-range ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} --repository ${{ github.event.pull_request.head.repo.full_name }} --token ${{ secrets.GITHUB_TOKEN }} --verbose
ci_addons publish_github_release qiicr/dcmqi \
--release-packages "build/dcmqi-build/dcmqi-*-linux.tar.gz" \
--prerelease-packages "build/dcmqi-build/dcmqi-*-linux-*.tar.gz" \
--prerelease-packages-clear-pattern "dcmqi-*-linux-*" \
--prerelease-packages-keep-pattern "*<COMMIT_DATE>-<COMMIT_SHORT_SHA>*" \
--exit-success-if-missing-token --token ${{ secrets.GA_TOKEN }}
TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [ -n "$TAG" ]; then
gh release upload "$TAG" \
build/dcmqi-build/dcmqi-*-linux*.tar.gz \
--clobber
else
gh release view latest --json assets --jq '.assets[].name' 2>/dev/null \
| grep "dcmqi-.*-linux-" \
| xargs -I{} gh release delete-asset latest "{}" --yes || true
gh release upload latest \
build/dcmqi-build/dcmqi-*-linux*.tar.gz \
--clobber
fi
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The prior publishing logic used --exit-success-if-missing-token, but gh release upload/delete-asset will error and fail the workflow if GA_TOKEN isn’t available. If you still want pushes/PRs to pass even when publishing is not possible, add a check to skip this step when GH_TOKEN is unset/empty (or handle gh failures explicitly).

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +40
if(NOT DEFINED DCMQI_VERSION_MAJOR)
message(WARNING "Could not extract version from git tag, using fallback version 0.0.0")
set(DCMQI_VERSION_MAJOR 0)
set(DCMQI_VERSION_MINOR 0)
set(DCMQI_VERSION_PATCH 0)
endif()
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

If the source tree is not a git checkout (e.g., building from a GitHub source tarball/zip or a vendored copy), this forces the project/package version to 0.0.0, which then propagates into install paths and CPACK package names. Consider falling back to a checked-in version file (or the previously defined version), and/or allowing a cache override (e.g., -DDCMQI_VERSION_{MAJOR,MINOR,PATCH}=...) without emitting a warning in the normal non-git release-tarball case.

Copilot uses AI. Check for mistakes.
Comment on lines 106 to +115
- name: Publish package
shell: pwsh
shell: bash
env:
GH_TOKEN: ${{ secrets.GA_TOKEN }}
run: |
# Set longer timeout for HTTP operations in PowerShell
$PSDefaultParameterValues['*:TimeoutSec'] = 300
pip install -U "scikit-ci-addons>=0.22.0"
ci_addons publish_github_release qiicr/dcmqi `
--exit-success-if-missing-token `
--release-packages "${{ github.workspace }}\b\dcmqi-build\dcmqi-*-win64.zip" `
--prerelease-packages "${{ github.workspace }}\b\dcmqi-build\dcmqi-*-win64-*.zip" `
--prerelease-packages-clear-pattern "dcmqi-*-win64-*" `
--prerelease-packages-keep-pattern "*<COMMIT_DATE>-<COMMIT_SHORT_SHA>*" `
--token ${{ secrets.GA_TOKEN }}
TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [ -n "$TAG" ]; then
gh release upload "$TAG" \
"${{ github.workspace }}/b/dcmqi-build"/dcmqi-*-win64*.zip \
--clobber
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

This step runs under shell: bash on windows-2022, but it builds file paths using ${{ github.workspace }} (a Windows-style path) and mixes \ (download-artifact path) with / (upload glob). In Git Bash/MSYS, that frequently results in paths that don’t resolve, so gh release upload may not find any artifacts. Use a consistent path strategy for Bash on Windows (e.g., rely on $GITHUB_WORKSPACE + cygpath conversion, or use relative paths from the workspace), or keep this step in pwsh and call gh there.

Copilot uses AI. Check for mistakes.
Comment on lines 142 to +159
if: ${{ (github.event_name != 'pull_request') && (github.repository_owner == 'QIICR')}}
env:
GH_TOKEN: ${{ secrets.GA_TOKEN }}
run: |
pip install -U "scikit-ci-addons>=0.22.0"
ci_addons publish_github_release qiicr/dcmqi \
--release-packages "${{ github.workspace }}/dcmqi-build/dcmqi-build/dcmqi-*-mac*.tar.gz" \
--prerelease-packages ${{ github.workspace }}/dcmqi-build/dcmqi-build/dcmqi-*-mac*.tar.gz \
--prerelease-packages-clear-pattern "dcmqi-*-mac-${{ matrix.arch }}-*" \
--prerelease-packages-keep-pattern "*<COMMIT_DATE>-<COMMIT_SHORT_SHA>*" \
--exit-success-if-missing-token --token ${{ secrets.GA_TOKEN }}
TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [ -n "$TAG" ]; then
gh release upload "$TAG" \
${{ github.workspace }}/dcmqi-build/dcmqi-build/dcmqi-*-mac*.tar.gz \
--clobber
else
# Clean old prerelease assets for this architecture, then upload new ones
gh release view latest --json assets --jq '.assets[].name' 2>/dev/null \
| grep "dcmqi-.*-mac-${{ matrix.arch }}-" \
| xargs -I{} gh release delete-asset latest "{}" --yes || true
gh release upload latest \
${{ github.workspace }}/dcmqi-build/dcmqi-build/dcmqi-*-mac*.tar.gz \
--clobber
fi
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The previous scikit-ci-addons invocation tolerated missing tokens (--exit-success-if-missing-token), but this gh release ... approach will fail the job if GA_TOKEN isn’t present/accessible (including misconfiguration scenarios). If the intent is to keep the workflow non-blocking when the token is unavailable, add an explicit guard that skips publishing when GH_TOKEN is empty/unset.

Copilot uses AI. Check for mistakes.
@fedorov
Copy link
Copy Markdown
Member Author

fedorov commented Feb 25, 2026

All four review comments have been addressed in commit 8210c4b:

  1. Token guard (Linux + macOS): Added early exit 0 when GH_TOKEN is empty, matching the old --exit-success-if-missing-token behavior.
  2. VERSION fallback: dcmqiVersionFromGit.cmake now supports three sources in priority order: CMake cache variables (-DDCMQI_VERSION_MAJOR=...), git tag, and a VERSION file in the source root. Fails with a clear error listing all options if none are available.
  3. Windows paths: Now using cygpath to convert github.workspace to a Unix-style path for the bash shell.

@fedorov fedorov merged commit 030bba2 into QIICR:master Feb 25, 2026
11 of 12 checks passed
@fedorov fedorov deleted the deprecate-scikit branch February 25, 2026 22:14
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.

2 participants