Skip to content

Commit

Permalink
Use same system time for version string across jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
yambati03 committed Feb 26, 2025
1 parent 741602d commit b3b2a67
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build-cibw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ on:
workflow_dispatch:

jobs:
get_system_time:
runs-on: ubuntu-latest
outputs:
timestamp: ${{ steps.get_time.outputs.timestamp }}
steps:
- name: Get system time
id: get_time
run: echo "timestamp=$(date +'%Y%m%d%H%M')" >> "$GITHUB_OUTPUT"

build_wheels:
needs: get_system_time
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -72,7 +82,7 @@ jobs:
- name: Set Develop Flag
run: |
echo "DEVELOP=1" >> $GITHUB_ENV
echo "COMMIT_HASH=$(git rev-parse --short=7 "$GITHUB_SHA")" >> $GITHUB_ENV
echo "TIMESTAMP=${{ needs.get_system_time.outputs.timestamp }}" >> $GITHUB_ENV
- name: Install Dependencies
run: |
Expand All @@ -96,7 +106,7 @@ jobs:
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_ARCHS: all
CIBW_ENVIRONMENT_PASS_LINUX: DEVELOP COMMIT_HASH
CIBW_ENVIRONMENT_PASS_LINUX: DEVELOP TIMESTAMP

CIBW_BUILD_FRONTEND: "build"
CIBW_BEFORE_ALL: bash {project}/build_tools/wheels/cibw_before_all.sh ${{ matrix.python_version }} {project}
Expand Down
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ set (GTSAM_PRERELEASE_VERSION "a0")
math (EXPR GTSAM_VERSION_NUMERIC "10000 * ${GTSAM_VERSION_MAJOR} + 100 * ${GTSAM_VERSION_MINOR} + ${GTSAM_VERSION_PATCH}")

if (DEFINED ENV{DEVELOP})
string(TIMESTAMP NOW "%Y%m%d%H%M")
# set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}${GTSAM_PRERELEASE_VERSION}+$ENV{COMMIT_HASH}")
set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}${GTSAM_PRERELEASE_VERSION}.dev${NOW}")
set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}${GTSAM_PRERELEASE_VERSION}.dev$ENV{TIMESTAMP}")
set (SETUP_NAME "gtsam-develop")
elseif ("${GTSAM_PRERELEASE_VERSION}" STREQUAL "")
set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}")
Expand Down

0 comments on commit b3b2a67

Please sign in to comment.