From 2ec5f5276ccadb49dfd9d692be268a60831625a3 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 10 Jun 2025 18:10:15 -0700 Subject: [PATCH 01/14] fix pybind11 build --- src/py/BUILD | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/py/BUILD b/src/py/BUILD index 9f24e4c..b1b6383 100644 --- a/src/py/BUILD +++ b/src/py/BUILD @@ -1,14 +1,17 @@ -load("@rules_python//python:py_test.bzl", "py_test") +load("@rules_python//python:py_library.bzl", "py_library") +load("@rules_python//python:py_binary.bzl", "py_binary") load("@rules_python//python:pip.bzl", "compile_pip_requirements") -py_test( - name = "common_test", - srcs = ["common_test.py"], +py_binary( + name = "tmp", + srcs = ["tmp.py"], visibility = ["//:__subpackages__"], deps = [ - "@pypi//pytest", + "@pypi//numpy", + "@pypi//stim", "//src:lib_tesseract_decoder", ], + # imports = ["//src:lib_tesseract_decoder"], ) py_test( From d2d884f83ecfe76af5ffdfebea82b2fe1b61e01c Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 10 Jun 2025 19:58:29 -0700 Subject: [PATCH 02/14] link tesseract with stim and add tests for the python wrapper of common.h --- src/py/BUILD | 13 +++++-------- src/py/common_test.py | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/py/BUILD b/src/py/BUILD index b1b6383..9f24e4c 100644 --- a/src/py/BUILD +++ b/src/py/BUILD @@ -1,17 +1,14 @@ -load("@rules_python//python:py_library.bzl", "py_library") -load("@rules_python//python:py_binary.bzl", "py_binary") +load("@rules_python//python:py_test.bzl", "py_test") load("@rules_python//python:pip.bzl", "compile_pip_requirements") -py_binary( - name = "tmp", - srcs = ["tmp.py"], +py_test( + name = "common_test", + srcs = ["common_test.py"], visibility = ["//:__subpackages__"], deps = [ - "@pypi//numpy", - "@pypi//stim", + "@pypi//pytest", "//src:lib_tesseract_decoder", ], - # imports = ["//src:lib_tesseract_decoder"], ) py_test( diff --git a/src/py/common_test.py b/src/py/common_test.py index b059a41..3ed0902 100644 --- a/src/py/common_test.py +++ b/src/py/common_test.py @@ -15,6 +15,7 @@ import pytest import stim +# import tesseract_decoder from src import tesseract_decoder From bd4ce6c124bb71fe817f432e78c5cee734caf2b4 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 10 Jun 2025 20:01:06 -0700 Subject: [PATCH 03/14] nit --- src/py/common_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/py/common_test.py b/src/py/common_test.py index 3ed0902..b059a41 100644 --- a/src/py/common_test.py +++ b/src/py/common_test.py @@ -15,7 +15,6 @@ import pytest import stim -# import tesseract_decoder from src import tesseract_decoder From a066b2e74d5d19a039c423a37e5b77ec1388e73a Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 11 Jun 2025 23:19:41 -0700 Subject: [PATCH 04/14] Expose all of tesseract to python --- src/tesseract.pybind.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/tesseract.pybind.cc b/src/tesseract.pybind.cc index 4c35029..a4de726 100644 --- a/src/tesseract.pybind.cc +++ b/src/tesseract.pybind.cc @@ -15,8 +15,6 @@ #include "tesseract.pybind.h" #include - -#include "common.pybind.h" #include "pybind11/detail/common.h" #include "simplex.pybind.h" #include "utils.pybind.h" From 6354a3ff09ea8715181f68e0a7a5b9511dc63e34 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 24 Jun 2025 16:00:33 -0700 Subject: [PATCH 05/14] Add py_wheel rule, clean old rules and canonize python version --- MODULE.bazel | 5 +++- WORKSPACE | 8 ------ external/stim_py.BUILD | 64 ------------------------------------------ src/BUILD | 17 +++++++++-- src/py/BUILD | 4 +++ 5 files changed, 22 insertions(+), 76 deletions(-) delete mode 100644 external/stim_py.BUILD diff --git a/MODULE.bazel b/MODULE.bazel index 98f03c8..0404c79 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -8,6 +8,9 @@ bazel_dep(name = "pybind11_bazel", version = "2.13.6") DEFAULT_PYTHON_VERSION = "3.11" +python = use_extension("@rules_python//python/extensions:python.bzl", "python") +python.toolchain(python_version = DEFAULT_PYTHON_VERSION, is_default = True) + python_configure = use_extension("@pybind11_bazel//:python_configure.bzl", "extension") use_repo(python_configure, "local_config_python") @@ -16,7 +19,7 @@ pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") pip.parse( hub_name = "pypi", - python_version = "3.11", + python_version = DEFAULT_PYTHON_VERSION, requirements_lock = "//src/py:requirements_lock.txt", ) diff --git a/WORKSPACE b/WORKSPACE index c2af5ef..ded3a8f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -66,11 +66,3 @@ http_archive( urls = ["https://github.com/bazelbuild/platforms/archive/refs/tags/0.0.6.zip"], strip_prefix = "platforms-0.0.6", ) - -http_archive( - name = "stim_py", - build_file = "//external:stim_py.BUILD", - sha256 = "95236006859d6754be99629d4fb44788e742e962ac8c59caad421ca088f7350e", - strip_prefix = "stim-1.15.0", - urls = ["https://github.com/quantumlib/Stim/releases/download/v1.15.0/stim-1.15.0.tar.gz"], -) diff --git a/external/stim_py.BUILD b/external/stim_py.BUILD deleted file mode 100644 index 7c14e00..0000000 --- a/external/stim_py.BUILD +++ /dev/null @@ -1,64 +0,0 @@ -load("@pybind11_bazel//:build_defs.bzl", "pybind_library") -load("@pybind11_bazel//:build_defs.bzl", "pybind_extension") - -SOURCE_FILES_NO_MAIN = glob( - [ - "src/**/*.cc", - "src/**/*.h", - "src/**/*.inl", - ], - exclude = glob([ - "src/**/*.test.cc", - "src/**/*.test.h", - "src/**/*.perf.cc", - "src/**/*.perf.h", - "src/**/*.pybind.cc", - "src/**/*.pybind.h", - "src/**/main.cc", - ]), -) - -PYBIND_MODULES = [ - "src/stim/py/march.pybind.cc", - "src/stim/py/stim.pybind.cc", -] - -PYBIND_FILES_WITHOUT_MODULES = glob( - [ - "src/**/*.pybind.cc", - "src/**/*.pybind.h", - ], - exclude=PYBIND_MODULES, -) - - - -pybind_library( - name = "stim_pybind_lib", - srcs = SOURCE_FILES_NO_MAIN + PYBIND_FILES_WITHOUT_MODULES, - copts = [ - "-O3", - "-std=c++20", - "-fvisibility=hidden", - "-march=native", - "-DVERSION_INFO=0.0.dev0", - ], - includes = ["src/"], - visibility = ["//visibility:public"], -) - -pybind_extension( - name = "stim", - srcs = PYBIND_MODULES, - copts = [ - "-O3", - "-std=c++20", - "-fvisibility=hidden", - "-march=native", - "-DSTIM_PYBIND11_MODULE_NAME=stim", - "-DVERSION_INFO=0.0.dev0", - ], - deps=[":stim_pybind_lib"], - includes = ["src/"], - visibility = ["//visibility:public"], -) diff --git a/src/BUILD b/src/BUILD index a222eaf..b2cc362 100644 --- a/src/BUILD +++ b/src/BUILD @@ -15,6 +15,7 @@ # load("@benchmark//:benchmark.bzl", "cc_benchmark") load("@pybind11_bazel//:build_defs.bzl", "pybind_extension", "pybind_library") load("@rules_python//python:defs.bzl", "py_library") +load("@rules_python//python:packaging.bzl", "py_wheel") package(default_visibility = ["//visibility:public"]) @@ -63,7 +64,6 @@ cc_library( ], ) - pybind_library( name = "tesseract_decoder_pybind", srcs = [ @@ -77,7 +77,7 @@ pybind_library( ":libutils", ":libsimplex", ":libtesseract", - "@stim_py//:stim_pybind_lib", + "@stim//:stim_pybind_lib", ], ) @@ -88,10 +88,20 @@ pybind_extension( ], deps = [ ":tesseract_decoder_pybind", - "@stim_py//:stim", ], ) +py_wheel( + name="tesseract_decoder_wheel", + distribution = "tesseract_decoder", + deps=[ + ":tesseract_decoder", + ], + version = "0.0.dev0", + requires=[ + "stim", + ], +) py_library( name="lib_tesseract_decoder", @@ -214,3 +224,4 @@ cc_binary( ], ) + diff --git a/src/py/BUILD b/src/py/BUILD index 9f24e4c..7bc4a4f 100644 --- a/src/py/BUILD +++ b/src/py/BUILD @@ -7,6 +7,7 @@ py_test( visibility = ["//:__subpackages__"], deps = [ "@pypi//pytest", + "@pypi//stim", "//src:lib_tesseract_decoder", ], ) @@ -17,6 +18,7 @@ py_test( visibility = ["//:__subpackages__"], deps = [ "@pypi//pytest", + "@pypi//stim", "//src:lib_tesseract_decoder", ], ) @@ -27,6 +29,7 @@ py_test( visibility = ["//:__subpackages__"], deps = [ "@pypi//pytest", + "@pypi//stim", "//src:lib_tesseract_decoder", ], ) @@ -37,6 +40,7 @@ py_test( visibility = ["//:__subpackages__"], deps = [ "@pypi//pytest", + "@pypi//stim", "//src:lib_tesseract_decoder", ], ) From 627c15794cedbf774448e4e8100e1ae0c1f12c5f Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 24 Jun 2025 16:06:06 -0700 Subject: [PATCH 06/14] format --- src/tesseract.pybind.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tesseract.pybind.cc b/src/tesseract.pybind.cc index a4de726..ff0bf75 100644 --- a/src/tesseract.pybind.cc +++ b/src/tesseract.pybind.cc @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tesseract.pybind.h" -#include #include "pybind11/detail/common.h" +#include + +#include "common.pybind.h" #include "simplex.pybind.h" #include "utils.pybind.h" +#include "tesseract.pybind.h" PYBIND11_MODULE(tesseract_decoder, tesseract) { py::module::import("stim"); From cc6f9bf93c5a2a89d1914aa7467e9c37b2b060b8 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 25 Jun 2025 11:25:59 -0700 Subject: [PATCH 07/14] format --- src/tesseract.pybind.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tesseract.pybind.cc b/src/tesseract.pybind.cc index ff0bf75..4c35029 100644 --- a/src/tesseract.pybind.cc +++ b/src/tesseract.pybind.cc @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "tesseract.pybind.h" -#include "pybind11/detail/common.h" #include #include "common.pybind.h" +#include "pybind11/detail/common.h" #include "simplex.pybind.h" #include "utils.pybind.h" -#include "tesseract.pybind.h" PYBIND11_MODULE(tesseract_decoder, tesseract) { py::module::import("stim"); From 2914e44a2ac1fa45513a8d93bb71188bd379f0db Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 15 Jul 2025 11:39:56 -0700 Subject: [PATCH 08/14] add CI --- .github/workflows/prerelease.yml | 101 +++++++++++++++++++++++++++++++ BUILD | 29 +++++++++ src/BUILD | 12 ---- 3 files changed, 130 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/prerelease.yml create mode 100644 BUILD diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml new file mode 100644 index 0000000..7ac063d --- /dev/null +++ b/.github/workflows/prerelease.yml @@ -0,0 +1,101 @@ +name: Pre-release Tesseract + +on: + push: + branches: + - main + + pull_request: + branches: + - main + +permissions: + contents: read + +jobs: + create_version: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5 + with: + python-version: '3.10' + - name: Create version + run: | + mkdir version + echo "$(python _version.py).dev$(date '+%Y%m%d%H%M%S')" > version/version.txt + cat version/version.txt + - uses: actions/upload-artifact@master + with: + name: version-file + path: version + + build_wheels: + runs-on: ${{ matrix.os }} + needs: [create_version] + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-24.04 + arch: x86_64 + - os: macos-14 + arch: auto + - os: macos-13 + arch: auto + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - name: Set up Python + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5 + with: + python-version: '3.10' + + - uses: actions/download-artifact@master + with: + name: version-file + path: version + + - name: Set up Bazel + uses: bazel-contrib/setup-bazel@0.14.0 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + + - name: Build package + run: | + bazel build --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel + + - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 + with: + name: python-wheels-${{ matrix.os }} + path: ./bazel-bin/*.whl + + release-wheels: + name: Publish all wheels + needs: [build_wheels] + runs-on: ubuntu-24.04 + + steps: + - name: Download build artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 + with: + pattern: python-wheels-* + merge-multiple: true + path: wheelhouse/ + + - name: Publish package to testpypi + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + repository_url: https://test.pypi.org/legacy/ + user: __token__ + password: ${{ secrets.TEST_PYPI_TOKEN }} + packages_dir: wheelhouse/ + + # - name: Publish package to pypi + # uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + # with: + # user: __token__ + # password: ${{ secrets.PYPI_TOKEN }} + # packages_dir: wheelhouse/ diff --git a/BUILD b/BUILD new file mode 100644 index 0000000..c8b3468 --- /dev/null +++ b/BUILD @@ -0,0 +1,29 @@ +load("@rules_python//python:packaging.bzl", "py_wheel") + +filegroup( + name="package_description", + srcs=["README.md"], + visibility = ["//visibility:public"], +) + +py_wheel( + name="tesseract_decoder_wheel", + distribution = "tesseract_decoder", + deps=[ + "//src:tesseract_decoder", + ], + version = "$(VERSION)", + requires=[ + "stim", + ], + platform= select({ + "@platforms//os:macos": "macosx_11_0_arm64", + "@platforms//os:windows": "win32", + "@platforms//os:linux": "manylinux_2_17_x86_64.manylinux2014_x86_64", + }), + description_file=":package_description", + description_content_type="text/markdown", + summary="A search-based decoder for quantum error correction (QEC).", + author="The Tesseract Decoder Authors.", + homepage="https://github.com/quantumlib/tesseract-decoder", +) diff --git a/src/BUILD b/src/BUILD index f18c234..5596f05 100644 --- a/src/BUILD +++ b/src/BUILD @@ -15,7 +15,6 @@ # load("@benchmark//:benchmark.bzl", "cc_benchmark") load("@pybind11_bazel//:build_defs.bzl", "pybind_extension", "pybind_library") load("@rules_python//python:defs.bzl", "py_library") -load("@rules_python//python:packaging.bzl", "py_wheel") package(default_visibility = ["//visibility:public"]) @@ -91,17 +90,6 @@ pybind_extension( ], ) -py_wheel( - name="tesseract_decoder_wheel", - distribution = "tesseract_decoder", - deps=[ - ":tesseract_decoder", - ], - version = "0.0.dev0", - requires=[ - "stim", - ], -) py_library( name="lib_tesseract_decoder", From b5a056e70283b18aeb9e4fbd0094226f27ecbc88 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 15 Jul 2025 11:41:13 -0700 Subject: [PATCH 09/14] add version file --- _version.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 _version.py diff --git a/_version.py b/_version.py new file mode 100644 index 0000000..646b797 --- /dev/null +++ b/_version.py @@ -0,0 +1,6 @@ +# Version of Tesseract's python distribution + +__version__ = '0.1.1' + +if __name__ == '__main__': + print(__version__) From 4ba11014d2bdd23cb57cb6daeac994193e1bf03e Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 15 Jul 2025 11:47:54 -0700 Subject: [PATCH 10/14] Add verbose --- .github/workflows/prerelease.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 7ac063d..ecb0b0f 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -92,6 +92,7 @@ jobs: user: __token__ password: ${{ secrets.TEST_PYPI_TOKEN }} packages_dir: wheelhouse/ + verbose: true # - name: Publish package to pypi # uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 From 09df98c0fe4aa0bbf1dfb571f7ddc4055c511797 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 15 Jul 2025 11:58:34 -0700 Subject: [PATCH 11/14] change macos name --- .github/workflows/prerelease.yml | 2 -- BUILD | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index ecb0b0f..d8d75b8 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -39,8 +39,6 @@ jobs: include: - os: ubuntu-24.04 arch: x86_64 - - os: macos-14 - arch: auto - os: macos-13 arch: auto diff --git a/BUILD b/BUILD index c8b3468..aeae459 100644 --- a/BUILD +++ b/BUILD @@ -17,7 +17,7 @@ py_wheel( "stim", ], platform= select({ - "@platforms//os:macos": "macosx_11_0_arm64", + "@platforms//os:macos": "macosx_10_13_x86_64", "@platforms//os:windows": "win32", "@platforms//os:linux": "manylinux_2_17_x86_64.manylinux2014_x86_64", }), From 0884d0953632f7c876ce04ab82c81bf026940b49 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 15 Jul 2025 13:07:30 -0700 Subject: [PATCH 12/14] add license --- .github/workflows/prerelease.yml | 5 +++++ BUILD | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index d8d75b8..32774cf 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -83,6 +83,11 @@ jobs: merge-multiple: true path: wheelhouse/ + - name: Check token + run: echo "received $MY_KEY" + env: + MY_KEY: ${{ secrets.TEST_PYPI_TOKEN }} + - name: Publish package to testpypi uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: diff --git a/BUILD b/BUILD index aeae459..1225b3a 100644 --- a/BUILD +++ b/BUILD @@ -6,11 +6,19 @@ filegroup( visibility = ["//visibility:public"], ) + +filegroup( + name="package_data", + srcs=["LICENSE"], + visibility = ["//visibility:public"], +) + py_wheel( name="tesseract_decoder_wheel", distribution = "tesseract_decoder", deps=[ "//src:tesseract_decoder", + ":package_data", ], version = "$(VERSION)", requires=[ From fc21ae2d26a0e809fa534f852670a22e53712b51 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 15 Jul 2025 13:21:30 -0700 Subject: [PATCH 13/14] add stable release workflow --- .github/workflows/prerelease.yml | 16 ++- .github/workflows/stable-release-workflow.yml | 100 ++++++++++++++++++ 2 files changed, 106 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/stable-release-workflow.yml diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 32774cf..1bba181 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -5,10 +5,6 @@ on: branches: - main - pull_request: - branches: - - main - permissions: contents: read @@ -97,9 +93,9 @@ jobs: packages_dir: wheelhouse/ verbose: true - # - name: Publish package to pypi - # uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - # with: - # user: __token__ - # password: ${{ secrets.PYPI_TOKEN }} - # packages_dir: wheelhouse/ + - name: Publish package to pypi + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + packages_dir: wheelhouse/ diff --git a/.github/workflows/stable-release-workflow.yml b/.github/workflows/stable-release-workflow.yml new file mode 100644 index 0000000..b827a57 --- /dev/null +++ b/.github/workflows/stable-release-workflow.yml @@ -0,0 +1,100 @@ +name: Stable-release Tesseract + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + create_version: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5 + with: + python-version: '3.10' + - name: Create version + run: | + mkdir version + echo "$(python _version.py)" > version/version.txt + cat version/version.txt + - uses: actions/upload-artifact@master + with: + name: version-file + path: version + + build_wheels: + runs-on: ${{ matrix.os }} + needs: [create_version] + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-24.04 + arch: x86_64 + - os: macos-13 + arch: auto + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - name: Set up Python + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5 + with: + python-version: '3.10' + + - uses: actions/download-artifact@master + with: + name: version-file + path: version + + - name: Set up Bazel + uses: bazel-contrib/setup-bazel@0.14.0 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + + - name: Build package + run: | + bazel build --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel + + - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 + with: + name: python-wheels-${{ matrix.os }} + path: ./bazel-bin/*.whl + + release-wheels: + name: Publish all wheels + needs: [build_wheels] + runs-on: ubuntu-24.04 + + steps: + - name: Download build artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 + with: + pattern: python-wheels-* + merge-multiple: true + path: wheelhouse/ + + - name: Check token + run: echo "received $MY_KEY" + env: + MY_KEY: ${{ secrets.TEST_PYPI_TOKEN }} + + - name: Publish package to testpypi + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + repository_url: https://test.pypi.org/legacy/ + user: __token__ + password: ${{ secrets.TEST_PYPI_TOKEN }} + packages_dir: wheelhouse/ + verbose: true + + - name: Publish package to pypi + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + packages_dir: wheelhouse/ From b44842817303fdea513633e79b93b1e8e36bc096 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 15 Jul 2025 13:22:50 -0700 Subject: [PATCH 14/14] nit --- .github/workflows/prerelease.yml | 5 ----- .github/workflows/stable-release-workflow.yml | 4 ---- 2 files changed, 9 deletions(-) diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 1bba181..7b9eecc 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -79,11 +79,6 @@ jobs: merge-multiple: true path: wheelhouse/ - - name: Check token - run: echo "received $MY_KEY" - env: - MY_KEY: ${{ secrets.TEST_PYPI_TOKEN }} - - name: Publish package to testpypi uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: diff --git a/.github/workflows/stable-release-workflow.yml b/.github/workflows/stable-release-workflow.yml index b827a57..de7c291 100644 --- a/.github/workflows/stable-release-workflow.yml +++ b/.github/workflows/stable-release-workflow.yml @@ -78,10 +78,6 @@ jobs: merge-multiple: true path: wheelhouse/ - - name: Check token - run: echo "received $MY_KEY" - env: - MY_KEY: ${{ secrets.TEST_PYPI_TOKEN }} - name: Publish package to testpypi uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29