From 24d21a9ecf482f6065044c6020da97ead7d8f173 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 11 Aug 2021 10:22:31 -0700 Subject: [PATCH] Add main and test workflows for github actions. PiperOrigin-RevId: 390163554 --- .github/workflows/tfg-main-pypi.yml | 49 +++++++++++++++++++ ...-nigthly-pypi.yml => tfg-nightly-pypi.yml} | 0 .github/workflows/tfg-test-pypi.yml | 49 +++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 .github/workflows/tfg-main-pypi.yml rename .github/workflows/{tfg-nigthly-pypi.yml => tfg-nightly-pypi.yml} (100%) create mode 100644 .github/workflows/tfg-test-pypi.yml diff --git a/.github/workflows/tfg-main-pypi.yml b/.github/workflows/tfg-main-pypi.yml new file mode 100644 index 000000000..741dc116e --- /dev/null +++ b/.github/workflows/tfg-main-pypi.yml @@ -0,0 +1,49 @@ +#Deploys the main tensorflow_graphics package to pypi +name: Deploy tensorflow_graphics to pypi + +on: workflow_dispatch + +jobs: + deploy: + if: github.repository == 'tensorflow/graphics' # prevents action from running on forks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install system dependencies + run: | + sudo xargs apt-get update + sudo xargs apt-get -y install < requirements.unix + - name: Install pip requirements + run: | + python -m pip install --upgrade pip + pip install -U -r requirements.txt + pip install -U pytest + pip install -U setuptools wheel + pip install -U twine + - name: Build ops + run: | + bazel build tensorflow_graphics/... --define=BASEDIR=$(pwd) --sandbox_writable_path=$(pwd) + bazel clean --expunge + - name: Run python tests + env: + MESA_GL_VERSION_OVERRIDE: 4.5 + MESA_GLSL_VERSION_OVERRIDE: 450 + run: | + pytest tensorflow_graphics + - name: Build pip package and install + run: | + python setup.py sdist bdist_wheel + pip install dist/*.whl + - name: Test install + run: | + cd $(mktemp -d) && python -c 'import tensorflow_graphics as tfg' + - name: Publish to PyPi # https://pypi.org/project/tensorflow_graphics + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload dist/* diff --git a/.github/workflows/tfg-nigthly-pypi.yml b/.github/workflows/tfg-nightly-pypi.yml similarity index 100% rename from .github/workflows/tfg-nigthly-pypi.yml rename to .github/workflows/tfg-nightly-pypi.yml diff --git a/.github/workflows/tfg-test-pypi.yml b/.github/workflows/tfg-test-pypi.yml new file mode 100644 index 000000000..bd7496b0a --- /dev/null +++ b/.github/workflows/tfg-test-pypi.yml @@ -0,0 +1,49 @@ +# Deploys tfg-nightly to the test pypi +name: Deploy to test-pypi + +on: workflow_dispatch + +jobs: + deploy: + if: github.repository == 'tensorflow/graphics' # prevents action from running on forks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install system dependencies + run: | + sudo xargs apt-get update + sudo xargs apt-get -y install < requirements.unix + - name: Install pip requirements + run: | + python -m pip install --upgrade pip + pip install -U -r requirements.txt + pip install -U pytest + pip install -U setuptools wheel + pip install -U twine + - name: Build ops + run: | + bazel build tensorflow_graphics/... --define=BASEDIR=$(pwd) --sandbox_writable_path=$(pwd) + bazel clean --expunge + - name: Run python tests + env: + MESA_GL_VERSION_OVERRIDE: 4.5 + MESA_GLSL_VERSION_OVERRIDE: 450 + run: | + pytest tensorflow_graphics + - name: Build pip package and install + run: | + python setup.py sdist bdist_wheel --nightly + pip install dist/*.whl + - name: Test install + run: | + cd $(mktemp -d) && python -c 'import tensorflow_graphics as tfg' + - name: Publish to PyPi # https://pypi.org/project/tfg-nightly + env: + TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} + run: | + twine upload --repository testpypi dist/*