From 9a70d35559aae37cc0ae7b22904230f2ab62a5a2 Mon Sep 17 00:00:00 2001 From: andrewfulton9 Date: Mon, 5 May 2025 15:45:03 -0600 Subject: [PATCH 01/13] add workflow for building package and pushing to pypi --- .github/workflows/wheels.yml | 150 +++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 .github/workflows/wheels.yml diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 0000000..c9221cd --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,150 @@ +name: Build Wheels & Publish to PyPI + +on: + pull_request: + workflow_dispatch: + release: + types: [published] + +env: + USE_BAZEL_VERSION: "7.2.1" + +jobs: + build_sdist: + name: Build sdist + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: install python dependencies + run: pip install build twine + + - uses: bazel-contrib/setup-bazel@0.14.0 + name: Set up Bazel + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }}-${{ hashFiles('.github/workflows/wheels.yml') }} + # Share repository cache between workflows. + repository-cache: true + + - name: Verify bazel installation + run: | + which bazel + bazel info + bazel version + + - name: build sdist + run: | + python -m build --sdist -o wheelhouse + + - name: List and check sdist + run: | + ls -lh wheelhouse/ + twine check wheelhouse/* + + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: sdist + path: ./wheelhouse/*.tar.gz + + build_wheels: + name: > + build ${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }} + ${{ (matrix.arch) || '' }} + strategy: + fail-fast: false + matrix: + os: [ubuntu] + python-version: ['cp311'] + + runs-on: ${{ format('{0}-latest', matrix.os) }} + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install python build dependencies + run: | + + pip install wheel + + + - uses: bazel-contrib/setup-bazel@0.14.0 + name: Set up Bazel + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }}-${{ hashFiles('.github/workflows/wheels.yml') }} + # Share repository cache between workflows. + repository-cache: true + + - name: Verify bazel installation + run: | + which bazel + bazel info + bazel version + + - name: Install build + run: python -m pip install --upgrade pip build + + - name: Build wheels + run: | + python -m build --wheel + mkdir wheelhouse + mv dist/*.whl wheelhouse/ + + - name: List and check wheels + run: | + pip install twine pkginfo>=1.11.0 + ${{ matrix.ls || 'ls -lh' }} wheelhouse/ + twine check wheelhouse/* + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-${{ matrix.python-version }}-${{ matrix.os }} + path: ./wheelhouse/*.whl + + upload_to_pypi: + name: Upload to PyPI + runs-on: ubuntu-latest + if: (github.event_name == 'release' && startsWith(github.ref, 'refs/tags')) || (github.event_name == 'workflow_dispatch') + needs: [build_wheels, build_sdist] + environment: + name: pypi + url: https://pypi.org/p/tensorflow-metadata + permissions: + id-token: write + steps: + - name: Retrieve wheels and sdist + uses: actions/download-artifact@v4 + with: + merge-multiple: true + path: wheels/ + + - name: List the build artifacts + run: | + ls -lAs wheels/ + + - name: Upload to PyPI + uses: pypa/gh-action-pypi-publish@release/v1.12 + with: + packages-dir: wheels/ + repository-url: https://pypi.org/legacy/ + # already checked, and the pkginfo/twine versions on this runner causes check to fail + verify-metadata: false + verbose: true From 45f0c8c46726c6f651beb9702f9f994770b41c55 Mon Sep 17 00:00:00 2001 From: Andrew Fulton Date: Mon, 4 Aug 2025 12:30:15 -0600 Subject: [PATCH 02/13] Update .github/workflows/wheels.yml Co-authored-by: Peyton Murray --- .github/workflows/wheels.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index c9221cd..d14ab4f 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -25,22 +25,6 @@ jobs: - name: install python dependencies run: pip install build twine - - uses: bazel-contrib/setup-bazel@0.14.0 - name: Set up Bazel - with: - # Avoid downloading Bazel every time. - bazelisk-cache: true - # Store build cache per workflow. - disk-cache: ${{ github.workflow }}-${{ hashFiles('.github/workflows/wheels.yml') }} - # Share repository cache between workflows. - repository-cache: true - - - name: Verify bazel installation - run: | - which bazel - bazel info - bazel version - - name: build sdist run: | python -m build --sdist -o wheelhouse From f3cd4cd64263aa9f6215efdbd3314cdac08ab5ee Mon Sep 17 00:00:00 2001 From: Andrew Fulton Date: Mon, 4 Aug 2025 12:30:27 -0600 Subject: [PATCH 03/13] Update .github/workflows/wheels.yml Co-authored-by: Peyton Murray --- .github/workflows/wheels.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d14ab4f..485420c 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -62,9 +62,7 @@ jobs: - name: Install python build dependencies run: | - pip install wheel - - uses: bazel-contrib/setup-bazel@0.14.0 name: Set up Bazel From 5a61b2bdad583ffb95eb7d256ceac0ed368d893c Mon Sep 17 00:00:00 2001 From: Andrew Fulton Date: Mon, 4 Aug 2025 12:30:39 -0600 Subject: [PATCH 04/13] Update .github/workflows/wheels.yml Co-authored-by: Peyton Murray --- .github/workflows/wheels.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 485420c..3d234ef 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -64,22 +64,6 @@ jobs: run: | pip install wheel - - uses: bazel-contrib/setup-bazel@0.14.0 - name: Set up Bazel - with: - # Avoid downloading Bazel every time. - bazelisk-cache: true - # Store build cache per workflow. - disk-cache: ${{ github.workflow }}-${{ hashFiles('.github/workflows/wheels.yml') }} - # Share repository cache between workflows. - repository-cache: true - - - name: Verify bazel installation - run: | - which bazel - bazel info - bazel version - - name: Install build run: python -m pip install --upgrade pip build From f0163bdbbf9ed87656b2e0bc5489a32bd3df9b58 Mon Sep 17 00:00:00 2001 From: andrewfulton9 Date: Mon, 4 Aug 2025 12:38:25 -0600 Subject: [PATCH 05/13] consolidate build_wheels and build_sdist to single build call --- .github/workflows/wheels.yml | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 3d234ef..3dc2790 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -10,37 +10,7 @@ env: USE_BAZEL_VERSION: "7.2.1" jobs: - build_sdist: - name: Build sdist - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Set up python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: install python dependencies - run: pip install build twine - - - name: build sdist - run: | - python -m build --sdist -o wheelhouse - - - name: List and check sdist - run: | - ls -lh wheelhouse/ - twine check wheelhouse/* - - - name: Upload sdist - uses: actions/upload-artifact@v4 - with: - name: sdist - path: ./wheelhouse/*.tar.gz - - build_wheels: + build: name: > build ${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }} ${{ (matrix.arch) || '' }} @@ -69,7 +39,7 @@ jobs: - name: Build wheels run: | - python -m build --wheel + python -m build mkdir wheelhouse mv dist/*.whl wheelhouse/ @@ -89,7 +59,7 @@ jobs: name: Upload to PyPI runs-on: ubuntu-latest if: (github.event_name == 'release' && startsWith(github.ref, 'refs/tags')) || (github.event_name == 'workflow_dispatch') - needs: [build_wheels, build_sdist] + needs: [build] environment: name: pypi url: https://pypi.org/p/tensorflow-metadata From d9f08ec3f9965c9cca8e8bfc400ed9b68e35a70d Mon Sep 17 00:00:00 2001 From: andrewfulton9 Date: Mon, 4 Aug 2025 12:50:20 -0600 Subject: [PATCH 06/13] verify bazel version --- .github/workflows/wheels.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 3dc2790..cf798fe 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -37,6 +37,12 @@ jobs: - name: Install build run: python -m pip install --upgrade pip build + - name: Verify bazel installation + run: | + which bazel + bazel info + bazel version + - name: Build wheels run: | python -m build From a8b71ca1996aa1d9ffb0f72fdf6f5c6d1cde17ed Mon Sep 17 00:00:00 2001 From: andrewfulton9 Date: Mon, 4 Aug 2025 15:23:02 -0600 Subject: [PATCH 07/13] change bazel version to "6.5.0" to match version in WORKSPACE --- .github/workflows/wheels.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index cf798fe..d3d5e6d 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -7,7 +7,8 @@ on: types: [published] env: - USE_BAZEL_VERSION: "7.2.1" + # USE_BAZEL_VERSION: "7.2.1" + USE_BAZEL_VERSION: "6.5.0" jobs: build: From 34d38113c78f9d9c22b7fbe376125944a7eaa44e Mon Sep 17 00:00:00 2001 From: andrewfulton9 Date: Mon, 4 Aug 2025 15:32:42 -0600 Subject: [PATCH 08/13] updates --- .github/workflows/wheels.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d3d5e6d..9ee0eb1 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -7,8 +7,8 @@ on: types: [published] env: - # USE_BAZEL_VERSION: "7.2.1" - USE_BAZEL_VERSION: "6.5.0" + USE_BAZEL_VERSION: "7.6.1" + jobs: build: @@ -18,8 +18,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu] - python-version: ['cp311'] + os: [ubuntu-latest] + python-version: ['3.9', '3.10', '3.11', '3.12'] + runs-on: ${{ format('{0}-latest', matrix.os) }} steps: @@ -29,14 +30,11 @@ jobs: - name: Set up python uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: ${{ matrix.python-version }} - name: Install python build dependencies run: | - pip install wheel - - - name: Install build - run: python -m pip install --upgrade pip build + python -m pip install --upgrade pip build - name: Verify bazel installation run: | From fc99a07a95b4347ee6bbd161a38d3fa57962c03d Mon Sep 17 00:00:00 2001 From: andrewfulton9 Date: Mon, 4 Aug 2025 15:39:49 -0600 Subject: [PATCH 09/13] lint --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 9ee0eb1..4dc3675 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -8,7 +8,7 @@ on: env: USE_BAZEL_VERSION: "7.6.1" - + jobs: build: From c7bebfe5ab46feb3f0d6090c47f0d00cc68b49d5 Mon Sep 17 00:00:00 2001 From: andrewfulton9 Date: Mon, 4 Aug 2025 15:53:50 -0600 Subject: [PATCH 10/13] fix workflow --- .github/workflows/wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 4dc3675..d9f3252 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -16,9 +16,9 @@ jobs: build ${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }} ${{ (matrix.arch) || '' }} strategy: - fail-fast: false + # fail-fast: true matrix: - os: [ubuntu-latest] + os: [ubuntu] python-version: ['3.9', '3.10', '3.11', '3.12'] From fd4a61640a2318e212abc1632f9adad2b80cc9d7 Mon Sep 17 00:00:00 2001 From: andrewfulton9 Date: Mon, 4 Aug 2025 15:55:20 -0600 Subject: [PATCH 11/13] build sdist and wheel --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d9f3252..8e381bb 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -44,7 +44,7 @@ jobs: - name: Build wheels run: | - python -m build + python -m build --wheel --sdist mkdir wheelhouse mv dist/*.whl wheelhouse/ From a1830f7fcc900930cea0b619926dccf0c00b2199 Mon Sep 17 00:00:00 2001 From: andrewfulton9 Date: Mon, 4 Aug 2025 17:07:30 -0600 Subject: [PATCH 12/13] update to upload both wheels and source dists. remove bazel verification --- .github/workflows/wheels.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 8e381bb..56665fe 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -36,17 +36,11 @@ jobs: run: | python -m pip install --upgrade pip build - - name: Verify bazel installation - run: | - which bazel - bazel info - bazel version - - name: Build wheels run: | python -m build --wheel --sdist mkdir wheelhouse - mv dist/*.whl wheelhouse/ + mv dist/* wheelhouse/ - name: List and check wheels run: | @@ -58,7 +52,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: wheels-${{ matrix.python-version }}-${{ matrix.os }} - path: ./wheelhouse/*.whl + path: ./wheelhouse/* upload_to_pypi: name: Upload to PyPI From ffce1c230d49da3a07d9aa74afda267cd4612469 Mon Sep 17 00:00:00 2001 From: andrewfulton9 Date: Mon, 4 Aug 2025 17:17:41 -0600 Subject: [PATCH 13/13] change artifact name from wheels-* to builds-* for clarity --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 56665fe..efc166c 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -51,7 +51,7 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-${{ matrix.python-version }}-${{ matrix.os }} + name: build-${{ matrix.python-version }}-${{ matrix.os }} path: ./wheelhouse/* upload_to_pypi: