chore: prepare release workflow

- disable macOS builds for release for now as we don't know how long they
are

closes #246
closes #809
This commit is contained in:
Arthur Meyre
2022-01-07 15:40:44 +01:00
parent 03adc76bde
commit eda9ab73cd
7 changed files with 86 additions and 68 deletions

View File

@@ -1,28 +1,13 @@
FROM ghcr.io/zama-ai/zamalang-compiler:a9fae4c19b96ee61c7ea0a2ce26b1cd8d049e159 as builder
RUN apt-get update && apt-get upgrade --no-install-recommends -y && \
apt-get install --no-install-recommends -y \
python3.8 \
python-is-python3 && \
rm -rf /var/lib/apt/lists/* && \
python3 -m pip install --no-cache-dir --upgrade pip wheel setuptools && \
python3 -m pip install --no-cache-dir poetry
WORKDIR /build
COPY concrete ./concrete
COPY pyproject.toml ./pyproject.toml
RUN poetry build --format wheel
FROM ghcr.io/zama-ai/zamalang-compiler:a9fae4c19b96ee61c7ea0a2ce26b1cd8d049e159
FROM ubuntu:20.04
RUN mkdir /pkg && mkdir /app
WORKDIR /pkg
COPY --from=builder /build/dist/*.whl .
COPY docker/release_resources/release_requirements.txt .
COPY ./pkg/*.whl .
RUN apt-get update && apt-get upgrade --no-install-recommends -y && \
apt-get install --no-install-recommends -y \
python3-pip \
python3.8 \
python3.8-tk \
python-is-python3 \
@@ -33,8 +18,6 @@ RUN apt-get update && apt-get upgrade --no-install-recommends -y && \
python3 -m pip install --no-cache-dir ./*.whl && \
python3 -m pip install --no-cache-dir -r release_requirements.txt
ENV LD_PRELOAD=${RT_LIB}:${LD_PRELOAD}
WORKDIR /app
COPY docker/release_resources/entry_point.sh ./entry_point.sh
RUN mkdir /data

View File

@@ -1,12 +1,6 @@
# Ignore all
**
# Not our sources
!concrete
!pyproject.toml
!docker/release_resources/entry_point.sh
!docker/release_resources/release_requirements.txt
# But still ignore pycache
**/__pycache__
**/*.pyc
!pkg/
!pkg/**

View File

@@ -8,14 +8,16 @@ def main():
return x + 42
n_bits = 3
x = hnp.EncryptedScalar(hnp.UnsignedInteger(n_bits))
engine = hnp.compile_numpy_function(
compiler = hnp.NPFHECompiler(
function_to_compile,
{"x": x},
[(i,) for i in range(2 ** n_bits)],
{"x": "encrypted"},
)
print("Compiling...")
engine = compiler.compile_on_inputset(range(2 ** n_bits))
inputs = []
labels = []
for _ in range(4):
@@ -25,12 +27,15 @@ def main():
labels.append(function_to_compile(*inputs[-1]))
correct = 0
for input_i, label_i in zip(inputs, labels):
for idx, (input_i, label_i) in enumerate(zip(inputs, labels), 1):
print(f"Inference #{idx}")
result_i = engine.run(*input_i)
if result_i == label_i:
correct += 1
print(f"{correct}/{len(inputs)}")
if __name__ == "__main__":
main()