@@ -39,17 +39,67 @@ jobs:
3939 name : version-file
4040 path : version
4141
42- build_wheels :
43- runs-on : ${{ matrix.os }}
42+ build_linux_wheels :
43+ name : Build Linux Wheels
44+ runs-on : ubuntu-latest
45+ needs : [create_version]
46+
47+ steps :
48+ - uses : actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4
49+
50+ - uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
51+ with :
52+ python-version : ' 3.11'
53+
54+ - uses : actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
55+ with :
56+ name : version-file
57+ path : version
58+
59+ - name : Install cibuildwheel
60+ run : pip install cibuildwheel
61+
62+ - name : Build wheels
63+ env :
64+ # 1. Install Bazel (Bazelisk) and Java inside the Manylinux container
65+ CIBW_BEFORE_ALL_LINUX : >
66+ yum install -y java-11-openjdk-devel &&
67+ curl -Lo /usr/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64 &&
68+ chmod +x /usr/bin/bazel
69+
70+ # 2. Build only the requested CPython versions
71+ CIBW_BUILD : cp310-manylinux* cp311-manylinux* cp312-manylinux* cp313-manylinux*
72+
73+ # 3. Custom build command:
74+ # - Calculates Python version (e.g., "3.11")
75+ # - Runs your update script
76+ # - Runs Bazel build
77+ # - Copies the resulting wheel to the output dir {wheel}
78+ CIBW_BUILD_COMMAND_LINUX : >
79+ export PY_MAJ_MIN=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") &&
80+ python _update_bazel_py_version.py $PY_MAJ_MIN &&
81+ bazel build --define TARGET_VERSION=py${PY_MAJ_MIN//./} --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel &&
82+ cp bazel-bin/*.whl {wheel}
83+
84+ run : cibuildwheel --output-dir wheelhouse
85+
86+ - uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
87+ with :
88+ name : python-wheels-linux
89+ path : wheelhouse/*.whl
90+
91+ build_macos_wheels :
92+ name : Build macOS Wheels
93+ runs-on : macos-14
4494 needs : [create_version]
4595 strategy :
4696 fail-fast : true
4797 matrix :
48- os : [ubuntu-22.04, ubuntu-24.04, macos-14]
4998 python-version : ['3.10', '3.11', '3.12', '3.13']
5099
51100 steps :
52101 - uses : actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4
102+
53103 - name : Set up Python
54104 uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
55105 with :
@@ -78,20 +128,16 @@ jobs:
78128 env :
79129 TARGET_PYTHON : ${{ matrix.python-version }}
80130 run : |
81- glibc_version=$(ldd --version | awk '/ldd/{print $NF}')
82- export GLIBC_VERSION="${glibc_version//./_}"
83- echo $GLIBC_VERSION
84- sed "s/^MANYLINUX_VERSION.*/MANYLINUX_VERSION=\"manylinux_${GLIBC_VERSION}_x86_64.manylinux2014_x86_64\"/" BUILD -i || true
85- bazel build --define TARGET_VERSION="$(python -c "print(\"py${TARGET_PYTHON}\".replace(\".\", \"\"))")" --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel
131+ bazel build --define TARGET_VERSION="$(python -c "print(\"py${TARGET_PYTHON}\".replace(\".\", \"\"))")" --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel
86132
87133 - uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
88134 with :
89- name : python-wheels-${{ matrix.os }} -${{ matrix.python-version }}
135+ name : python-wheels-macos -${{ matrix.python-version }}
90136 path : ./bazel-bin/*.whl
91137
92138 release-wheels :
93139 name : Publish all wheels
94- needs : [build_wheels ]
140+ needs : [build_linux_wheels, build_macos_wheels ]
95141 runs-on : ubuntu-24.04
96142
97143 steps :
0 commit comments