-
Notifications
You must be signed in to change notification settings - Fork 118
Merge update version and fix version format bugs #286
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
Changes from all commits
80a8bd9
66735dc
df05b60
6cdf51d
15a2333
85fce84
7062220
28e13dd
c2fa99a
97743d3
ce3f525
5eed69e
0bbd6d0
85ebc9a
1dbfff5
3e535c7
6ad04e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,126 @@ | ||||||||||||||||
| #!/bin/bash | ||||||||||||||||
|
|
||||||||||||||||
| # SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||||||||||||||||
| # SPDX-License-Identifier: Apache-2.0 | ||||||||||||||||
| # | ||||||||||||||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||
| # you may not use this file except in compliance with the License. | ||||||||||||||||
| # You may obtain a copy of the License at | ||||||||||||||||
| # | ||||||||||||||||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||
| # | ||||||||||||||||
| # Unless required by applicable law or agreed to in writing, software | ||||||||||||||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||
| # See the License for the specific language governing permissions and | ||||||||||||||||
| # limitations under the License. | ||||||||||||||||
|
|
||||||||||||||||
| NEXT_FULL_TAG=$1 | ||||||||||||||||
|
|
||||||||||||||||
| # Get current version | ||||||||||||||||
| CURRENT_TAG=$(git tag --merged HEAD | grep -xE '^v.*' | sort --version-sort | tail -n 1 | tr -d 'v') | ||||||||||||||||
|
|
||||||||||||||||
| #Get <major>.<minor> for next version | ||||||||||||||||
| NEXT_MAJOR=$(echo "$NEXT_FULL_TAG" | awk '{split($0, a, "."); print a[1]}') | ||||||||||||||||
| NEXT_MINOR=$(echo "$NEXT_FULL_TAG" | awk '{split($0, a, "."); print a[2]}') | ||||||||||||||||
| NEXT_SHORT_TAG=${NEXT_MAJOR}.${NEXT_MINOR} | ||||||||||||||||
| DOCKER_TAG=$(echo "$NEXT_FULL_TAG" | sed -E 's/^([0-9]{2})\.0*([0-9]+)\.0*([0-9]+).*/\1.\2.\3/') | ||||||||||||||||
|
|
||||||||||||||||
| # Need to distutils-normalize the versions for some use cases (RAPIDS) | ||||||||||||||||
| NEXT_SHORT_TAG_PEP440=$(python -c "from packaging.version import Version; print(Version('${NEXT_SHORT_TAG}'))") | ||||||||||||||||
|
|
||||||||||||||||
| echo "Preparing release $CURRENT_TAG => $NEXT_FULL_TAG" | ||||||||||||||||
|
|
||||||||||||||||
| # Inplace sed replace; workaround for Linux and Mac | ||||||||||||||||
| function sed_runner() { | ||||||||||||||||
| sed -i.bak ''"$1"'' "$2" && rm -f "${2}".bak | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| # Centralized version file update | ||||||||||||||||
| echo "${NEXT_FULL_TAG}" > ./VERSION | ||||||||||||||||
| echo "${NEXT_FULL_TAG}" > ./RAPIDS_VERSION | ||||||||||||||||
|
|
||||||||||||||||
| DEPENDENCIES=( | ||||||||||||||||
| cudf | ||||||||||||||||
| cuvs | ||||||||||||||||
| cuopt | ||||||||||||||||
| cuopt-mps-parser | ||||||||||||||||
| cuopt-server | ||||||||||||||||
| cuopt-sh-client | ||||||||||||||||
| libcuopt | ||||||||||||||||
| libraft-headers | ||||||||||||||||
| librmm | ||||||||||||||||
| pylibraft | ||||||||||||||||
| raft-dask | ||||||||||||||||
| rapids-dask-dependency | ||||||||||||||||
| rmm | ||||||||||||||||
| ) | ||||||||||||||||
|
|
||||||||||||||||
| for DEP in "${DEPENDENCIES[@]}"; do | ||||||||||||||||
| for FILE in dependencies.yaml conda/environments/*.yaml python/*/pyproject.toml; do | ||||||||||||||||
| sed_runner "s/\(${DEP}==\)[0-9]\+\.[0-9]\+/\1${NEXT_SHORT_TAG_PEP440}/" "${FILE}" | ||||||||||||||||
| done | ||||||||||||||||
| for FILE in python/*/pyproject.toml; do | ||||||||||||||||
| sed_runner "/-.* ${DEP}\(-cu[[:digit:]]\{2\}\)\{0,1\}\(\[.*\]\)\{0,1\}==/ s/==.*/==${NEXT_SHORT_TAG_PEP440}.*,>=0.0.0a0/g" "${FILE}" | ||||||||||||||||
| done | ||||||||||||||||
| for FILE in docs/cuopt/source/*/quick-start.rst README.md; do | ||||||||||||||||
| sed_runner "s/\(${DEP}==\)[0-9]\+\.[0-9]\+\.\\*/\1${NEXT_SHORT_TAG_PEP440}.\*/g" "${FILE}" | ||||||||||||||||
| sed_runner "s/\(${DEP}=\)[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?[^ ]*/\1${NEXT_SHORT_TAG}.*/g" "${FILE}" | ||||||||||||||||
| sed_runner "s/\(${DEP}:\)[0-9]\{2\}\.[0-9]\{1,2\}\.[0-9]\+\(-cuda[0-9]\+\.[0-9]\+-\)\(py[0-9]\+\)/\1${DOCKER_TAG}\2\3/g" "${FILE}" | ||||||||||||||||
| done | ||||||||||||||||
| done | ||||||||||||||||
|
|
||||||||||||||||
| # CMakeLists update | ||||||||||||||||
| sed_runner 's/'"VERSION [0-9][0-9].[0-9][0-9].[0-9][0-9]"'/'"VERSION ${NEXT_FULL_TAG}"'/g' cpp/CMakeLists.txt | ||||||||||||||||
| sed_runner 's/'"VERSION [0-9][0-9].[0-9][0-9].[0-9][0-9]"'/'"VERSION ${NEXT_FULL_TAG}"'/g' cpp/libmps_parser/CMakeLists.txt | ||||||||||||||||
| sed_runner 's/'"DEPENDENT_LIB_MAJOR_VERSION \"[0-9][0-9]\""'/'"DEPENDENT_LIB_MAJOR_VERSION \"${NEXT_MAJOR}\""'/g' cpp/CMakeLists.txt | ||||||||||||||||
| sed_runner 's/'"DEPENDENT_LIB_MINOR_VERSION \"[0-9][0-9]\""'/'"DEPENDENT_LIB_MINOR_VERSION \"${NEXT_MINOR}\""'/g' cpp/CMakeLists.txt | ||||||||||||||||
|
|
||||||||||||||||
| # Server version update | ||||||||||||||||
| sed_runner 's/'"\"version\": \"[0-9][0-9].[0-9][0-9]\""'/'"\"version\": \"${NEXT_SHORT_TAG}\""'/g' python/cuopt_server/cuopt_server/utils/data_definition.py | ||||||||||||||||
| sed_runner 's/'"\"client_version\": \"[0-9][0-9].[0-9][0-9]\""'/'"\"client_version\": \"${NEXT_SHORT_TAG}\""'/g' python/cuopt_server/cuopt_server/utils/routing/data_definition.py | ||||||||||||||||
| sed_runner 's/'"\"client_version\": \"[0-9][0-9].[0-9][0-9]\""'/'"\"client_version\": \"${NEXT_SHORT_TAG}\""'/g' python/cuopt_server/cuopt_server/utils/linear_programming/data_definition.py | ||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be good to calculate this programmatically, in Python code instead. e.g.
Should rely on this constant:
Same advice goes for all 3 of these lines. |
||||||||||||||||
|
|
||||||||||||||||
| # Doc update | ||||||||||||||||
| sed_runner 's/'"version = \"[0-9][0-9].[0-9][0-9]\""'/'"version = \"${NEXT_SHORT_TAG}\""'/g' docs/cuopt/source/conf.py | ||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should use Example of how |
||||||||||||||||
| sed_runner 's/'"PROJECT_NUMBER = [0-9][0-9].[0-9][0-9]"'/'"PROJECT_NUMBER = ${NEXT_SHORT_TAG}"'/g' cpp/doxygen/Doxyfile | ||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Example from |
||||||||||||||||
|
|
||||||||||||||||
| # Update project.json | ||||||||||||||||
| PROJECT_FILE="docs/cuopt/source/project.json" | ||||||||||||||||
| sed_runner 's/\("version": "\)[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]"/\1'${NEXT_FULL_TAG}'"/g' "${PROJECT_FILE}" | ||||||||||||||||
|
|
||||||||||||||||
| # Update VERSIONS.json | ||||||||||||||||
| VERSIONS_FILE="docs/cuopt/source/versions1.json" | ||||||||||||||||
| # Only update if NEXT_FULL_TAG is not already present | ||||||||||||||||
| if ! grep -q "\"version\": \"${NEXT_FULL_TAG}\"" "${VERSIONS_FILE}"; then | ||||||||||||||||
| # Remove preferred and latest flags, but keep the version entry and URL | ||||||||||||||||
| sed_runner '/"name": "latest",/d' "${VERSIONS_FILE}" | ||||||||||||||||
| sed_runner '/"preferred": true,\?/d' "${VERSIONS_FILE}" | ||||||||||||||||
| # Remove trailing comma after "url": ... in all version entries | ||||||||||||||||
| sed_runner 's/\("url": "[^"]*"\),/\1/' "${VERSIONS_FILE}" | ||||||||||||||||
| # Add new version entry with both preferred and latest flags | ||||||||||||||||
| NEW_VERSION_ENTRY=' {\n "version": "'${NEXT_FULL_TAG}'",\n "url": "../'${NEXT_FULL_TAG}'/",\n "name": "latest",\n "preferred": true\n },' | ||||||||||||||||
| sed_runner "/\[/a\\${NEW_VERSION_ENTRY}" "${VERSIONS_FILE}" | ||||||||||||||||
| fi | ||||||||||||||||
|
Comment on lines
+92
to
+104
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you might find this easier to maintain if it was in Python. I recommend looking into what I just did over in the
I think you should have a small Python script that populates And that script should read from That'd simplify |
||||||||||||||||
|
|
||||||||||||||||
| # RTD update | ||||||||||||||||
| sed_runner "/^set(cuopt_version/ s/[0-9][0-9].[0-9][0-9].[0-9][0-9]/${NEXT_FULL_TAG}/g" python/cuopt/CMakeLists.txt | ||||||||||||||||
| sed_runner "/^set(cuopt_version/ s/[0-9][0-9].[0-9][0-9].[0-9][0-9]/${NEXT_FULL_TAG}/g" python/cuopt/cuopt/linear_programming/CMakeLists.txt | ||||||||||||||||
| sed_runner "/^set(cuopt_version/ s/[0-9][0-9].[0-9][0-9].[0-9][0-9]/${NEXT_FULL_TAG}/g" python/libcuopt/CMakeLists.txt | ||||||||||||||||
|
Comment on lines
+106
to
+109
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be possible to derive all of these in CMake, at configure time, from other variables. Re-using all of these variables: cuopt/cmake/rapids_config.cmake Lines 15 to 21 in b567ed4
|
||||||||||||||||
|
|
||||||||||||||||
| # Update nightly | ||||||||||||||||
| sed_runner 's/'"cuopt_version: \"[0-9][0-9].[0-9][0-9]\""'/'"cuopt_version: \"${NEXT_SHORT_TAG}\""'/g' .github/workflows/nightly.yaml | ||||||||||||||||
|
|
||||||||||||||||
| # Update Helm chart files | ||||||||||||||||
| sed_runner 's/\(tag: "\)[0-9][0-9]\.[0-9]\+\.[0-9]\+\(-cuda12\.8-py3\.12"\)/\1'${DOCKER_TAG}'\2/g' helmchart/cuopt-server/values.yaml | ||||||||||||||||
| sed_runner 's/\(appVersion: \)[0-9][0-9]\.[0-9]\+\.[0-9]\+/\1'${DOCKER_TAG}'/g' helmchart/cuopt-server/Chart.yaml | ||||||||||||||||
| sed_runner 's/\(version: \)[0-9][0-9]\.[0-9]\+\.[0-9]\+/\1'${DOCKER_TAG}'/g' helmchart/cuopt-server/Chart.yaml | ||||||||||||||||
|
|
||||||||||||||||
| for FILE in .github/workflows/*.yaml; do | ||||||||||||||||
| sed_runner "/shared-workflows/ s/@.*/@branch-${NEXT_SHORT_TAG}/g" "${FILE}" | ||||||||||||||||
| # CI image tags of the form {rapids_version}-{something} | ||||||||||||||||
| sed_runner "s/:[0-9]*\\.[0-9]*-/:${NEXT_SHORT_TAG}-/g" "${FILE}" | ||||||||||||||||
| done | ||||||||||||||||
|
|
||||||||||||||||
| # PYTHON for RAPIDS | ||||||||||||||||
| sed_runner "/DOWNLOAD.*rapids-cmake/ s/branch-[0-9][0-9].[0-9][0-9]/branch-${NEXT_SHORT_TAG}/g" python/cuopt/CMakeLists.txt | ||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be grouped with the other And similar to my comment on those, I think it'd be better to move this logic into CMake code itself. |
||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.