hf-xet release, tag main #465
This file contains hidden or 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
| # This file is autogenerated by maturin v1.7.0 | |
| # To update, run | |
| # | |
| # maturin generate-ci github | |
| # | |
| name: Release | |
| run-name: hf-xet release, tag ${{ inputs.tag || 'main' }} | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Semantic version for PyPI release (tag will share the same name)' | |
| required: true | |
| default: 'v0.1.0' | |
| permissions: | |
| contents: read | |
| jobs: | |
| linux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: ubuntu-22.04 | |
| target: x86_64 | |
| manylinux: auto | |
| - runner: ubuntu-22.04 | |
| target: aarch64 | |
| manylinux: manylinux_2_28 | |
| python-version: | |
| - 3.14 | |
| - 3.13t | |
| - 3.14t | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install wheel tooling | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install wheel | |
| - name: Update version in toml | |
| run: | | |
| TAG=${{ github.event.inputs.tag }} | |
| VERSION=${TAG#v} | |
| if [ -n "$VERSION" ]; then | |
| sed -i '/^version /s/=.*$/= "'"$VERSION"'"/' hf_xet/Cargo.toml | |
| fi | |
| - uses: ./.github/actions/set-build-profile | |
| with: | |
| tag: ${{ github.event.inputs.tag }} | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --profile ${{ env.BUILD_PROFILE }} -i ${{ matrix.python-version }} --out dist | |
| sccache: 'true' | |
| manylinux: ${{ matrix.platform.manylinux }} | |
| working-directory: hf_xet | |
| before-script-linux: | | |
| if command -v apt-get &> /dev/null; then | |
| apt-get update && apt-get install libatomic-ops-dev -y | |
| elif command -v yum &> /dev/null; then | |
| yum install devtoolset-10-libatomic-devel perl-IPC-Cmd -y | |
| else | |
| echo "Neither apt-get nor yum is installed. Please install a package manager." | |
| exit 1 | |
| fi | |
| git config --global --add safe.directory "*" | |
| - name: Strip debug symbols into a separate file | |
| if: env.IS_RELEASE == 'true' | |
| run: | | |
| shopt -s expand_aliases | |
| if [[ ${{ matrix.platform.target }} == "aarch64" ]] | |
| then | |
| sudo apt-get update | |
| sudo apt-get install -y binutils-aarch64-linux-gnu | |
| alias objcopy=aarch64-linux-gnu-objcopy | |
| fi | |
| mkdir hf_xet/dbg | |
| mkdir dist | |
| pushd dist | |
| cp ../hf_xet/dist/* . | |
| LATEST_WHEEL=$(ls -tr1 *.whl | tail -n 1) | |
| WHEEL_NAME=$(basename $LATEST_WHEEL .whl) | |
| WHEEL_VERSION=$(echo $LATEST_WHEEL | cut -d '-' -f 2) | |
| SYMBOL_FILE=${WHEEL_NAME}.so.dbg | |
| wheel unpack $LATEST_WHEEL | |
| objcopy --only-keep-debug hf_xet-${WHEEL_VERSION}/hf_xet/hf_xet.*.so hf_xet-${WHEEL_VERSION}/hf_xet/${SYMBOL_FILE} | |
| objcopy --strip-debug hf_xet-${WHEEL_VERSION}/hf_xet/hf_xet.*.so | |
| objcopy --add-gnu-debuglink=hf_xet-${WHEEL_VERSION}/hf_xet/${SYMBOL_FILE} hf_xet-${WHEEL_VERSION}/hf_xet/hf_xet.*.so | |
| mv hf_xet-${WHEEL_VERSION}/hf_xet/${SYMBOL_FILE} ../hf_xet/dbg/${SYMBOL_FILE} | |
| wheel pack hf_xet-${WHEEL_VERSION} | |
| rm -rf hf_xet-${WHEEL_VERSION} | |
| - name: Copy unstripped wheels to upload directory | |
| if: env.IS_RELEASE != 'true' | |
| run: | | |
| mkdir dist | |
| cp hf_xet/dist/* dist/ | |
| - name: Upload debug symbols | |
| if: env.IS_RELEASE == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dbg-linux-${{ matrix.python-version }}-${{ matrix.platform.target }} | |
| path: hf_xet/dbg | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-linux-${{ matrix.python-version }}-${{ matrix.platform.target }} | |
| path: dist | |
| musllinux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: ubuntu-22.04 | |
| target: x86_64 | |
| - runner: ubuntu-22.04 | |
| target: aarch64 | |
| python-version: | |
| - 3.14 | |
| - 3.13t | |
| - 3.14t | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install wheel tooling | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install wheel | |
| - name: Update version in toml | |
| run: | | |
| TAG=${{ github.event.inputs.tag }} | |
| VERSION=${TAG#v} | |
| if [ -n "$VERSION" ]; then | |
| sed -i '/^version /s/=.*$/= "'"$VERSION"'"/' hf_xet/Cargo.toml | |
| fi | |
| - uses: ./.github/actions/set-build-profile | |
| with: | |
| tag: ${{ github.event.inputs.tag }} | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --profile ${{ env.BUILD_PROFILE }} -i ${{ matrix.python-version }} --out dist | |
| sccache: 'true' | |
| manylinux: musllinux_1_2 | |
| working-directory: hf_xet | |
| before-script-linux: | | |
| git config --global --add safe.directory "*" | |
| - name: Strip debug symbols into a separate file | |
| if: env.IS_RELEASE == 'true' | |
| run: | | |
| shopt -s expand_aliases | |
| if [[ ${{ matrix.platform.target }} == "aarch64" ]] | |
| then | |
| sudo apt-get update | |
| sudo apt-get install -y binutils-aarch64-linux-gnu | |
| alias objcopy=aarch64-linux-gnu-objcopy | |
| fi | |
| mkdir hf_xet/dbg | |
| mkdir dist | |
| pushd dist | |
| cp ../hf_xet/dist/* . | |
| LATEST_WHEEL=$(ls -tr1 *.whl | tail -n 1) | |
| WHEEL_NAME=$(basename $LATEST_WHEEL .whl) | |
| WHEEL_VERSION=$(echo $LATEST_WHEEL | cut -d '-' -f 2) | |
| SYMBOL_FILE=${WHEEL_NAME}.so.dbg | |
| wheel unpack $LATEST_WHEEL | |
| objcopy --only-keep-debug hf_xet-${WHEEL_VERSION}/hf_xet/hf_xet.*.so hf_xet-${WHEEL_VERSION}/hf_xet/${SYMBOL_FILE} | |
| objcopy --strip-debug hf_xet-${WHEEL_VERSION}/hf_xet/hf_xet.*.so | |
| objcopy --add-gnu-debuglink=hf_xet-${WHEEL_VERSION}/hf_xet/${SYMBOL_FILE} hf_xet-${WHEEL_VERSION}/hf_xet/hf_xet.*.so | |
| mv hf_xet-${WHEEL_VERSION}/hf_xet/${SYMBOL_FILE} ../hf_xet/dbg/${SYMBOL_FILE} | |
| wheel pack hf_xet-${WHEEL_VERSION} | |
| rm -rf hf_xet-${WHEEL_VERSION} | |
| - name: Copy unstripped wheels to upload directory | |
| if: env.IS_RELEASE != 'true' | |
| run: | | |
| mkdir dist | |
| cp hf_xet/dist/* dist/ | |
| - name: Upload debug symbols | |
| if: env.IS_RELEASE == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dbg-musllinux-${{ matrix.python-version }}-${{ matrix.platform.target }} | |
| path: hf_xet/dbg | |
| - name: Upload wheels with separated debug symbols | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-musllinux-${{ matrix.python-version }}-${{ matrix.platform.target }} | |
| path: dist | |
| windows: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: windows-latest | |
| target: x64 | |
| rust_target: x86_64-pc-windows-msvc | |
| python-version: | |
| - 3.14 | |
| - 3.13t | |
| - 3.14t | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Update version in toml | |
| shell: bash | |
| run: | | |
| TAG=${{ github.event.inputs.tag }} | |
| VERSION=${TAG#v} | |
| if [ -n "$VERSION" ]; then | |
| sed -i '/^version /s/=.*$/= "'"$VERSION"'"/' hf_xet/Cargo.toml | |
| fi | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release -i python${{ matrix.python-version }} --out dist | |
| sccache: 'true' | |
| working-directory: hf_xet | |
| - name: Copy debug symbols | |
| shell: bash | |
| run: | | |
| pushd hf_xet/dist | |
| LATEST_WHEEL=$(ls -tr1 *.whl | tail -n 1) | |
| WHEEL_NAME=$(basename $LATEST_WHEEL .whl) | |
| SYMBOL_FILE=${WHEEL_NAME}.pdb | |
| popd | |
| mkdir hf_xet/dbg | |
| cp hf_xet/target/${{ matrix.platform.rust_target }}/release/hf_xet.pdb hf_xet/dbg/${SYMBOL_FILE} | |
| - name: Upload debug symbols | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dbg-windows-${{ matrix.python-version }}-${{ matrix.platform.target }} | |
| path: hf_xet/dbg | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-windows-${{ matrix.python-version }}-${{ matrix.platform.target }} | |
| path: hf_xet/dist | |
| macos: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: macos-15-intel | |
| target: x86_64 | |
| rust_target: x86_64-apple-darwin | |
| - runner: macos-14 | |
| target: aarch64 | |
| rust_target: aarch64-apple-darwin | |
| python-version: | |
| - 3.14 | |
| - 3.13t | |
| - 3.14t | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install wheel tooling | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install wheel | |
| - name: Update version in toml | |
| run: | | |
| TAG=${{ github.event.inputs.tag }} | |
| VERSION=${TAG#v} | |
| if [ -n "$VERSION" ]; then | |
| sed -i '' '/^version /s/=.*$/= "'"$VERSION"'"/' hf_xet/Cargo.toml | |
| fi | |
| - uses: ./.github/actions/set-build-profile | |
| with: | |
| tag: ${{ github.event.inputs.tag }} | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --profile ${{ env.BUILD_PROFILE }} -i ${{ matrix.python-version }} --strip --out dist | |
| sccache: 'true' | |
| working-directory: hf_xet | |
| - name: Retarget and copy debug symbols | |
| if: env.IS_RELEASE == 'true' | |
| run: | | |
| pushd hf_xet/dist | |
| LATEST_WHEEL=$(ls -tr1 *.whl | tail -n 1) | |
| WHEEL_NAME=$(basename $LATEST_WHEEL .whl) | |
| WHEEL_VERSION=$(echo $LATEST_WHEEL | cut -d '-' -f 2) | |
| SYMBOL_FILE=${WHEEL_NAME}.dylib.dSYM | |
| wheel unpack $LATEST_WHEEL | |
| LIB_NAME=$(basename hf_xet-${WHEEL_VERSION}/hf_xet/*.so) | |
| rm -rf hf_xet-${WHEEL_VERSION} | |
| popd | |
| mkdir hf_xet/dbg | |
| pushd hf_xet/target/${{ matrix.platform.rust_target}}/release-dbgsymbols | |
| sed -i '' "s/binary-path:.*/binary-path: '.\/${LIB_NAME}'/" libhf_xet.dylib.dSYM/Contents/Resources/Relocations/${{ matrix.platform.target }}/libhf_xet.dylib.yml | |
| cp -r libhf_xet.dylib.dSYM ../../../dbg/${SYMBOL_FILE} | |
| - name: Upload debug symbols | |
| if: env.IS_RELEASE == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dbg-macos-${{ matrix.python-version }}-${{ matrix.platform.target }} | |
| path: hf_xet/dbg | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-macos-${{ matrix.python-version }}-${{ matrix.platform.target }} | |
| path: hf_xet/dist | |
| sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Update version in toml | |
| run: | | |
| TAG=${{ github.event.inputs.tag }} | |
| VERSION=${TAG#v} | |
| if [ -n "$VERSION" ]; then | |
| sed -i '/^version /s/=.*$/= "'"$VERSION"'"/' hf_xet/Cargo.toml | |
| fi | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| working-directory: hf_xet | |
| - name: Patch sdist | |
| run: | | |
| pushd hf_xet/dist | |
| DISTFILE=$(ls -tr1 hf_xet-*.tar.gz | tail -n 1) | |
| DISTNAME=${DISTFILE%.tar.gz} | |
| # maturin sdist will overwrite an edited pyproject.toml in the repo root, so we need to | |
| # update the python path in the built pyproject.toml to account for that. | |
| tar -xvzf ${DISTFILE} | |
| sed -i '/^python\-source =/ s/= .*/= "hf_xet\/python"/' ${DISTNAME}/pyproject.toml | |
| tar -cvzf ${DISTFILE} ${DISTNAME} | |
| rm -rf ${DISTNAME} | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-sdist | |
| path: hf_xet/dist | |
| release-pypi: | |
| name: Release PyPi | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| needs: [github-release] | |
| permissions: | |
| # Use to sign the release artifacts | |
| id-token: write | |
| # Used to upload release artifacts | |
| contents: write | |
| # Used to generate artifact attestation | |
| attestations: write | |
| environment: release | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v1 | |
| with: | |
| subject-path: 'wheels-*/*' | |
| - name: Publish to PyPI | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: upload | |
| args: --non-interactive --skip-existing wheels-*/* | |
| github-release: | |
| name: Create GitHub release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| needs: [ linux, musllinux, windows, macos, sdist ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| ls -l | |
| echo "wheels" | |
| ls -l wheels-*/* | |
| mkdir dbg-symbols | |
| echo "dbg" | |
| ls -l dbg-*/* | |
| cp -r dbg-*/* dbg-symbols/ | |
| echo "zipping debug symbols" | |
| zip -r dbg-symbols.zip dbg-symbols | |
| gh release create ${{ github.event.inputs.tag}} wheels-*/* dbg-symbols.zip --generate-notes --prerelease --target ${{github.sha}} |