diff --git a/.github/workflows/stable-release-workflow.yml b/.github/workflows/stable-release-workflow.yml index 860b02d..1118619 100644 --- a/.github/workflows/stable-release-workflow.yml +++ b/.github/workflows/stable-release-workflow.yml @@ -39,17 +39,67 @@ jobs: name: version-file path: version - build_wheels: - runs-on: ${{ matrix.os }} + build_linux_wheels: + name: Build Linux Wheels + runs-on: ubuntu-latest + needs: [create_version] + + steps: + - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4 + + - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5 + with: + python-version: '3.11' + + - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 + with: + name: version-file + path: version + + - name: Install cibuildwheel + run: pip install cibuildwheel + + - name: Build wheels + env: + # 1. Install Bazel (Bazelisk) and Java inside the Manylinux container + CIBW_BEFORE_ALL_LINUX: > + yum install -y java-11-openjdk-devel && + curl -Lo /usr/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64 && + chmod +x /usr/bin/bazel + + # 2. Build only the requested CPython versions + CIBW_BUILD: cp310-manylinux* cp311-manylinux* cp312-manylinux* cp313-manylinux* + + # 3. Custom build command: + # - Calculates Python version (e.g., "3.11") + # - Runs your update script + # - Runs Bazel build + # - Copies the resulting wheel to the output dir {wheel} + CIBW_BUILD_COMMAND_LINUX: > + export PY_MAJ_MIN=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") && + python _update_bazel_py_version.py $PY_MAJ_MIN && + bazel build --define TARGET_VERSION=py${PY_MAJ_MIN//./} --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel && + cp bazel-bin/*.whl {wheel} + + run: cibuildwheel --output-dir wheelhouse + + - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: python-wheels-linux + path: wheelhouse/*.whl + + build_macos_wheels: + name: Build macOS Wheels + runs-on: macos-14 needs: [create_version] strategy: fail-fast: true matrix: - os: [ubuntu-22.04, ubuntu-24.04, macos-14] python-version: ['3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4 + - name: Set up Python uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5 with: @@ -78,20 +128,16 @@ jobs: env: TARGET_PYTHON: ${{ matrix.python-version }} run: | - glibc_version=$(ldd --version | awk '/ldd/{print $NF}') - export GLIBC_VERSION="${glibc_version//./_}" - echo $GLIBC_VERSION - sed "s/^MANYLINUX_VERSION.*/MANYLINUX_VERSION=\"manylinux_${GLIBC_VERSION}_x86_64.manylinux2014_x86_64\"/" BUILD -i || true - bazel build --define TARGET_VERSION="$(python -c "print(\"py${TARGET_PYTHON}\".replace(\".\", \"\"))")" --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel + bazel build --define TARGET_VERSION="$(python -c "print(\"py${TARGET_PYTHON}\".replace(\".\", \"\"))")" --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 with: - name: python-wheels-${{ matrix.os }}-${{ matrix.python-version }} + name: python-wheels-macos-${{ matrix.python-version }} path: ./bazel-bin/*.whl release-wheels: name: Publish all wheels - needs: [build_wheels] + needs: [build_linux_wheels, build_macos_wheels] runs-on: ubuntu-24.04 steps: