forked from tensorflow/addons
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sanity_check.Dockerfile
118 lines (92 loc) · 2.94 KB
/
sanity_check.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
FROM python:3.5-alpine as flake8-test
RUN pip install flake8==3.7.9
COPY ./ /addons
WORKDIR /addons
RUN flake8
RUN touch /ok.txt
# -------------------------------
FROM python:3.6 as black-test
RUN pip install black==19.10b0
COPY ./ /addons
RUN black --check /addons
RUN touch /ok.txt
# -------------------------------
FROM python:3.6 as public-api-typed
COPY build_deps/build-requirements-cpu.txt ./
RUN pip install -r build-requirements-cpu.txt
RUN pip install typeguard==2.7.1
RUN pip install typedapi==0.2.0
COPY ./ /addons
RUN TF_ADDONS_NO_BUILD=1 pip install --no-deps -e /addons
RUN python /addons/tools/ci_build/verify/check_typing_info.py
RUN touch /ok.txt
# -------------------------------
FROM python:3.5-alpine as case-insensitive-filesystem
COPY ./ /addons
WORKDIR /addons
RUN python /addons/tools/ci_build/verify/check_file_name.py
RUN touch /ok.txt
# -------------------------------
FROM python:3.5 as valid_build_files
COPY build_deps/build-requirements-cpu.txt ./
RUN pip install -r build-requirements-cpu.txt
RUN apt-get update && apt-get install sudo
COPY tools/ci_build/install/bazel.sh ./
RUN bash bazel.sh
COPY tools/docker/finish_bazel_install.sh ./
RUN bash finish_bazel_install.sh
COPY ./ /addons
WORKDIR /addons
RUN python ./configure.py --no-deps
RUN bazel build --nobuild -- //tensorflow_addons/...
RUN touch /ok.txt
# -------------------------------
FROM python:3.6-alpine as clang-format
RUN apk add --no-cache git
RUN git clone https://github.com/gabrieldemarmiesse/clang-format-lint-action.git
WORKDIR ./clang-format-lint-action
RUN git checkout 1044fee
COPY ./ /addons
RUN python run-clang-format.py \
-r \
--cli-args=--style=google \
--clang-format-executable ./clang-format/clang-format9 \
/addons
RUN touch /ok.txt
# -------------------------------
# Bazel code format
FROM alpine:3.11 as check-bazel-format
COPY ./tools/ci_build/install/buildifier.sh ./
RUN sh buildifier.sh
COPY ./ /addons
RUN buildifier -mode=check -r /addons
RUN touch /ok.txt
# -------------------------------
# docs tests
FROM python:3.6 as docs_tests
COPY build_deps/build-requirements-cpu.txt ./
RUN pip install -r build-requirements-cpu.txt
RUN pip install typeguard==2.7.1
COPY tools/docs/doc_requirements.txt ./
RUN pip install -r doc_requirements.txt
RUN apt-get update && apt-get install -y rsync
COPY ./ /addons
WORKDIR /addons
RUN TF_ADDONS_NO_BUILD=1 pip install --no-deps -e .
RUN python tools/docs/build_docs.py
RUN touch /ok.txt
# -------------------------------
# ensure that all checks were successful
# this is necessary if using docker buildkit
# with "export DOCKER_BUILDKIT=1"
# otherwise dead branch elimination doesn't
# run all tests
FROM scratch
COPY --from=0 /ok.txt /ok0.txt
COPY --from=1 /ok.txt /ok1.txt
COPY --from=2 /ok.txt /ok2.txt
COPY --from=3 /ok.txt /ok3.txt
COPY --from=4 /ok.txt /ok4.txt
COPY --from=5 /ok.txt /ok5.txt
COPY --from=6 /ok.txt /ok6.txt
COPY --from=7 /ok.txt /ok7.txt