-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile-ci
More file actions
132 lines (117 loc) · 3.65 KB
/
Dockerfile-ci
File metadata and controls
132 lines (117 loc) · 3.65 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
FROM python:3.8 AS test3.8
WORKDIR /diffqc-ci
RUN --mount=type=cache,target=/root/.cache/pip pip install \
coverage \
jax \
jaxlib \
pennylane \
unittest-xml-reporting
COPY setup.py .
COPY diffqc diffqc
RUN --mount=type=cache,target=/root/.cache/pip pip install .[test]
COPY test test
COPY .coveragerc .coveragerc
RUN coverage run -m xmlrunner discover test || true
RUN mkdir -p /coverage && cp -v .coverage.* /coverage && \
mkdir -p /unittest && cp *.xml /unittest
FROM python:3.9 AS test3.9
WORKDIR /diffqc-ci
RUN --mount=type=cache,target=/root/.cache/pip pip install \
coverage \
jax \
jaxlib \
pennylane \
unittest-xml-reporting
COPY setup.py .
COPY diffqc diffqc
RUN --mount=type=cache,target=/root/.cache/pip pip install .[test]
COPY test test
COPY .coveragerc .coveragerc
RUN coverage run -m xmlrunner discover test || true
RUN mkdir -p /coverage && cp -v .coverage.* /coverage && \
mkdir -p /unittest && cp *.xml /unittest
FROM python:3.10 AS test3.10
WORKDIR /diffqc-ci
RUN --mount=type=cache,target=/root/.cache/pip pip install \
coverage \
jax \
jaxlib \
pennylane \
unittest-xml-reporting
COPY setup.py .
COPY diffqc diffqc
RUN --mount=type=cache,target=/root/.cache/pip pip install .[test]
COPY test test
COPY .coveragerc .coveragerc
RUN coverage run -m xmlrunner discover test || true
RUN mkdir -p /coverage && cp -v .coverage.* /coverage && \
mkdir -p /unittest && cp *.xml /unittest
FROM python:3.11 AS test3.11
WORKDIR /diffqc-ci
RUN --mount=type=cache,target=/root/.cache/pip pip install \
coverage \
jax \
jaxlib \
pennylane \
unittest-xml-reporting
COPY setup.py .
COPY diffqc diffqc
RUN --mount=type=cache,target=/root/.cache/pip pip install .[test]
COPY test test
COPY .coveragerc .coveragerc
RUN coverage run -m xmlrunner discover test || true
RUN mkdir -p /coverage && cp -v .coverage.* /coverage && \
mkdir -p /unittest && cp -v *.xml /unittest
FROM python:latest AS combine
WORKDIR /coverage
RUN --mount=type=cache,target=/root/.cache/pip pip install coverage
COPY diffqc diffqc
COPY .coveragerc .coveragerc
COPY --from=test3.8 /coverage /coverage
COPY --from=test3.9 /coverage /coverage
COPY --from=test3.10 /coverage /coverage
COPY --from=test3.11 /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:3.8 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 diffqc diffqc
RUN pip wheel --no-deps -w /dist .
RUN python setup.py sdist -d /dist
FROM python:3.10 AS doc
WORKDIR /ci
RUN apt update && apt -y --no-install-recommends install graphviz && \
apt clean && rm -rf /var/lib/apt/lists/*
RUN --mount=type=cache,target=/root/.cache/pip pip install \
sphinx \
furo \
sphinx-automodapi \
myst-parser \
jax \
jaxlib \
pennylane
COPY LICENSE LICENSE
COPY setup.py setup.py
COPY README.md README.md
COPY diffqc diffqc
RUN --mount=type=cache,target=/root/.cache/pip pip install .[doc,pennylane]
COPY doc doc
COPY example example
RUN sphinx-build -W -b html doc /html
FROM scratch AS results
COPY --from=test3.8 /unittest /unittest/3.8
COPY --from=test3.9 /unittest /unittest/3.9
COPY --from=test3.10 /unittest /unittest/3.10
COPY --from=test3.11 /unittest /unittest/3.11
COPY --from=combine /coverage/html /coverage/html
COPY --from=combine /coverage/summary.md /coverage/summary.md
COPY --from=build /dist /dist
COPY --from=doc /html /html
CMD [""]