This reverts commit 58068783c7.
This commit is contained in:
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@@ -41,9 +41,6 @@ jobs:
|
|||||||
needs: [linux]
|
needs: [linux]
|
||||||
if: github.event_name == 'push' || inputs.Docker
|
if: github.event_name == 'push' || inputs.Docker
|
||||||
steps:
|
steps:
|
||||||
- name: Install Cosign
|
|
||||||
uses: sigstore/cosign-installer@v3
|
|
||||||
|
|
||||||
- name: Log In to GitHub Container Registry
|
- name: Log In to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
@@ -85,8 +82,6 @@ jobs:
|
|||||||
echo "GHCR_DIGEST_SHA=$(cat GHCR_DIGEST_SHA)" | tee -a "${GITHUB_ENV}"
|
echo "GHCR_DIGEST_SHA=$(cat GHCR_DIGEST_SHA)" | tee -a "${GITHUB_ENV}"
|
||||||
docker buildx imagetools inspect --format '{{json .Manifest}}' index.docker.io/${{github.repository}}:$(jq -r '.target."docker-metadata-action".args.DOCKER_META_VERSION' ${{ runner.temp }}/${{matrix.variant}}/bake-meta.json) | jq -r '.digest' > DOCKERHUB_DIGEST_SHA
|
docker buildx imagetools inspect --format '{{json .Manifest}}' index.docker.io/${{github.repository}}:$(jq -r '.target."docker-metadata-action".args.DOCKER_META_VERSION' ${{ runner.temp }}/${{matrix.variant}}/bake-meta.json) | jq -r '.digest' > DOCKERHUB_DIGEST_SHA
|
||||||
echo "DOCKERHUB_DIGEST_SHA=$(cat DOCKERHUB_DIGEST_SHA)" | tee -a "${GITHUB_ENV}"
|
echo "DOCKERHUB_DIGEST_SHA=$(cat DOCKERHUB_DIGEST_SHA)" | tee -a "${GITHUB_ENV}"
|
||||||
cosign sign --yes $(jq --arg GHCR_DIGEST_SHA "$(cat GHCR_DIGEST_SHA)" -cr '.target."docker-metadata-action".tags | map(select(startswith("ghcr.io/${{github.repository}}")) | . + "@" + $GHCR_DIGEST_SHA) | join(" ")' ${{ runner.temp }}/${{matrix.variant}}/bake-meta.json)
|
|
||||||
cosign sign --yes $(jq --arg DOCKERHUB_DIGEST_SHA "$(cat DOCKERHUB_DIGEST_SHA)" -cr '.target."docker-metadata-action".tags | map(select(startswith("index.docker.io/${{github.repository}}")) | . + "@" + $DOCKERHUB_DIGEST_SHA) | join(" ")' ${{ runner.temp }}/${{matrix.variant}}/bake-meta.json)
|
|
||||||
|
|
||||||
- name: Attest GHCR
|
- name: Attest GHCR
|
||||||
uses: actions/attest-build-provenance@v2
|
uses: actions/attest-build-provenance@v2
|
||||||
@@ -339,7 +334,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
rustup target add ${{matrix.target}}
|
rustup target add ${{matrix.target}}
|
||||||
# Get latest FoundationDB installer
|
# Get latest FoundationDB installer
|
||||||
curl --retry 5 -Lso foundationdb.pkg "$(curl --retry 5 -Ls 'https://api.github.com/repos/apple/foundationdb/releases' | jq -r '.[] | select(.prerelease == false) | .assets[] | select(.name | test("${{startsWith(matrix.target, 'x86') && 'x86_64' || 'arm64'}}" + ".pkg")) | .browser_download_url' | head -n1)"
|
curl -Lo foundationdb.pkg "https://glare.now.sh/apple/foundationdb/${{startsWith(matrix.target, 'x86') && 'x86_64' || 'arm64'}}.pkg"
|
||||||
sudo installer -allowUntrusted -dumplog -pkg foundationdb.pkg -target /
|
sudo installer -allowUntrusted -dumplog -pkg foundationdb.pkg -target /
|
||||||
cargo build --release --target ${{matrix.target}} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise"
|
cargo build --release --target ${{matrix.target}} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise"
|
||||||
mkdir -p artifacts
|
mkdir -p artifacts
|
||||||
@@ -410,25 +405,16 @@ jobs:
|
|||||||
archive/**/*.tar.gz
|
archive/**/*.tar.gz
|
||||||
archive/**/*.zip
|
archive/**/*.zip
|
||||||
|
|
||||||
- name: Use cosign to sign existing artifacts
|
|
||||||
uses: sigstore/gh-action-sigstore-python@v3.0.0
|
|
||||||
with:
|
|
||||||
inputs: |
|
|
||||||
archive/**/*.tar.gz
|
|
||||||
archive/**/*.zip
|
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
archive/**/*.tar.gz
|
archive/**/*.tar.gz
|
||||||
archive/**/*.zip
|
archive/**/*.zip
|
||||||
archive/**/*.sigstore.json
|
|
||||||
prerelease: ${{!startsWith(github.ref, 'refs/tags/') || null}}
|
prerelease: ${{!startsWith(github.ref, 'refs/tags/') || null}}
|
||||||
tag_name: ${{!startsWith(github.ref, 'refs/tags/') && 'nightly' || null}}
|
tag_name: ${{!startsWith(github.ref, 'refs/tags/') && 'nightly' || null}}
|
||||||
append_body: true
|
append_body: true
|
||||||
# TODO add instructions about using cosign to verify binary artifact
|
|
||||||
body: |
|
body: |
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
### Check binary attestation at [here](${{ steps.attest.outputs.attestation-url }})
|
## Check binary attestation at [here](${{ steps.attest.outputs.attestation-url }})
|
||||||
|
|||||||
@@ -14,20 +14,24 @@ ENV DEBIAN_FRONTEND="noninteractive" \
|
|||||||
TERM=xterm-256color
|
TERM=xterm-256color
|
||||||
# With zig, we only need libclang and make
|
# With zig, we only need libclang and make
|
||||||
RUN \
|
RUN \
|
||||||
--mount=type=cache,target=/var/cache/apt,sharing=locked \
|
--mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||||
rm -f /etc/apt/apt.conf.d/docker-clean && \
|
rm -f /etc/apt/apt.conf.d/docker-clean && \
|
||||||
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache && \
|
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -yq --no-install-recommends curl jq xz-utils make libclang-16-dev
|
apt-get install -yq --no-install-recommends curl jq xz-utils make libclang-16-dev
|
||||||
# Install zig
|
# Install zig
|
||||||
RUN \
|
RUN ZIG_VERSION=$(curl --retry 5 -sL "https://api.github.com/repos/ziglang/zig/releases/latest" | jq -r '.tag_name') && \
|
||||||
ZIG_VERSION=$(curl --retry 5 -sL "https://api.github.com/repos/ziglang/zig/releases/latest" | jq -r '.tag_name') && \
|
|
||||||
[ ! -z "$ZIG_VERSION" ] && \
|
[ ! -z "$ZIG_VERSION" ] && \
|
||||||
curl --retry 5 -Ls "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-$(uname -m)-${ZIG_VERSION}.tar.xz" | tar -J -x -C /usr/local && \
|
curl --retry 5 -Ls "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-$(uname -m)-${ZIG_VERSION}.tar.xz" | tar -J -x -C /usr/local && \
|
||||||
ln -s "/usr/local/zig-linux-$(uname -m)-${ZIG_VERSION}/zig" /usr/local/bin/zig
|
ln -s "/usr/local/zig-linux-$(uname -m)-${ZIG_VERSION}/zig" /usr/local/bin/zig
|
||||||
# Install cargo-binstall
|
# Install cargo-binstall
|
||||||
RUN curl --retry 5 -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
RUN curl --retry 5 -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||||
|
# Install FoundationDB
|
||||||
|
# TODO According to https://github.com/apple/foundationdb/issues/11448#issuecomment-2417766293
|
||||||
|
# Once FoundationDB v7.3.53 gets released, we should be able to build the aarch64-unknown-linux-gnu target.
|
||||||
|
# The last command is for future build use, so if you are building on a native arm64 device, please use docker qemu.
|
||||||
|
RUN curl --retry 5 -Lso /usr/lib/libfdb_c.so "$(curl --retry 5 -Ls 'https://api.github.com/repos/apple/foundationdb/releases' | jq --arg arch "$(uname -m)" -r '.[] | select(.prerelease == false) | .assets[] | select(.name | test("libfdb_c." + $arch + ".so")) | .browser_download_url' | head -n1)"
|
||||||
# Install cargo-chef & sccache & cargo-zigbuild
|
# Install cargo-chef & sccache & cargo-zigbuild
|
||||||
RUN cargo binstall --no-confirm cargo-chef sccache cargo-zigbuild
|
RUN cargo binstall --no-confirm cargo-chef sccache cargo-zigbuild
|
||||||
|
|
||||||
@@ -51,31 +55,24 @@ ARG BUILD_ENV
|
|||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
# Install toolchain and specify some env variables
|
# Install toolchain and specify some env variables
|
||||||
RUN \
|
RUN \
|
||||||
rustup set profile minimal && \
|
rustup set profile minimal && \
|
||||||
rustup target add ${TARGET} && \
|
rustup target add ${TARGET} && \
|
||||||
mkdir -p artifact && \
|
mkdir -p artifact && \
|
||||||
touch /env-cargo && \
|
touch /env-cargo && \
|
||||||
if [ ! -z "${BUILD_ENV}" ]; then \
|
if [ ! -z "${BUILD_ENV}" ]; then \
|
||||||
echo "export ${BUILD_ENV}" >> /env-cargo; \
|
echo "export ${BUILD_ENV}" >> /env-cargo; \
|
||||||
echo "Setting up ${BUILD_ENV}"; \
|
echo "Setting up ${BUILD_ENV}"; \
|
||||||
fi && \
|
fi
|
||||||
if [[ "${TARGET}" == *gnu ]]; then \
|
|
||||||
echo "export FDB_ARCH=${TARGET%%-*}" >> /env-cargo; \
|
|
||||||
fi
|
|
||||||
# Install FoundationDB
|
|
||||||
RUN \
|
|
||||||
source /env-cargo && \
|
|
||||||
if [ ! -z "${FDB_ARCH}" ]; then \
|
|
||||||
curl --retry 5 -Lso /usr/lib/libfdb_c.so "$(curl --retry 5 -Ls 'https://api.github.com/repos/apple/foundationdb/releases' | jq --arg FDB_ARCH "$FDB_ARCH" -r '.[] | select(.prerelease == false) | .assets[] | select(.name | test("libfdb_c." + $FDB_ARCH + ".so")) | .browser_download_url' | head -n1)"; \
|
|
||||||
fi
|
|
||||||
# Cargo-chef Cache layer
|
# Cargo-chef Cache layer
|
||||||
RUN \
|
RUN \
|
||||||
--mount=type=secret,id=ACTIONS_CACHE_URL,env=ACTIONS_CACHE_URL \
|
--mount=type=secret,id=ACTIONS_CACHE_URL,env=ACTIONS_CACHE_URL \
|
||||||
--mount=type=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \
|
--mount=type=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \
|
||||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
--mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
--mount=type=cache,target=/usr/local/cargo/git \
|
--mount=type=cache,target=/usr/local/cargo/git \
|
||||||
|
# TODO According to https://github.com/apple/foundationdb/issues/11448#issuecomment-2417766293
|
||||||
|
# Once FoundationDB v7.3.53 gets released, we should be able to build the aarch64-unknown-linux-gnu target.
|
||||||
source /env-cargo && \
|
source /env-cargo && \
|
||||||
if [ ! -z "${FDB_ARCH}" ]; then \
|
if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ]; then \
|
||||||
RUSTFLAGS="-L /usr/lib" cargo chef cook --recipe-path recipe.json --zigbuild --release --target ${TARGET} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise"; \
|
RUSTFLAGS="-L /usr/lib" cargo chef cook --recipe-path recipe.json --zigbuild --release --target ${TARGET} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise"; \
|
||||||
fi
|
fi
|
||||||
RUN \
|
RUN \
|
||||||
@@ -90,14 +87,16 @@ RUN \
|
|||||||
COPY . .
|
COPY . .
|
||||||
ENV RUSTC_WRAPPER="sccache" \
|
ENV RUSTC_WRAPPER="sccache" \
|
||||||
SCCACHE_GHA_ENABLED=true
|
SCCACHE_GHA_ENABLED=true
|
||||||
# Build FoundationDB version
|
# Build foundationdb version
|
||||||
RUN \
|
RUN \
|
||||||
--mount=type=secret,id=ACTIONS_CACHE_URL,env=ACTIONS_CACHE_URL \
|
--mount=type=secret,id=ACTIONS_CACHE_URL,env=ACTIONS_CACHE_URL \
|
||||||
--mount=type=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \
|
--mount=type=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \
|
||||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
--mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
--mount=type=cache,target=/usr/local/cargo/git \
|
--mount=type=cache,target=/usr/local/cargo/git \
|
||||||
|
# TODO According to https://github.com/apple/foundationdb/issues/11448#issuecomment-2417766293
|
||||||
|
# Once FoundationDB v7.3.53 gets released, we should be able to build the aarch64-unknown-linux-gnu target.
|
||||||
source /env-cargo && \
|
source /env-cargo && \
|
||||||
if [ ! -z "${FDB_ARCH}" ]; then \
|
if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ]; then \
|
||||||
RUSTFLAGS="-L /usr/lib" cargo zigbuild --release --target ${TARGET} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise"; \
|
RUSTFLAGS="-L /usr/lib" cargo zigbuild --release --target ${TARGET} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise"; \
|
||||||
mv /app/target/${TARGET}/release/stalwart-mail /app/artifact/stalwart-mail-foundationdb; \
|
mv /app/target/${TARGET}/release/stalwart-mail /app/artifact/stalwart-mail-foundationdb; \
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ utils = { path = "../utils" }
|
|||||||
nlp = { path = "../nlp" }
|
nlp = { path = "../nlp" }
|
||||||
trc = { path = "../trc" }
|
trc = { path = "../trc" }
|
||||||
rocksdb = { version = "0.23", optional = true, features = ["multi-threaded-cf"] }
|
rocksdb = { version = "0.23", optional = true, features = ["multi-threaded-cf"] }
|
||||||
foundationdb = { version = "0.9.2", features = ["embedded-fdb-include", "fdb-7_3"], optional = true }
|
foundationdb = { version = "0.9.0", features = ["embedded-fdb-include", "fdb-7_1"], optional = true }
|
||||||
rusqlite = { version = "0.32", features = ["bundled"], optional = true }
|
rusqlite = { version = "0.32", features = ["bundled"], optional = true }
|
||||||
rust-s3 = { version = "=0.35.0-alpha.2", default-features = false, features = ["tokio-rustls-tls", "no-verify-ssl"], optional = true }
|
rust-s3 = { version = "=0.35.0-alpha.2", default-features = false, features = ["tokio-rustls-tls", "no-verify-ssl"], optional = true }
|
||||||
azure_core = { version = "0.21.0", optional = true }
|
azure_core = { version = "0.21.0", optional = true }
|
||||||
|
|||||||
Reference in New Issue
Block a user