Skip to content
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

[python] version.py: guard git calls during wheel builds (sans .git) #2590

Merged
merged 2 commits into from
May 20, 2024

Conversation

ryan-williams
Copy link
Member

@ryan-williams ryan-williams commented May 20, 2024

Issue and/or context: #2588

Changes:
Make sure "version inference from Git tags" fails silently/gracefully when run outside of a Git clone (e.g. during wheel build).

Notes for Reviewer:

Here is a passing "sdist & wheel build" GHA dispatched from this branch.

Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.26%. Comparing base (12566dd) to head (6ffee30).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2590   +/-   ##
=======================================
  Coverage   90.26%   90.26%           
=======================================
  Files          37       37           
  Lines        4007     4007           
=======================================
  Hits         3617     3617           
  Misses        390      390           
Flag Coverage Δ
python 90.26% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
python_api 90.26% <ø> (ø)
libtiledbsoma ∅ <ø> (∅)

prevent `fatal: not a git repository` logspam
@johnkerl johnkerl changed the title version.py: guard git calls during wheel builds (sans .git) [python] version.py: guard git calls during wheel builds (sans .git) May 20, 2024
@ryan-williams
Copy link
Member Author

ryan-williams commented May 20, 2024

"sdist & wheels" GHA succeeded on this branch.

Here's a local test I also ran:

test_wheel_build
test_wheel_build() {
    if [ $# -gt 1 ]; then
        echo "Usage: test_wheel_build [branch=main]" >&2
        return 1
    elif [ $# -eq 1 ]; then
        branch="$1"; shift
    else
        branch=main
    fi

    now=`date +%s`
    dir=/tmp/tiledb-soma-$now
    echo "Cloning TileDB-SOMA@$branch to $dir" >&2
    git clone --depth 1 -b $branch https://github.com/single-cell-data/TileDB-SOMA $dir
    cd $dir/apis/python

    echo "Building wheel" >&2
    python setup.py sdist
    tar=`ls dist`
    name="${tar%.tar.gz}"
    mv dist/$tar /tmp/  # move back up to /tmp, outside the Git clone
    cd /tmp

    echo "Extracting $tar into /tmp/$name" >&2
    tar -xvf $tar
    cd $name

    echo 'Testing `python version.py`' >&2
    python version.py
}
test_wheel_build         # ❌ currently fails against `main`
# subprocess.CalledProcessError: Command '('git', 'tag', '--list', '--sort=v:refname', '[0-9].*.*')' returned non-zero exit status 128.
test_wheel_build rw/ver  # ✅ succeeds against this branch
# 1.11.1.post0.dev117435952

@ryan-williams ryan-williams marked this pull request as ready for review May 20, 2024 16:26
@jdblischak
Copy link
Collaborator

I manually triggered the packaging CI workflow for this branch, and it passed

https://github.com/single-cell-data/TileDB-SOMA/actions/runs/9161462896

@ryan-williams ryan-williams merged commit 60344e2 into main May 20, 2024
21 checks passed
@ryan-williams ryan-williams deleted the rw/ver branch May 20, 2024 17:51
Copy link

The backport to release-1.11 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release-1.11 release-1.11
# Navigate to the new working tree
cd .worktrees/backport-release-1.11
# Create a new branch
git switch --create backport-2590-to-release-1.11
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick --mainline 1 60344e20d2d19333a1d54fca74af297ca0a214ac
# Push it to GitHub
git push --set-upstream origin backport-2590-to-release-1.11
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release-1.11

Then, create a pull request where the base branch is release-1.11 and the compare/head branch is backport-2590-to-release-1.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants