Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ jobs:
- uses: actions/checkout@v1
- name: Checking the sanity check
run: bash tools/run_sanity_check.sh
- name: Checking the pre-commit
run: bash tools/pre-commit.sh
docs_tests:
name: Check that we can build the docs
runs-on: ubuntu-latest
Expand Down
25 changes: 21 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,35 @@ us**
## Development Tips
Try these useful commands below:

* Format code automatically: `bash tools/run_docker.sh -c 'make code-format'`
* Format code automatically: `bash tools/pre-commit.sh`
* Run sanity check: `bash tools/run_sanity_check.sh`
* Run CPU unit tests: `bash tools/run_docker.sh -c 'make unit-test'`
* Run GPU unit tests: `bash tools/run_docker.sh -d gpu -c 'make gpu-unit-test'`
* All of the above: `bash tools/run_docker.sh -d gpu -c 'make'`

## Coding style

Addons provides `make code-format` command to format your changes
automatically, don't forget to use it before pushing your code.
We provide a pre-commit hook to format your code automatically before each
commit, so that you don't have to read our style guide. Install it with

Please see our [Style Guide](STYLE_GUIDE.md) for more details.
```
cd .git/hooks && ln -s -f ../../tools/pre-commit.sh pre-commit
```

and you're good to go.

Note that this pre-commit needs Docker to run.
If you have docker 19.03+, it uses
[Docker buildkit](https://docs.docker.com/develop/develop-images/build_enhancements/)
to make the build step much faster.


It should also work on
Windows (with [Docker desktop for Windows](https://docs.docker.com/docker-for-windows/install/),
select "Run linux containers").
But this has not been tested. If you work on Windows, we'd be happy to have your feedback!

See our [Style Guide](STYLE_GUIDE.md) for more details.

## Code Testing
### CI Testing
Expand Down
7 changes: 0 additions & 7 deletions STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ format all with:
clang-format-9 -i --style=google **/*.cc **/*.h
```

We'll soon provide a simple and easy to use docker image to run this.

#### Python

Addons uses [flake8](http://flake8.pycqa.org/en/latest/) to check pep8 compliance and
Expand All @@ -49,11 +47,6 @@ python -m black ./
python -m flake8
```

If you want those tools to run automatically before each commit, run:
```bash
cd .git/hooks && ln -s -f ../../tools/pre-commit.sh pre-commit
```

#### TensorFlow Conventions

Follow the guidance in the [TensorFlow Style Guide - Conventions](https://www.tensorflow.org/community/contribute/code_style#tensorflow_conventions_and_special_uses).
Expand Down
8 changes: 1 addition & 7 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@
# ==============================================================================
.PHONY: all

all: code-format sanity-check unit-test

install-ci-dependency:
bash tools/ci_build/install/install_ci_dependency.sh

code-format:
bash tools/pre-commit.sh
all: unit-test

unit-test:
bash tools/ci_testing/addons_cpu.sh
Expand Down
21 changes: 0 additions & 21 deletions tools/ci_build/install/install_ci_dependency.sh

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion tools/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
set -e

export DOCKER_BUILDKIT=1
docker build -t tf_addons_formatting -f tools/docker/Dockerfile_formatting .
docker build -t tf_addons_formatting -f tools/docker/formatting.Dockerfile .
docker run --rm -t -v "$(pwd -P):/addons" tf_addons_formatting