diff --git a/.github/reusable-build/action.yml b/.github/reusable-build/action.yml new file mode 100644 index 0000000..75f7d45 --- /dev/null +++ b/.github/reusable-build/action.yml @@ -0,0 +1,31 @@ +name: Reusable action which builds struct2tensor + +inputs: + python-version: + description: 'Python version' + required: true +runs: + using: 'composite' + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} + + - name: Install build dependencies + shell: bash + run: | + pip install numpy + + - name: Build the package for Python ${{ inputs.python-version }} + shell: bash + run: | + docker compose build --build-arg PYTHON_VERSION=${{ inputs.python-version }} manylinux2014 + docker compose run -e TF_VERSION=RELEASED_TF_2 manylinux2014 + bazel build -c opt struct2tensor:struct2tensor_kernels_and_ops + + - name: Upload wheel artifact for Python ${{ inputs.python-version }} + uses: actions/upload-artifact@v4 + with: + name: ml-metadata-wheel-py${{ inputs.python-version }} + path: dist/*.whl diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..446cbff --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,69 @@ +name: Build struct2tensor wheels + +on: + pull_request: + workflow_dispatch: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11"] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build package + id: build-package + uses: ./.github/reusable-build + with: + python-version: ${{ matrix.python-version }} + + - name: Retrieve wheels + uses: actions/download-artifact@v4 + with: + merge-multiple: true + path: wheels + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: List and check wheels + shell: bash + run: | + pip install twine pkginfo>=1.10.0 + ${{ matrix.ls || 'ls -lh' }} wheels/ + twine check wheels/* + + + 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] + environment: + name: pypi + url: https://pypi.org/p/struct2tensor/ + permissions: + id-token: write + steps: + - name: Retrieve wheels + 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.9 + with: + packages_dir: wheels/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f5c8e2a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,43 @@ +name: Test struct2tensor wheels + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9"] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build package + id: build-package + uses: ./.github/reusable-build + with: + python-version: ${{ matrix.python-version }} + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Test dependencies + shell: bash + run: | + pip install pyarrow tensorflow tensorflow-metadata protobuf pytest + + - name: Run Test + run: | + ls + pytest -vv + + - name: Debugging with tmate + if: failure() + uses: mxschmitt/action-tmate@v3.19 + diff --git a/bazel-bin b/bazel-bin new file mode 120000 index 0000000..2f48403 --- /dev/null +++ b/bazel-bin @@ -0,0 +1 @@ +/root/.cache/bazel/_bazel_root/dc79bfaee0f4e290b3fb72a6e9cdf460/execroot/struct2tensor/bazel-out/k8-opt/bin \ No newline at end of file diff --git a/bazel-out b/bazel-out new file mode 120000 index 0000000..692087b --- /dev/null +++ b/bazel-out @@ -0,0 +1 @@ +/root/.cache/bazel/_bazel_root/dc79bfaee0f4e290b3fb72a6e9cdf460/execroot/struct2tensor/bazel-out \ No newline at end of file diff --git a/bazel-struct2tensor b/bazel-struct2tensor new file mode 120000 index 0000000..5eda650 --- /dev/null +++ b/bazel-struct2tensor @@ -0,0 +1 @@ +/root/.cache/bazel/_bazel_root/dc79bfaee0f4e290b3fb72a6e9cdf460/execroot/struct2tensor \ No newline at end of file diff --git a/bazel-testlogs b/bazel-testlogs new file mode 120000 index 0000000..2d79697 --- /dev/null +++ b/bazel-testlogs @@ -0,0 +1 @@ +/root/.cache/bazel/_bazel_root/dc79bfaee0f4e290b3fb72a6e9cdf460/execroot/struct2tensor/bazel-out/k8-opt/testlogs \ No newline at end of file diff --git a/dist/struct2tensor-0.47.0.dev0-cp311-cp311-linux_x86_64.whl b/dist/struct2tensor-0.47.0.dev0-cp311-cp311-linux_x86_64.whl new file mode 100644 index 0000000..02629fb Binary files /dev/null and b/dist/struct2tensor-0.47.0.dev0-cp311-cp311-linux_x86_64.whl differ