mirror of
https://github.com/element-hq/matrix-authentication-service.git
synced 2026-09-20 05:26:15 +00:00
Until now only the clippy CI job and the Dockerfile named a Rust version (kept in sync by hand), while every other CI job, the release binaries and the docs build ran on whatever `stable` happened to be that day. Rust 1.98.0 landing on 2026-08-20 broke `build-binaries` overnight because of that (#5935). `rust-toolchain.toml` pins 1.96.0 with the `minimal` profile plus clippy, and every `rustup toolchain install stable ...` in CI becomes a bare `rustup toolchain install`, which reads the file. Starting at 1.96.0 (the version clippy is already clean against) keeps this change free of lint churn; catching up to 1.98.0 is a follow-up. rustfmt stays on nightly because `.rustfmt.toml` uses nightly-only options, so that job now invokes `cargo +nightly fmt` explicitly instead of setting a rustup directory override, which would silently take precedence over the toolchain file. The file does not list the linux cross-compilation targets on purpose: that would make every developer and CI job download `rust-std` they never use. The two consumers that cross-compile add the targets themselves.
61 lines
2.0 KiB
Bash
61 lines
2.0 KiB
Bash
#!/bin/sh
|
|
|
|
# Copyright 2025, 2026 Element Creations Ltd.
|
|
# Copyright 2025 New Vector Ltd.
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
# Please see LICENSE files in the repository root for full details.
|
|
#
|
|
# This script is used by the Cloudflare Pages to build the documentation.
|
|
# It detects if it's running in the Cloudflare Pages build environment and will install the required dependencies.
|
|
# It can also be used locally to build the documentation, given that the required dependencies are installed.
|
|
|
|
set -eux
|
|
|
|
# Install the dependencies if we're in the Cloudflare Pages build environment
|
|
# In this environment, the CF_PAGES environment variable is set to 1
|
|
if [ "${CF_PAGES:-""}" = "1" ]; then
|
|
MDBOOK_VERSION=0.5.0
|
|
|
|
# Install rustup
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
|
|
|
|
# Source the environment variables to add cargo to the path
|
|
. "$HOME/.cargo/env"
|
|
|
|
# Install the toolchain pinned in rust-toolchain.toml
|
|
rustup toolchain install
|
|
|
|
# Install mdbook
|
|
MDBOOK_URL="https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-$(uname -m)-unknown-linux-gnu.tar.gz"
|
|
curl --proto '=https' --tlsv1.2 -sSfL "${MDBOOK_URL}" | tar -C "$HOME/.cargo/bin" -xzv
|
|
|
|
# Enable pnpm via corepack (Node and corepack are pre-installed on Cloudflare Pages)
|
|
corepack enable
|
|
fi
|
|
|
|
# Sanity check
|
|
rustdoc --version
|
|
rustc --version
|
|
cargo --version
|
|
mdbook --version
|
|
pnpm --version
|
|
|
|
# Build the docs
|
|
mdbook build
|
|
|
|
# Build the rustdoc
|
|
# This is required to be able to use the unstable `-Zrustdoc-map` flag
|
|
env RUSTC_BOOTSTRAP=1 \
|
|
cargo doc -Zrustdoc-map --workspace --lib --no-deps
|
|
# Delete the rustdoc lockfile
|
|
rm target/doc/.lock
|
|
|
|
# Move the Rust documentation within the mdBook
|
|
rm -rf target/book/rustdoc
|
|
mv target/doc target/book/rustdoc
|
|
|
|
# Build the frontend storybook
|
|
pnpm install --frozen-lockfile
|
|
pnpm --filter mas-frontend exec storybook build -o ../target/book/storybook
|