-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile-ci
104 lines (95 loc) · 3.34 KB
/
Dockerfile-ci
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
FROM python:3.10 AS base
RUN apt update && \
apt install -y --no-install-recommends \
ffmpeg \
python3-opengl \
xvfb && \
apt clean && rm -rf /var/lib/apt/lists/*
RUN --mount=type=cache,target=/root/.cache/pip pip install \
coverage \
ipython \
matplotlib \
pyglet \
moviepy \
pyvirtualdisplay \
unittest-xml-reporting
FROM base AS test0.25.2
RUN --mount=type=cache,target=/root/.cache/pip pip install \
brax gym["classic_control"]==0.25.2
WORKDIR /test-ci
COPY setup.py setup.py
COPY gnwrapper gnwrapper
RUN --mount=type=cache,target=/root/.cache/pip pip install .[test]
COPY test test
COPY .coveragerc .coveragerc
RUN coverage run -m xmlrunner discover -s test || true
RUN mkdir -p /coverage && cp .coverage.* /coverage && \
mkdir -p /unittest && cp *.xml /unittest
FROM base AS test0.26.0
RUN --mount=type=cache,target=/root/.cache/pip pip install \
brax gym["classic_control"]==0.26.0
WORKDIR /test-ci
COPY setup.py setup.py
COPY gnwrapper gnwrapper
RUN --mount=type=cache,target=/root/.cache/pip pip install .[test]
COPY test test
COPY .coveragerc .coveragerc
RUN coverage run -m xmlrunner discover -s test || true
RUN mkdir -p /coverage && cp .coverage.* /coverage && \
mkdir -p /unittest && cp *.xml /unittest
FROM base AS test0.26.1
RUN --mount=type=cache,target=/root/.cache/pip pip install \
brax gym["classic_control"]==0.26.1
WORKDIR /test-ci
COPY setup.py setup.py
COPY gnwrapper gnwrapper
RUN --mount=type=cache,target=/root/.cache/pip pip install .[test]
COPY test test
COPY .coveragerc .coveragerc
RUN coverage run -m xmlrunner discover -s test || true
RUN mkdir -p /coverage && cp .coverage.* /coverage && \
mkdir -p /unittest && cp *.xml /unittest
FROM base AS test0.26.2
RUN --mount=type=cache,target=/root/.cache/pip pip install \
brax gym["classic_control"]==0.26.2
WORKDIR /test-ci
COPY setup.py setup.py
COPY gnwrapper gnwrapper
RUN --mount=type=cache,target=/root/.cache/pip pip install .[test]
COPY test test
COPY .coveragerc .coveragerc
RUN coverage run -m xmlrunner discover -s test || true
RUN mkdir -p /coverage && cp .coverage.* /coverage && \
mkdir -p /unittest && cp *.xml /unittest
FROM python:latest AS combine
WORKDIR /coverage
RUN --mount=type=cache,target=/root/.cache/pip pip install coverage
COPY gnwrapper gnwrapper
COPY .coveragerc .coveragerc
COPY --from=test0.25.2 /coverage /coverage
COPY --from=test0.26.0 /coverage /coverage
COPY --from=test0.26.1 /coverage /coverage
COPY --from=test0.26.2 /coverage /coverage
RUN coverage combine && \
echo "## Test Coverage\n\`\`\`\n" >> summary.md && \
coverage report | tee -a summary.md && \
echo "\n\`\`\`" >> summary.md && \
mkdir -p /coverage/html && coverage html -d /coverage/html
FROM python:latest AS build
WORKDIR /build
RUN --mount=type=cache,target=/root/.cache/pip pip install wheel
COPY LICENSE LICENSE
COPY setup.py setup.py
COPY README.md README.md
COPY gnwrapper gnwrapper
RUN pip wheel --no-deps -w /dist .
RUN python setup.py sdist -d /dist
FROM scratch AS results
COPY --from=test0.25.2 /unittest /unittest/0.25.2
COPY --from=test0.26.0 /unittest /unittest/0.26.0
COPY --from=test0.26.1 /unittest /unittest/0.26.1
COPY --from=test0.26.2 /unittest /unittest/0.26.2
COPY --from=combine /coverage/html /coverage/html
COPY --from=combine /coverage/summary.md /coverage/summary.md
COPY --from=build /dist /dist
CMD [""]