Debug release #406
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build uv on all platforms. | |
# | |
# Generates both wheels (for PyPI) and archived binaries (for GitHub releases). | |
# | |
# Assumed to run as a subworkflow of .github/workflows/release.yml; specifically, as a local | |
# artifacts job within `cargo-dist`. | |
name: "Build binaries" | |
on: | |
workflow_call: | |
inputs: | |
plan: | |
required: true | |
type: string | |
pull_request: | |
paths: | |
# When we change pyproject.toml, we want to ensure that the maturin builds still work. | |
- pyproject.toml | |
# And when we change this workflow itself... | |
- .github/workflows/build-binaries.yml | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
PACKAGE_NAME: uv | |
MODULE_NAME: uv | |
PYTHON_VERSION: "3.11" | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
CARGO_TERM_COLOR: always | |
RUSTUP_MAX_RETRIES: 10 | |
jobs: | |
sdist: | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: "Prep README.md" | |
run: python scripts/transform_readme.py --target pypi | |
- name: "Build sdist" | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist | |
- name: "Test sdist" | |
run: | | |
pip install dist/${{ env.PACKAGE_NAME }}-*.tar.gz --force-reinstall | |
${{ env.MODULE_NAME }} --help | |
python -m ${{ env.MODULE_NAME }} --help | |
uvx --help | |
- name: "Upload sdist" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-sdist | |
path: dist | |
linux: | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
- i686-unknown-linux-gnu | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
architecture: x64 | |
- name: "Prep README.md" | |
run: python scripts/transform_readme.py --target pypi | |
- name: "Build wheels" | |
uses: PyO3/maturin-action@v1 | |
env: | |
RUST_LOG: debug | |
with: | |
target: ${{ matrix.target }} | |
manylinux: auto | |
args: --release --locked --out dist --features self-update | |
# See: https://github.com/sfackler/rust-openssl/issues/2036#issuecomment-1724324145 | |
before-script-linux: | | |
# If we're running on rhel centos, install needed packages. | |
if command -v yum &> /dev/null; then | |
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic | |
# If we're running on i686 we need to symlink libatomic | |
# in order to build openssl with -latomic flag. | |
if [[ ! -d "/usr/lib64" ]]; then | |
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so | |
fi | |
else | |
# If we're running on debian-based system. | |
apt update -y && apt-get install -y libssl-dev openssl pkg-config | |
fi | |
- name: "Test wheel" | |
if: ${{ startsWith(matrix.target, 'x86_64') }} | |
run: | | |
pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall | |
${{ env.MODULE_NAME }} --help | |
python -m ${{ env.MODULE_NAME }} --help | |
uvx --help | |
- name: "Upload wheels" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.target }} | |
path: dist | |
- name: "Archive binary" | |
shell: bash | |
run: | | |
set -euo pipefail | |
TARGET=${{ matrix.target }} | |
ARCHIVE_NAME=uv-$TARGET | |
ARCHIVE_FILE=$ARCHIVE_NAME.tar.gz | |
mkdir -p $ARCHIVE_NAME | |
cp target/$TARGET/release/uv $ARCHIVE_NAME/uv | |
cp target/$TARGET/release/uvx $ARCHIVE_NAME/uvx | |
tar czvf $ARCHIVE_FILE $ARCHIVE_NAME | |
shasum -a 256 $ARCHIVE_FILE > $ARCHIVE_FILE.sha256 | |
- name: "Upload binary" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-${{ matrix.target }} | |
path: | | |
*.tar.gz | |
*.sha256 | |