-
-
Notifications
You must be signed in to change notification settings - Fork 635
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
Upload local Pants PEXs to release #19450
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,16 @@ python_distribution( | |
entry_points={"console_scripts": {"pants": "src/python/pants/bin:pants"}}, | ||
) | ||
|
||
pex_binary( | ||
name="pants-pex", | ||
dependencies=[":pants-packaged"], | ||
script="pants", | ||
execution_mode="venv", | ||
shebang="/usr/bin/env python", | ||
strip_pex_env=False, | ||
layout="zipapp", | ||
) | ||
Comment on lines
+43
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was copied from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also am hardcoding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that you understand correctly. |
||
|
||
# NB: we use `dummy.c` to avoid clang/gcc complaining `error: no input files` when building | ||
# `:pants-packaged`. We don't actually need to use any meaningful file here, though, because we | ||
# use `entry_points` to link to the actual native code, so clang/gcc do not need to build any | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -534,26 +534,6 @@ def bootstrap_pants(self) -> Sequence[Step]: | |
self.native_binaries_upload(), | ||
] | ||
|
||
def build_wheels(self) -> list[Step]: | ||
cmd = dedent( | ||
# Note that the build-local-pex run is just for smoke-testing that pex | ||
# builds work, and it must come *before* the build-wheels runs, since | ||
# it cleans out `dist/deploy`, which the build-wheels runs populate for | ||
# later attention by deploy_to_s3.py. | ||
"""\ | ||
./pants run src/python/pants_release/release.py -- build-local-pex | ||
./pants run src/python/pants_release/release.py -- build-wheels | ||
""" | ||
) | ||
|
||
return [ | ||
{ | ||
"name": "Build wheels", | ||
"run": cmd, | ||
"env": self.platform_env(), | ||
}, | ||
] | ||
|
||
def upload_log_artifacts(self, name: str) -> Step: | ||
return { | ||
"name": "Upload pants.log", | ||
|
@@ -867,9 +847,35 @@ def build_wheels_job( | |
"steps": [ | ||
*initial_steps, | ||
*([] if platform == Platform.LINUX_ARM64 else [install_go()]), | ||
*helper.build_wheels(), | ||
helper.upload_log_artifacts(name="wheels"), | ||
{ | ||
"name": "Build wheels", | ||
"run": "./pants run src/python/pants_release/release.py -- build-wheels", | ||
"env": helper.platform_env(), | ||
}, | ||
{ | ||
"name": "Build Pants PEX", | ||
"run": "./pants package src/python/pants:pants-pex", | ||
thejcannon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"env": helper.platform_env(), | ||
}, | ||
helper.upload_log_artifacts(name="wheels-and-pex"), | ||
*([deploy_to_s3("Deploy wheels to S3")] if for_deploy_ref else []), | ||
*( | ||
[ | ||
{ | ||
"name": "Upload Pants PEX", | ||
"if": "needs.release_info.outputs.is-release == 'true'", | ||
"run": dedent( | ||
"""\ | ||
LOCAL_TAG=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import sys;major, minor = sys.version_info[:2];import os;uname = os.uname();print(f'cp{major}{minor}-{uname.sysname.lower()}_{uname.machine.lower()}')") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is my assume-nothing way of generating the tag. Using the PEX itself means we'll land the right IC, and using Python means we'll be confident The value looks like: |
||
mv dist/src.python.pants/pants-pex.pex dist/src.python.pants/pants.$LOCAL_TAG.pex | ||
gh release upload --no-clobber ${{ needs.release_info.outputs.build-ref }} dist/src.python.pants/pants.$LOCAL_TAG.pex | ||
""" | ||
), | ||
} | ||
] | ||
if for_deploy_ref | ||
else [] | ||
), | ||
], | ||
}, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this red makes me happy!