Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,18 @@ jobs:
runs-on: ${{ matrix.os }}
needs: [create_version]
strategy:
fail-fast: false
fail-fast: true
matrix:
include:
- os: ubuntu-24.04
arch: x86_64
- os: macos-13
arch: auto
os: [ubuntu-24.04, macos-13]
python-version: ['3.10', '3.11', '3.12']


steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Python
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
with:
python-version: '3.10'
python-version: ${{ matrix.python-version }}

- uses: actions/download-artifact@master
with:
Expand All @@ -57,13 +55,22 @@ jobs:
disk-cache: ${{ github.workflow }}
repository-cache: true

- name: Set Python Version
env:
TARGET_PYTHON: ${{ matrix.python-version }}
run: |
echo "set version to ${TARGET_PYTHON}"
python _update_bazel_py_version.py $TARGET_PYTHON

- name: Build package
env:
TARGET_PYTHON: ${{ matrix.python-version }}
run: |
bazel build --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@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: python-wheels-${{ matrix.os }}
name: python-wheels-${{ matrix.os }}-${{ matrix.python-version }}
path: ./bazel-bin/*.whl

release-wheels:
Expand All @@ -88,6 +95,7 @@ jobs:
packages_dir: wheelhouse/
verbose: true


- name: Publish package to pypi
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
Expand Down
25 changes: 15 additions & 10 deletions .github/workflows/stable-release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,17 @@ jobs:
runs-on: ${{ matrix.os }}
needs: [create_version]
strategy:
fail-fast: false
fail-fast: true
matrix:
include:
- os: ubuntu-24.04
arch: x86_64
- os: macos-13
arch: auto
os: [ubuntu-24.04, macos-13]
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Python
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
with:
python-version: '3.10'
python-version: ${{ matrix.python-version }}

- uses: actions/download-artifact@master
with:
Expand All @@ -56,13 +53,22 @@ jobs:
disk-cache: ${{ github.workflow }}
repository-cache: true

- name: Set Python Version
env:
TARGET_PYTHON: ${{ matrix.python-version }}
run: |
echo "set version to ${TARGET_PYTHON}"
python _update_bazel_py_version.py $TARGET_PYTHON

- name: Build package
env:
TARGET_PYTHON: ${{ matrix.python-version }}
run: |
bazel build --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@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: python-wheels-${{ matrix.os }}
name: python-wheels-${{ matrix.os }}-${{ matrix.python-version }}
path: ./bazel-bin/*.whl

release-wheels:
Expand All @@ -78,7 +84,6 @@ jobs:
merge-multiple: true
path: wheelhouse/


- name: Publish package to testpypi
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
Expand Down
3 changes: 3 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ py_wheel(
requires=[
"stim",
],
abi="$(TARGET_VERSION)",
python_tag="$(TARGET_VERSION)",
platform= select({
"@platforms//os:macos": "macosx_10_13_x86_64",
"@platforms//os:windows": "win32",
"@platforms//os:linux": "manylinux_2_17_x86_64.manylinux2014_x86_64",
}),
strip_path_prefixes = ["src"],
description_file=":package_description",
description_content_type="text/markdown",
summary="A search-based decoder for quantum error correction (QEC).",
Expand Down
14 changes: 14 additions & 0 deletions _update_bazel_py_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sys

def main():
version = sys.argv[1]
lines = open('MODULE.bazel').read().splitlines()
for i, l in enumerate(lines):
if l.startswith('DEFAULT_PYTHON_VERSION = '):
lines[i] = f'DEFAULT_PYTHON_VERSION = "{version}"'
break
with open('MODULE.bazel', 'w') as ouf:
print(*lines, file=ouf, sep='\n')

if __name__ == '__main__':
main()
Loading