From 49d68d8a4f1b0b99c5c66c1395dc036c7ef4f896 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Mon, 23 Sep 2024 14:42:19 +0530 Subject: [PATCH 1/5] Add build workflow via docker --- .github/workflows/build.yml | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..4b4723ec --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,46 @@ +name: Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11"] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Upgrade pip + run: | + python -m pip install --upgrade pip + + - name: Build the manylinux2010 image + run: docker compose build manylinux2010 + + - name: Build the package for Python ${{ matrix.python-version }} + run: | + version="${{ matrix.python-version }}" + docker compose run -e PYTHON_VERSION=$(echo "$version" | sed 's/\.//') manylinux2010 + + - name: Upload wheel artifact for Python ${{ matrix.python-version }} + uses: actions/upload-artifact@v3 + with: + name: data-validation-wheel-py${{ matrix.python-version }} + path: dist/*.whl + + - name: Install built wheel + run: pip install dist/*.whl From 15f7d5d8685a9269eec410851912b17761fb63e4 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Mon, 23 Sep 2024 14:50:32 +0530 Subject: [PATCH 2/5] rename docker-compose to docker compose --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2aead086..3c913abd 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,9 @@ tested at Google. ### 1. Install Docker -Please first install `docker` and `docker-compose` by following the directions: +Please first install `docker` and `docker compose` by following the directions: [docker](https://docs.docker.com/install/); -[docker-compose](https://docs.docker.com/compose/install/). +[docker compose](https://docs.docker.com/compose/install/). ### 2. Clone the TFDV repository @@ -86,8 +86,8 @@ branch), pass `-b ` to the `git clone` command. Then, run the following at the project root: ```bash -sudo docker-compose build manylinux2010 -sudo docker-compose run -e PYTHON_VERSION=${PYTHON_VERSION} manylinux2010 +sudo docker compose build manylinux2010 +sudo docker compose run -e PYTHON_VERSION=${PYTHON_VERSION} manylinux2010 ``` where `PYTHON_VERSION` is one of `{39, 310, 311}`. From 942fd77b31a83d62e97b1b28cc9e5b4a9869b529 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Sat, 28 Sep 2024 00:48:58 +0530 Subject: [PATCH 3/5] add twine check and upload to PyPi --- .github/workflows/build.yml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b4723ec..52c24095 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,4 +43,32 @@ jobs: path: dist/*.whl - name: Install built wheel - run: pip install dist/*.whl + run: | + twine check dist/* + pip install dist/*.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] + environment: + name: pypi + url: https://pypi.org/p/tensorflow-data-validation/ + permissions: + id-token: write + steps: + - name: Retrieve wheels + uses: actions/download-artifact@v4.1.8 + 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/ From 7146bcd878e55fb013c8232dcbbf946470717916 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Sat, 28 Sep 2024 00:50:06 +0530 Subject: [PATCH 4/5] add workflow_dispatch --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 52c24095..674a9143 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - master + workflow_dispatch: jobs: build: From e096fdf012c788077dc3b4c3baa4f7facb86ba54 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Sun, 29 Sep 2024 22:08:01 +0530 Subject: [PATCH 5/5] install twine before twine check --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 674a9143..88a37a59 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,6 +45,7 @@ jobs: - name: Install built wheel run: | + pip install twine twine check dist/* pip install dist/*.whl