From: Mark Abraham Date: Wed, 3 Nov 2021 09:04:16 +0000 (+0000) Subject: Use CMake to propagate versions and hashes to gitlab jobs X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?p=alexxy%2Fgromacs.git;a=commitdiff_plain;h=31ad1552d0e654c8d59363d5e94fb8a573e4d69b Use CMake to propagate versions and hashes to gitlab jobs --- diff --git a/admin/gitlab-ci/archive.gitlab-ci.yml b/admin/gitlab-ci/archive.gitlab-ci.yml index fbec19dfcd..527c90a588 100644 --- a/admin/gitlab-ci/archive.gitlab-ci.yml +++ b/admin/gitlab-ci/archive.gitlab-ci.yml @@ -1,5 +1,8 @@ # Packages, exported artifacts, and release engineering processes. +# Special job to run cmake to output the version string and +# regressiontest md5sum to a file + prepare-release-version: extends: - .variables:default @@ -12,10 +15,10 @@ prepare-release-version: KUBERNETES_CPU_REQUEST: 1 KUBERNETES_MEMORY_REQUEST: 2Gi script: - - cmake -P cmake/gmxVersionInfo.cmake &> version.json + - cmake . -DGMX_BUILD_TARBALL=on artifacts: paths: - - version.json + - VersionInfo-partial.cmake.cmakein # Special job to package regressiontest files and have them available for testing # Runs during pre-build @@ -78,8 +81,7 @@ regressiontests:package: needs: - job: prepare-release-version script: - - VERSION=`cat version.json | - python3 -c "import json,sys; print(json.load(sys.stdin)['version'])"` + - VERSION=`sed -n -e '/GMX_VERSION_STRING\b/ s/.*"\(.*\)")/\1/p' VersionInfo-partial.cmake.cmakein` - REGTESTNAME="regressiontests-"$VERSION - if [[ $GROMACS_RELEASE != "true" ]] ; then REGTESTNAME=$REGTESTNAME-dev ; @@ -102,7 +104,7 @@ regressiontests:package: - git archive -o $REGTESTNAME.tar.gz --prefix $REGTESTNAME/ -9 HEAD - git archive -o gmx-regressiontests.tar.gz --prefix regressiontests/ -9 HEAD - mv $REGTESTNAME.tar.gz gmx-regressiontests.tar.gz .. - - echo "Build regressiontests for branch $REGTESTBRANCH" + - echo "Build regressiontests $REGTESTNAME for branch $REGTESTBRANCH" - cd .. artifacts: paths: @@ -222,13 +224,11 @@ checksum-verify: BUILD_DIR: build-package script: - VALID_BUILD=true - - VERSION=`cat version.json | - python3 -c "import json,sys; print(json.load(sys.stdin)['version'])"` + - VERSION=`sed -n -e '/GMX_VERSION_STRING\b/ s/.*"\(.*\)")/\1/p' VersionInfo-partial.cmake.cmakein` - if [[ "$GROMACS_RELEASE" != "true" ]] ; then VERSION="$VERSION"-dev ; fi - - REGTEST_COMPARE=`cat version.json | - python3 -c "import json,sys; print(json.load(sys.stdin)['regressiontest-md5sum'])"` + - REGTEST_COMPARE=`sed -n -e '/REGRESSIONTEST_MD5SUM/ s/.*"\(.*\)")/\1/p' VersionInfo-partial.cmake.cmakein` - SOURCENAME=gromacs-"$VERSION" - SOURCETARBALL="$SOURCENAME".tar.gz - SOURCE_MD5SUM=`md5sum "$SOURCETARBALL" | awk '{print $1}'` @@ -265,8 +265,7 @@ version-verify: BUILD_DIR: release-doc-builds script: - VALID_BUILD=true - - VERSION=`cat version.json | - python3 -c "import json,sys; print(json.load(sys.stdin)['version'])"` + - VERSION=`sed -n -e '/GMX_VERSION_STRING\b/ s/.*"\(.*\)")/\1/p' VersionInfo-partial.cmake.cmakein` - if [[ "$GROMACS_RELEASE" != "true" ]] ; then VERSION="$VERSION"-dev ; fi diff --git a/admin/gitlab-ci/documentation.gitlab-ci.yml b/admin/gitlab-ci/documentation.gitlab-ci.yml index e0df386b4a..5018fdfc45 100644 --- a/admin/gitlab-ci/documentation.gitlab-ci.yml +++ b/admin/gitlab-ci/documentation.gitlab-ci.yml @@ -109,13 +109,11 @@ - echo $CMAKE_BUILD_TYPE_OPTIONS - echo $CMAKE_GMXAPI_OPTIONS - echo $REL_OPTION - - VERSION=`cat version.json | - python3 -c "import json,sys; print(json.load(sys.stdin)['version'])"` + - VERSION=`sed -n -e '/GMX_VERSION_STRING\b/ s/.*"\(.*\)")/\1/p' VersionInfo-partial.cmake.cmakein` - if [[ $GROMACS_RELEASE != "true" ]] ; then VERSION=$VERSION-dev ; fi - - REGTEST_COMPARE=`cat version.json | - python3 -c "import json,sys; print(json.load(sys.stdin)['regressiontest-md5sum'])"` + - REGTEST_COMPARE=`sed -n -e '/REGRESSIONTEST_MD5SUM/ s/.*"\(.*\)")/\1/p' VersionInfo-partial.cmake.cmakein` - SOURCENAME=gromacs-$VERSION - SOURCETARBALL=$SOURCENAME.tar.gz - REGTESTNAME=regressiontests-$VERSION diff --git a/admin/gitlab-ci/gromacs.matrix.gitlab-ci.yml b/admin/gitlab-ci/gromacs.matrix.gitlab-ci.yml index 6b52e1fbac..b0f4affa31 100644 --- a/admin/gitlab-ci/gromacs.matrix.gitlab-ci.yml +++ b/admin/gitlab-ci/gromacs.matrix.gitlab-ci.yml @@ -47,8 +47,7 @@ RELEASE_REGRESSIONTESTS: release-regressiontests-from-tarball script: - CMAKE=${CMAKE:-$(which cmake)} - - VERSION=`cat version.json | - python3 -c "import json,sys; print(json.load(sys.stdin)['version'])"` + - VERSION=`sed -n -e '/GMX_VERSION_STRING\b/ s/.*"\(.*\)")/\1/p' VersionInfo-partial.cmake.cmakein` - if [[ $GROMACS_RELEASE != "true" ]] ; then VERSION=$VERSION-dev ; fi diff --git a/cmake/VersionInfo.cmake.cmakein b/cmake/VersionInfo.cmake.cmakein index e95494a01b..68f1a57d70 100644 --- a/cmake/VersionInfo.cmake.cmakein +++ b/cmake/VersionInfo.cmake.cmakein @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2014,2015,2019, by the GROMACS development team, led by +# Copyright (c) 2014,2015,2019,2021, by the GROMACS development team, led by # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, # and including many others, as listed in the AUTHORS file in the # top-level source directory and at http://www.gromacs.org. @@ -42,3 +42,5 @@ set(GMX_VERSION_FULL_HASH "@GMX_VERSION_FULL_HASH@") set(GMX_VERSION_CENTRAL_BASE_HASH "@GMX_VERSION_CENTRAL_BASE_HASH@") set(GMX_RELEASE_SOURCE_FILE_CHECKSUM "@GMX_RELEASE_SOURCE_FILE_CHECKSUM@") set(GMX_CURRENT_SOURCE_FILE_CHECKSUM "@GMX_CURRENT_SOURCE_FILE_CHECKSUM@") + +set(REGRESSIONTEST_MD5SUM "@REGRESSIONTEST_MD5SUM@") \ No newline at end of file diff --git a/cmake/gmxVersionInfo.cmake b/cmake/gmxVersionInfo.cmake index 851bbd146a..24fc3e83c6 100644 --- a/cmake/gmxVersionInfo.cmake +++ b/cmake/gmxVersionInfo.cmake @@ -265,10 +265,8 @@ endif() option(GMX_BUILD_TARBALL "Build tarball without -dev version suffix" OFF) mark_as_advanced(GMX_BUILD_TARBALL) -# If run with cmake -P, the -dev suffix is managed elsewhere. if (NOT SOURCE_IS_SOURCE_DISTRIBUTION AND - NOT GMX_BUILD_TARBALL AND - NOT CMAKE_SCRIPT_MODE_FILE) + NOT GMX_BUILD_TARBALL) set(GMX_VERSION_STRING "${GMX_VERSION_STRING}-dev") endif() @@ -276,13 +274,6 @@ math(EXPR GMX_VERSION_NUMERIC "${GMX_VERSION_MAJOR}*10000 + ${GMX_VERSION_PATCH}") set(GMX_API_VERSION ${GMX_VERSION_NUMERIC}) -# If run with cmake -P from GitLab scripts, print out necessary version info -# as JSON. -if (CMAKE_SCRIPT_MODE_FILE) - message("{ \"version\": \"${GMX_VERSION_STRING}\", \"regressiontest-md5sum\": \"${REGRESSIONTEST_MD5SUM}\" }") - return() -endif() - # Set those values only in release versions, after getting the identifiers # from Zenodo for the manual and source code # Has to be done by hand before every final release @@ -372,6 +363,9 @@ string(REPLACE ";" ":" DIRECTORIES_TO_CHECKSUM_STRING "${SET_OF_DIRECTORIES_TO_C # - These are again custom commands that depend on the output from # step 1, so they get regenerated only when the static version info # changes. +# +# Note that VersionInfo-partial.cmake is also used to transfer version +# information between GitLab CI jobs for release and documentation builds. # Check if we have all necessary python modules available if (Python3_Interpreter_FOUND)