Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ set -euo pipefail

VERSION_FILE="src/pyscipopt/_version.py"
SETUP_FILE="setup.py"
PYPROJECT="pyproject.toml"
DEPLOY_REPO="scipopt/scipoptsuite-deploy"
CHANGELOG="CHANGELOG.md"
REPO="scipopt/PySCIPOpt"

Expand Down Expand Up @@ -212,6 +214,28 @@ if [[ "$HEAD_MSG" =~ ^release\ v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
exit 1
fi

# --- Check bundled SCIP is the latest scipoptsuite-deploy release ---

PINNED_DEPLOY=$(grep -o 'scipoptsuite-deploy/releases/download/v[0-9.]*' "$PYPROJECT" | sed 's|.*/||' | sort -u)
if [[ $(echo "$PINNED_DEPLOY" | wc -l) -ne 1 || -z "$PINNED_DEPLOY" ]]; then
echo "Error: expected exactly one scipoptsuite-deploy version in ${PYPROJECT}, found: ${PINNED_DEPLOY:-none}"
exit 1
fi
LATEST_DEPLOY=$(gh release view --repo "$DEPLOY_REPO" --json tagName -q .tagName)
PINNED_NAME=$(gh release view "$PINNED_DEPLOY" --repo "$DEPLOY_REPO" --json name -q .name)
if [[ "$PINNED_DEPLOY" != "$LATEST_DEPLOY" ]]; then
LATEST_NAME=$(gh release view "$LATEST_DEPLOY" --repo "$DEPLOY_REPO" --json name -q .name)
echo ""
echo "Warning: wheels will bundle an outdated SCIP."
echo " pinned: ${PINNED_DEPLOY} (${PINNED_NAME})"
echo " latest: ${LATEST_DEPLOY} (${LATEST_NAME})"
echo "Run ./upgrade_scip.sh and merge its PR first to ship the latest SCIP."
read -rp "Release with the outdated SCIP anyway? [y/N] " outdated_confirm
[[ "${outdated_confirm:-N}" =~ ^[Yy] ]] || exit 0
else
echo "Bundled SCIP: ${PINNED_DEPLOY} (${PINNED_NAME})"
fi

# --- Read current version ---

CURRENT_VERSION=$(sed -n "s/^__version__.*'\(.*\)'/\1/p" "$VERSION_FILE")
Expand Down
17 changes: 13 additions & 4 deletions upgrade_scip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -euo pipefail

PYPROJECT="pyproject.toml"
WORKFLOWS=(.github/workflows/*.yml)
DEPLOY_REPO="scipopt/scipoptsuite-deploy"
REPO="scipopt/PySCIPOpt"

Expand Down Expand Up @@ -146,11 +147,11 @@ fi
if [[ "$SKIP_DEPLOY" == false ]]; then
echo " 1. Build new SCIP binaries (SCIP=${SCIP_VERSION} SoPlex=${SOPLEX_VERSION} GCG=${GCG_VERSION} IPOPT=${IPOPT_VERSION})"
echo " 2. Create scipoptsuite-deploy release ${NEW_DEPLOY_VERSION}"
echo " 3. Create branch '${BRANCH}', update pyproject.toml, and open a PR"
echo " 3. Create branch '${BRANCH}', update pyproject.toml and CI SCIP version, and open a PR"
else
echo " 1. [skip] Build binaries — release ${NEW_DEPLOY_VERSION} already exists"
echo " 2. [skip] Create release — already exists"
echo " 3. Create branch '${BRANCH}', update pyproject.toml, and open a PR"
echo " 3. Create branch '${BRANCH}', update pyproject.toml and CI SCIP version, and open a PR"
fi
echo ""

Expand All @@ -165,6 +166,7 @@ if [[ "$DRY_RUN" == true ]]; then
fi
echo " git checkout -b ${BRANCH}"
echo " (sed) ${CURRENT_DEPLOY_VERSION} -> ${NEW_DEPLOY_VERSION} in ${PYPROJECT}"
echo " (sed) 'version: ${SCIP_VERSION}' in $(grep -l '^ version: ' "${WORKFLOWS[@]}" | tr '\n' ' ')"
echo " git commit -m 'Update scipoptsuite-deploy to ${NEW_DEPLOY_VERSION} (SCIP ${SCIP_VERSION})'"
echo " git push -u ${PUSH_REMOTE} ${BRANCH}"
echo " gh pr create --repo ${REPO} --title 'Upgrade to SCIP ${SCIP_VERSION}'"
Expand Down Expand Up @@ -279,14 +281,21 @@ if cmp -s "$PYPROJECT" "${PYPROJECT}.bak"; then
fi
rm -f "${PYPROJECT}.bak"

git add "$PYPROJECT"
for wf in "${WORKFLOWS[@]}"; do
if grep -q '^ version: ' "$wf"; then
sed -i.bak "s/^ version: .*/ version: ${SCIP_VERSION}/" "$wf"
rm -f "${wf}.bak"
fi
done

git add "$PYPROJECT" "${WORKFLOWS[@]}"
git commit -m "Update scipoptsuite-deploy to ${NEW_DEPLOY_VERSION} (SCIP ${SCIP_VERSION})"
git push -u "$PUSH_REMOTE" "$BRANCH"

gh pr create --repo "$REPO" \
--title "Upgrade to SCIP ${SCIP_VERSION}" \
--body "$(cat <<EOF
Updates scipoptsuite-deploy ${CURRENT_DEPLOY_VERSION} -> ${NEW_DEPLOY_VERSION} (SCIP ${SCIP_VERSION}, SoPlex ${SOPLEX_VERSION}, GCG ${GCG_VERSION}, IPOPT ${IPOPT_VERSION}).
Updates scipoptsuite-deploy ${CURRENT_DEPLOY_VERSION} -> ${NEW_DEPLOY_VERSION} (SCIP ${SCIP_VERSION}, SoPlex ${SOPLEX_VERSION}, GCG ${GCG_VERSION}, IPOPT ${IPOPT_VERSION}) and the SCIP version used by CI workflows.

## Checklist
- [ ] Fix any API incompatibilities
Expand Down
Loading