Skip to content

Commit 1fbbb94

Browse files
committed
openmm: build each version with its own openmm-build-wheels commit
Replace the single OPENMM_BUILD_WHEELS_REF pin with a per-version case (8.6.0 -> db99636, 8.6.1 -> 944f549) that fails on an unknown version, check that the openmm sources declare the version being built and that the recipe's GIT_REVISION is the checked-out release commit, and tolerate a version without a patches directory.
1 parent a6b178f commit 1fbbb94

1 file changed

Lines changed: 41 additions & 4 deletions

File tree

‎.github/workflows/build-openmm.yml‎

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ concurrency:
3131
permissions:
3232
contents: read
3333

34-
env:
35-
OPENMM_BUILD_WHEELS_REF: db996361bca08a147c00f79dd4de8793d721fe34
36-
3734
jobs:
3835
setup:
3936
uses: $/.github/workflows/_setup.yml
@@ -58,6 +55,23 @@ jobs:
5855
image: quay.io/pypa/manylinux_2_39_riscv64
5956

6057
steps:
58+
# openmm-build-wheels has no tags: each release is its "Build X.Y.Z (#N)"
59+
# commit, which pins GIT_REVISION to the release tag in
60+
# .github/workflows/BuildWheels.yml. Add a line here with each new version
61+
# in docs/packages/openmm.yaml; an unknown version fails the build rather
62+
# than building with the wrong recipe.
63+
- name: Resolve the openmm-build-wheels commit for ${{ env.OPENMM_VERSION }}
64+
run: |
65+
case "$OPENMM_VERSION" in
66+
8.6.0) ref=db996361bca08a147c00f79dd4de8793d721fe34 ;; # Build 8.6.0 (#48)
67+
8.6.1) ref=944f549a9329f57526319ed33977ccb1038c7546 ;; # Build 8.6.1 (#51)
68+
*)
69+
echo "::error::no known openmm-build-wheels commit for version '$OPENMM_VERSION'; add it to the case in this step"
70+
exit 1
71+
;;
72+
esac
73+
echo "OPENMM_BUILD_WHEELS_REF=$ref" >> "$GITHUB_ENV"
74+
6175
- name: Checkout openmm ${{ env.OPENMM_VERSION }}
6276
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6377
with:
@@ -80,13 +94,36 @@ jobs:
8094
path: python-wheels
8195
persist-credentials: false
8296

97+
- name: Check the sources are openmm ${{ env.OPENMM_VERSION }}
98+
run: |
99+
set -euo pipefail
100+
cmake_var() { sed -n "s/^SET(OPENMM_$1_VERSION \([0-9]*\))\$/\1/p" openmm/CMakeLists.txt; }
101+
declared="$(cmake_var MAJOR).$(cmake_var MINOR).$(cmake_var BUILD)"
102+
if [ "$declared" != "$OPENMM_VERSION" ]; then
103+
echo "::error::openmm/CMakeLists.txt declares version '$declared', not '$OPENMM_VERSION'"
104+
exit 1
105+
fi
106+
# The recipe must be the one that builds this release: its
107+
# GIT_REVISION is an abbreviated commit of the openmm release tag.
108+
rev="$(sed -n "s/^ GIT_REVISION: '\([0-9a-f]*\)'\$/\1/p" openmm-build-wheels/.github/workflows/BuildWheels.yml)"
109+
git config --global --add safe.directory "$GITHUB_WORKSPACE/openmm"
110+
head="$(git -C openmm rev-parse HEAD)"
111+
if [ -z "$rev" ] || [ "${head#"$rev"}" = "$head" ]; then
112+
echo "::error::openmm-build-wheels at $OPENMM_BUILD_WHEELS_REF builds revision '$rev', not openmm $OPENMM_VERSION ($head)"
113+
exit 1
114+
fi
115+
83116
- name: Install dependencies with dnf
84117
run: dnf -y install doxygen zip opencl-headers ocl-icd
85118

86119
- name: Patch openmm source
87120
working-directory: openmm
88121
run: |
89-
git apply "$GITHUB_WORKSPACE"/python-wheels/patches/openmm/"$OPENMM_VERSION"/*.patch
122+
# A version without a patches directory builds unpatched.
123+
patches=("$GITHUB_WORKSPACE"/python-wheels/patches/openmm/"$OPENMM_VERSION"/*.patch)
124+
if [ -e "${patches[0]}" ]; then
125+
git apply "${patches[@]}"
126+
fi
90127
git apply "$GITHUB_WORKSPACE"/openmm-build-wheels/devtools/patches/library_path.patch
91128
git apply "$GITHUB_WORKSPACE"/openmm-build-wheels/devtools/patches/cxx11_abi.patch
92129
git apply "$GITHUB_WORKSPACE"/openmm-build-wheels/devtools/patches/link_args.patch

0 commit comments

Comments
 (0)