-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2.0 backport] Port the release script from master
This would allow us to use the release script as-is from the tag instead of from master. This would help reproducibility
- Loading branch information
1 parent
f75d371
commit 49ef89c
Showing
5 changed files
with
244 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
FROM multiarch/debian-debootstrap:%TARGET_TAG% | ||
FROM multiarch/alpine:%TARGET_TAG% | ||
# May need configuration on the host: | ||
# docker run --rm --privileged multiarch/qemu-user-static:register --reset | ||
LABEL Description="opam release builds" Vendor="OCamlPro" Version="1.0" | ||
|
||
RUN apt-get update && apt-get install bzip2 g++ make patch wget libltdl-dev --yes && apt-get clean --yes | ||
RUN useradd -U --create-home opam | ||
RUN apk add gcc g++ make coreutils openssl | ||
|
||
ADD https://caml.inria.fr/pub/distrib/ocaml-4.04/ocaml-4.04.2.tar.gz /root/ | ||
RUN addgroup -S opam && adduser -S opam -G opam -s /bin/sh | ||
|
||
ADD https://github.com/ocaml/ocaml/archive/refs/tags/%OCAMLV%.tar.gz /root/ | ||
|
||
WORKDIR /root | ||
RUN tar xzf ocaml-4.04.2.tar.gz | ||
WORKDIR ocaml-4.04.2 | ||
RUN tar xzf %OCAMLV%.tar.gz | ||
WORKDIR ocaml-%OCAMLV% | ||
RUN sed -i 's/gnueabi/*eabi/' configure | ||
RUN sed -i 's/musl/musl*/' configure | ||
RUN sed -i -e 's/NGROUPS_MAX/65536/' otherlibs/unix/getgroups.c | ||
RUN ./configure %CONF% -prefix /usr/local | ||
RUN make world opt.opt | ||
RUN make install | ||
RUN rm -rf /root/ocaml-4.04.2 /root/ocaml-4.04.2.tar.gz | ||
RUN make "-j$(nproc)" && make install && rm -rf /root/ocaml-%OCAMLV% /root/ocaml-%OCAMLV%.tar.gz | ||
|
||
RUN apk add patch | ||
|
||
ENV PATH /usr/local/bin:/usr/bin:/bin | ||
USER opam | ||
VOLUME /src | ||
WORKDIR /home/opam/ | ||
CMD tar xzf /src/opam-full-${VERSION}.tar.gz && \ | ||
cd opam-full-${VERSION} && \ | ||
echo "(${LINKING})" > src/client/linking.sexp && \ | ||
CMD tar xz >&2 && \ | ||
cd opam-full-${VERSION} >&2 && \ | ||
./configure --with-mccs && \ | ||
make lib-ext opam && \ | ||
strip opam && \ | ||
cp opam /src/opam-${VERSION}-${TARGET} | ||
make lib-ext && \ | ||
echo "(${LINKING})" > src/client/linking.sexp && \ | ||
make opam >&2 && \ | ||
strip opam >&2 && \ | ||
cat opam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Steps to follow for each release | ||
|
||
## Finalise opam code for release | ||
* update version in all the opam files and in configure.ac | ||
* run `make configure` to regenerate `./configure` [checked by github actions] | ||
* update copyright headers | ||
* if you're releasing the first final release of a new branch (e.g. 2.2.0): make sure `root_version` in OpamFile.ml is set to the final release number (e.g. for 2.2.0, root_version should be 2.2). Make sure that opamFormatUpgrade.ml also contains an upgrade function from the previous version (that function will most likely be empty) | ||
* run `make tests`, `opam-rt` [checked by github actions] | ||
* update the CHANGE file: take `master_changes.md` content to fill it | ||
|
||
## Github release | ||
|
||
[ once bump version & changes PRs merged ] | ||
* tag the release (git tag -am 2.2.0 2.2.0; git push origin 2.2.0) | ||
* /!\ Once the tag pushed, it can be updated [different commit] only in case of severe issue | ||
* create a release (or prerelease if intermediate release) draft on github based on your tag (https://github.com/ocaml/opam/releases/new) | ||
* fetch locally the tag | ||
* launch docker using the Docker GUI macOS app | ||
* generate opam artifacts, using `release/release.sh <tag>` from a macOS/arm64 machine, it requires to have Docker and QEMU installed (see below device requirements) | ||
* generate the signatures using `release/sign.sh <tag>` | ||
* add releases notes (content of `master_changes.md`) in the release draft | ||
* upload everything from `release/out/<tag>` | ||
* finalise the release (publish) | ||
|
||
## Publish the release | ||
|
||
* add hashes in `install.sh` (and check signatures) | ||
* publish opam packages in opam-repository (and add `flags: avoid-version` and `available: opam-version >= "2.1.0"` to each packages if this is not a stable version) | ||
* update versions (and messages, if necessary) in https://github.com/ocaml/opam-repository/blob/master/repo | ||
|
||
## Announce! | ||
|
||
* a blog entry in opam.ocaml.org | ||
* a announcement in discuss.ocaml.org | ||
* copy the blog entry from opam.ocaml.org for https://github.com/ocaml/ocaml.org/tree/main/data/changelog/opam | ||
* announce the release on the OCaml Discord server | ||
|
||
|
||
## After release | ||
|
||
* Bump the version with a `~dev` at the end (e.g. `2.2.0~alpha~dev`) | ||
* Check if reftests needs an update | ||
* Bring the changes to the changelog (CHANGES) from the branch of the release to the `master` branch | ||
|
||
### On a release candidate | ||
* create a branch to a `x.y` for rc's and the final release | ||
|
||
--- | ||
|
||
## Device requirements | ||
* Mac M1 or above with Rosetta2 | ||
* brew dependencies: git, gpg, qemu>=8.1.0, docker>=24.0.0, md5sha1sum | ||
* opam repo with the tag fetched | ||
* Have the secret key available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,63 @@ | ||
#!/usr/bin/env bash | ||
set -uex | ||
|
||
# This script is expected to run on Linux with docker available, and to have | ||
# three remotes "some-osx-x86", "some-osx-arm" and "some-openbsd", with the | ||
# corresponding OSes, ocaml deps installed | ||
unset $(env | cut -d= -f1 | grep -Fvx HOME | grep -Fvx PWD | grep -Fvx USER | grep -Fvx SHELL | grep -Fvx TERM) | ||
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin:/usr/local/bin | ||
|
||
LC_ALL=C | ||
DIR=$(dirname $0) | ||
cd "$DIR" | ||
if [[ $# -eq 0 || "x$1" =~ "x-" ]]; then | ||
echo "Usage: $0 TAG [archive|builds]" | ||
usage() { | ||
echo "Usage: $0 TAG" | ||
exit 1 | ||
} | ||
|
||
if [[ $# -lt 1 || $# -gt 1 || "x$1" =~ "x-" ]]; then | ||
usage | ||
fi | ||
|
||
TAG="$1"; shift | ||
TAG="$1" | ||
shift | ||
|
||
if [[ $# -eq 0 || " $* " =~ " archive " ]]; then | ||
make TAG="$TAG" GIT_URL="https://github.com/ocaml/opam.git" "out/opam-full-$TAG.tar.gz" | ||
( cd out && git-upload-release ocaml opam "$TAG" "opam-full-$TAG.tar.gz"; ) | ||
if test "$(uname -s)" != Darwin -o "$(uname -m)" != arm64; then | ||
echo "This script is required to be run on macOS/arm64" | ||
exit 1 | ||
fi | ||
|
||
if [[ $# -eq 0 || " $* " =~ " builds " ]]; then | ||
make TAG="$TAG" all & | ||
make TAG="$TAG" remote REMOTE=some-osx-x86 REMOTE_DIR=opam-release & | ||
make TAG="$TAG" remote REMOTE=some-osx-arm REMOTE_DIR=opam-release & | ||
make TAG="$TAG" remote REMOTE=some-openbsd REMOTE_MAKE=gmake REMOTE_DIR=opam-release & | ||
wait | ||
cd out && for f in opam-$TAG-*; do | ||
git-upload-release ocaml opam "$TAG" $f | ||
done | ||
fi | ||
DIR=$(dirname $0) | ||
cd "$DIR" | ||
|
||
LC_ALL=C | ||
CWD=$(pwd) | ||
JOBS=$(sysctl -n hw.ncpu) | ||
SSH="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" | ||
|
||
OUTDIR="out/$TAG" | ||
mkdir -p "$OUTDIR" | ||
|
||
qemu_build() { | ||
local port=$1 | ||
local image=$2 | ||
local install=$3 | ||
local make=$4 | ||
local arch=$5 | ||
|
||
if ! ${SSH} -p "${port}" root@localhost true; then | ||
qemu-img convert -O raw "./qemu-base-images/${image}.qcow2" "./qemu-base-images/${image}.raw" | ||
"qemu-system-${arch}" -drive "file=./qemu-base-images/${image}.raw,format=raw" -nic "user,hostfwd=tcp::${port}-:22" -m 2G -smp "${JOBS}" & | ||
sleep 60 | ||
fi | ||
${SSH} -p "${port}" root@localhost "${install}" | ||
make TAG="$TAG" JOBS="${JOBS}" qemu QEMU_PORT="${port}" REMOTE_MAKE="${make}" REMOTE_DIR="opam-release-$TAG" | ||
${SSH} -p "${port}" root@localhost "shutdown -p now" | ||
} | ||
|
||
make JOBS="${JOBS}" TAG="$TAG" "${OUTDIR}/opam-full-$TAG.tar.gz" | ||
make JOBS="${JOBS}" TAG="$TAG" x86_64-linux | ||
make JOBS="${JOBS}" TAG="$TAG" i686-linux | ||
make JOBS="${JOBS}" TAG="$TAG" armhf-linux | ||
make JOBS="${JOBS}" TAG="$TAG" arm64-linux | ||
make JOBS="${JOBS}" TAG="$TAG" ppc64le-linux | ||
make JOBS="${JOBS}" TAG="$TAG" s390x-linux | ||
[ -f "${OUTDIR}/opam-$TAG-x86_64-macos" ] || make TAG="$TAG" JOBS="${JOBS}" macos-local MACOS_ARCH=x86_64 REMOTE_DIR=opam-release-$TAG GIT_URL="$CWD/.." | ||
[ -f "${OUTDIR}/opam-$TAG-arm64-macos" ] || make TAG="$TAG" JOBS="${JOBS}" macos-local MACOS_ARCH=arm64 REMOTE_DIR=opam-release-$TAG GIT_URL="$CWD/.." | ||
[ -d ./qemu-base-images ] || git clone https://gitlab.com/kit-ty-kate/qemu-base-images.git | ||
[ -f "${OUTDIR}/opam-$TAG-x86_64-openbsd" ] || qemu_build 9999 OpenBSD-7.4-amd64 "pkg_add gmake curl bzip2" gmake x86_64 | ||
[ -f "${OUTDIR}/opam-$TAG-x86_64-freebsd" ] || qemu_build 9998 FreeBSD-13.2-RELEASE-amd64 "pkg install -y gmake curl bzip2" gmake x86_64 |
Oops, something went wrong.