Skip to content

Commit 5f17c4b

Browse files
sofienbouazizcopybara-github
authored andcommitted
Fix CI error with Bazel and cleanup:
- fix trimesh_feature_test.py - fix coverage by adding the missing argument --service=github - fix and clean rasterizer compilation by using a simple genrule, making the CI also easier to extend to other ops - Activate rasterizer unit tests and fix issues with shaders and loading the dynamic library - Run rasterizer unit test using MESA on github action setup proper version for GL and GLSL PiperOrigin-RevId: 352705180
1 parent d5c26cf commit 5f17c4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+107
-6931
lines changed

.bazelrc

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
build --verbose_failures
2-
test --keep_going
3-
test --build_tests_only
4-
test --test_output=errors
5-
test --test_verbose_timeout_warnings
1+
build --verbose_failures

.flake8

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ignore = C901,
1313
E111,
1414
E114,
1515
E121,
16+
E124,
1617
E125,
1718
E126,
1819
E129,

.github/workflows/build.yml

+20-18
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,40 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v2
17-
1817
- name: Set up Python
19-
uses: actions/setup-python@v1
18+
uses: actions/setup-python@v2
2019
with:
21-
python-version: 3.x
22-
23-
- name: Install system dependencies
20+
python-version: 3.8
21+
- name: Install system requirements
2422
run: |
2523
sudo xargs apt-get update
2624
sudo xargs apt-get -y install < requirements.unix
27-
- name: Linter
25+
- name: Install pip requirements
2826
run: |
2927
python -m pip install --upgrade pip
30-
pip install flake8
31-
flake8 --config=.flake8 tensorflow_graphics/
32-
- name: Build rasterizer
28+
pip install -U -r requirements.txt
29+
pip install -U pytest coveralls
30+
pip install -U flake8
31+
pip install -U setuptools wheel
32+
- name: Build ops
3333
run: |
34-
docker run -v ${PWD}:/working_dir -w /working_dir tensorflow/tensorflow:custom-op-ubuntu16 "./build_rasterizer.sh"
35-
- name: Install pip requirements
36-
run: |
37-
pip install -r requirements.txt
38-
- name: Test
34+
bazel build tensorflow_graphics/... --define=BASEDIR=$(pwd) --sandbox_writable_path=$(pwd)
35+
bazel clean --expunge
36+
- name: Run python tests and coverage
3937
env:
4038
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
MESA_GL_VERSION_OVERRIDE: 4.5
40+
MESA_GLSL_VERSION_OVERRIDE: 450
4141
run: |
42-
pip install pytest coveralls
4342
coverage run --source tensorflow_graphics -m py.test
44-
coveralls
45-
- name: Build and Install
43+
coveralls --service=github
44+
- name: Linter
45+
run: |
46+
flake8 --config=.flake8 tensorflow_graphics/
47+
- name: Build pip package and install
4648
run: |
4749
python setup.py sdist bdist_wheel
48-
pip install dist/tensorflow_graphics*.whl
50+
pip install dist/*.whl
4951
- name: Test install
5052
run: |
5153
cd $(mktemp -d) && python -c 'import tensorflow_graphics as tfg'

.github/workflows/tfg-nigthly-pypi.yml

+19-27
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,41 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v2
16-
1716
- name: Set up Python
1817
uses: actions/setup-python@v2
1918
with:
20-
python-version: '3.x'
21-
19+
python-version: 3.8
2220
- name: Install system dependencies
2321
run: |
2422
sudo xargs apt-get update
2523
sudo xargs apt-get -y install < requirements.unix
26-
- name: Build rasterizer
27-
run: |
28-
docker run -v ${PWD}:/working_dir -w /working_dir tensorflow/tensorflow:custom-op-ubuntu16 "./build_rasterizer.sh"
2924
- name: Install pip requirements
3025
run: |
3126
python -m pip install --upgrade pip
32-
pip install setuptools wheel twine pytest
33-
pip install -r requirements.txt
34-
- name: Test
27+
pip install -U -r requirements.txt
28+
pip install -U pytest
29+
pip install -U setuptools wheel
30+
pip install -U twine
31+
- name: Build ops
32+
run: |
33+
bazel build tensorflow_graphics/... --define=BASEDIR=$(pwd) --sandbox_writable_path=$(pwd)
34+
bazel clean --expunge
35+
- name: Run python tests
36+
env:
37+
MESA_GL_VERSION_OVERRIDE: 4.5
38+
MESA_GLSL_VERSION_OVERRIDE: 450
3539
run: |
3640
pytest tensorflow_graphics
37-
38-
- name: Build nightly
41+
- name: Build pip package and install
3942
run: |
4043
python setup.py sdist bdist_wheel --nightly
41-
42-
- name: Install (and test)
43-
run: |
4444
pip install dist/*.whl
45-
cd $(mktemp -d) && python -c 'import tensorflow_graphics as tfg'
46-
47-
# https://pypi.org/project/tfg-nightly
48-
- name: Publish to PyPi
45+
- name: Test install
46+
run: |
47+
cd $(mktemp -d) && python -c 'import tensorflow_graphics as tfg'
48+
- name: Publish to PyPi # https://pypi.org/project/tfg-nightly
4949
env:
5050
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
5151
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
5252
run: |
53-
twine upload dist/*
54-
55-
# # https://test.pypi.org/project/tfg-nightly
56-
# - name: Publish to test-pypi
57-
# env:
58-
# TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
59-
# TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
60-
# run: |
61-
# twine upload --repository testpypi dist/*
53+
twine upload dist/*

WORKSPACE

-40
Original file line numberDiff line numberDiff line change
@@ -1,41 +1 @@
11
workspace(name = "tensorflow_graphics")
2-
3-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4-
load("//third_party:tf.bzl", "tf_configure")
5-
6-
7-
http_archive(
8-
name = "bazel_skylib",
9-
url = "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.0/bazel-skylib-1.0.0.tar.gz",
10-
sha256 = "e72747100a8b6002992cc0bf678f6279e71a3fd4a88cab3371ace6c73432be30",
11-
)
12-
13-
http_archive(
14-
name = "io_bazel_rules_closure",
15-
sha256 = "9d359cc1b508082d8ba309ba085da6ecec85e7a4d5bd08f8db9666ee39a85529",
16-
strip_prefix = "rules_closure-0.9.0",
17-
url = "https://github.com/bazelbuild/rules_closure/archive/0.9.0.zip",
18-
)
19-
20-
http_archive(
21-
name = "com_google_googletest",
22-
strip_prefix = "googletest-master",
23-
urls = ["https://github.com/google/googletest/archive/master.zip"],
24-
)
25-
26-
http_archive(
27-
name = "rules_cc",
28-
strip_prefix = "rules_cc-master",
29-
urls = ["https://github.com/bazelbuild/rules_cc/archive/master.zip"],
30-
)
31-
32-
http_archive(
33-
name = "com_google_absl",
34-
strip_prefix = "abseil-cpp-43ef2148c0936ebf7cb4be6b19927a9d9d145b8f",
35-
url = "https://github.com/abseil/abseil-cpp/archive/43ef2148c0936ebf7cb4be6b19927a9d9d145b8f.tar.gz",
36-
sha256 = "acd93f6baaedc4414ebd08b33bebca7c7a46888916101d8c0b8083573526d070",
37-
)
38-
39-
# Set up dependency to tensorflow pip package.
40-
tf_configure()
41-

build_rasterizer.sh

-51
This file was deleted.

pytest.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[pytest]
2-
norecursedirs = tensorflow_graphics/rendering/opengl/tests tensorflow_graphics/submodules
2+
norecursedirs = tensorflow_graphics/submodules
33
python_files = *_test.py

requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
tensorflow == 2.2.0
2-
tensorflow-addons == 0.10.0
3-
tensorflow-datasets == 2.0.0
1+
tensorflow >= 2.2.0
2+
tensorflow-addons >= 0.10.0
3+
tensorflow-datasets >= 2.0.0
44
absl-py >= 0.6.1
55
h5py >= 2.10.0
66
matplotlib >= 2.2.5

tensorflow_graphics/datasets/features/trimesh_feature.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ def encode_example(self, path_or_trianglemesh):
6666
features_dict = self._convert_to_trimesh_feature(
6767
triangle_mesh.load(tmesh_file))
6868
elif hasattr(path_or_trianglemesh, 'read') and hasattr(
69-
path_or_trianglemesh, 'name'):
69+
path_or_trianglemesh, 'name') and hasattr(path_or_trianglemesh, 'seek'):
7070
# The parameter is a file object.
71+
path_or_trianglemesh.seek(0) # reset
7172
features_dict = self._convert_to_trimesh_feature(
7273
triangle_mesh.load(path_or_trianglemesh))
7374
elif isinstance(path_or_trianglemesh, dict):
+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
tensorflow_graphics/rendering/opengl/BUILD
2-
tensorflow_graphics/util/BUILD
3-
third_party/BUILD
4-
third_party/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1/BUILD
5-
third_party/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.1/cc_toolchain_config.bzl
1+
tensorflow_graphics/rendering/opengl/BUILD

0 commit comments

Comments
 (0)