diff --git a/.github/ISSUE_TEMPLATE/release.md b/.github/ISSUE_TEMPLATE/release.md new file mode 100644 index 000000000..a9e92e819 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/release.md @@ -0,0 +1,19 @@ +--- +name: Release +about: Issue template to prepare a release step by step. +title: "Release vX.Y.Z" +--- + +Release check-list: + +- [ ] Check the release milestone issues, cut out what can't be completed in time +- [ ] Choose the version number following semantic versioning: https://semver.org/ +- [ ] Checkout the commit for release, create a signed tag with the version name `git tag -s -a -m "vX.Y.Z release" vX.Y.Z`, push it to GitHub with `git push origin refs/tags/vX.Y.Z` +- [ ] Run sanity checks inside the dev docker: `make pcc` and `make pytest && make coverage` +- [ ] On the build machine with docker installed, run in your OS terminal in the project dir: `make release_docker` +- [ ] Re-tag the image with `docker tag concretefhe-release:latest ghcr.io/zama-ai/concretefhe-release:vX.Y.Z` +- [ ] `docker login ghcr.io`, input your username and GitHub Personal Access Token (PAT). If not already done add `write:packages` to your PAT +- [ ] Push the release image `docker push ghcr.io/zama-ai/concretefhe-release:vX.Y.Z` +- [ ] See [here](https://docs.github.com/en/github/administering-a-repository/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release) to create the release in GitHub using the existing tag, add the pull link \(`ghcr.io/zama-ai/concretefhe-release:vX.Y.Z`\) for the uploaded docker image + +All done! diff --git a/Makefile b/Makefile index f9889d491..297628334 100644 --- a/Makefile +++ b/Makefile @@ -176,3 +176,7 @@ benchmark: jupyter: poetry run jupyter notebook --allow-root --no-browser --ip=0.0.0.0 .PHONY: jupyter + +release_docker: + ./docker/build_release_image.sh +.PHONY: release_docker diff --git a/docker/Dockerfile.release b/docker/Dockerfile.release new file mode 100644 index 000000000..fc072d8e7 --- /dev/null +++ b/docker/Dockerfile.release @@ -0,0 +1,48 @@ +FROM ghcr.io/zama-ai/zamalang-compiler 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 + +RUN mkdir /pkg && mkdir /app +WORKDIR /pkg +COPY --from=builder /build/dist/*.whl . +COPY docker/datascience_requirements.txt . +COPY torch_requirements.txt . + +RUN apt-get update && apt-get upgrade --no-install-recommends -y && \ + apt-get install --no-install-recommends -y \ + python3.8 \ + python3.8-tk \ + python-is-python3 \ + graphviz* && \ + rm -rf /var/lib/apt/lists/* && \ + python3 -m pip install --no-cache-dir --upgrade pip wheel setuptools && \ + echo "export LD_PRELOAD=/compiler/build/lib/Runtime/libZamalangRuntime.so" >> /root/.bashrc && \ + echo "export MPLBACKEND=TkAgg" >> /root/.bashrc && \ + python3 -m pip install --no-cache-dir ./*.whl && \ + python3 -m pip install --no-cache-dir -r torch_requirements.txt \ + -f https://download.pytorch.org/whl/torch_stable.html && \ + python3 -m pip install --no-cache-dir -r datascience_requirements.txt + +WORKDIR /app +RUN printf "#!/bin/bash\npython3 -m jupyter notebook --ip=0.0.0.0 --allow-root --no-browser\n" \ + > entry_point.sh && \ + mkdir /data + +WORKDIR /data +VOLUME [ "/data" ] + +CMD ["/bin/bash", "-l", "/app/entry_point.sh"] diff --git a/docker/Dockerfile.release.dockerignore b/docker/Dockerfile.release.dockerignore new file mode 100644 index 000000000..06fbab269 --- /dev/null +++ b/docker/Dockerfile.release.dockerignore @@ -0,0 +1,12 @@ +# Ignore all +** + +# Not our sources +!concrete +!pyproject.toml +!docker/datascience_requirements.txt +!torch_requirements.txt + +# But still ignore pycache +**/__pycache__ +**/*.pyc diff --git a/docker/build_release_image.sh b/docker/build_release_image.sh new file mode 100644 index 000000000..1b0a23683 --- /dev/null +++ b/docker/build_release_image.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +CURR_DIR=$(dirname $0) +DOCKER_BUILDKIT=1 docker build --pull --no-cache -f "$CURR_DIR/Dockerfile.release" \ +-t concretefhe-release "$CURR_DIR/.." diff --git a/docker/release_requirements.txt b/docker/release_requirements.txt new file mode 100644 index 000000000..6f96a3f49 --- /dev/null +++ b/docker/release_requirements.txt @@ -0,0 +1,4 @@ +jupyter~=1.0.0 +opencv-python-headless~=4.5.3.56 +pandas~=1.3.2 +scikit-learn~=0.24.2 diff --git a/docs/dev/RELEASING.md b/docs/dev/RELEASING.md new file mode 100644 index 000000000..a1b631aef --- /dev/null +++ b/docs/dev/RELEASING.md @@ -0,0 +1,3 @@ +# Creating A Release On GitHub + +Please open an issue with the release template: https://github.com/zama-ai/concretefhe-internal/issues/new?assignees=&labels=&template=release.md. The check-list will guide you through what's required. diff --git a/docs/index.rst b/docs/index.rst index 7e5a8f13f..9417ec3b6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -24,6 +24,7 @@ Homomorphic Development Kit's documentation dev/FLOAT-FUSING.md dev/DOCUMENTING.md dev/CONTRIBUTING.md + dev/RELEASING.md .. toctree:: :maxdepth: 5