askama/.readthedocs.yaml
René Kijewski 72c46f452f Update to more current rust version on readthedocs
Our documentation needs nightly features `doc_cfg`, `doc_auto_cfg` to
build. Instead of using the nightly channel, which is not available on
readthedocs.org, we opt in to nightly features by setting the
environment variable `RUSTC_BOOTSTRAP` to `1`. This gives on unstable
features in a stable channel.

Our dependency `proc-macro2` tests if opting-in to unstable feature is
possible, and if so, it expects that it runs on a quite recent `nightly`
release. The newest rust version that is available out-of-the-box on
readthedocs is rust 1.82, which is not *that* recent anymore, being
released on 2024-08-30.

This PR makes use of the readly configured tool `asdf` to select a more
recent rust version semi-manually.
2025-04-19 23:30:26 +02:00

33 lines
1.2 KiB
YAML

# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
version: 2
build:
os: ubuntu-lts-latest
tools:
python: "3.12"
commands:
# Install a current version of rust
- asdf install rust 1.86.0
- asdf global rust 1.86.0
# proc-macro2 v1.0.95 expects at least nightly-2025-04-16.
- cargo update --package proc-macro2 --precise 1.0.94
# Generate "book/theme/index.hbs" as "skeleton" of the generated pages.
- book/update-theme.py
# Install mdbook.
- mkdir -p $HOME/bin
- curl --location --silent --show-error --fail https://github.com/cargo-bins/cargo-quickinstall/releases/download/mdbook-0.4.40/mdbook-0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xzvvf - -C $HOME/bin
# Convert the book to HTML.
- $HOME/bin/mdbook build book --dest-dir $READTHEDOCS_OUTPUT/html
# Make the ads readable.
- cat book/ethicalads-theme.css >> $READTHEDOCS_OUTPUT/html/css/general.css
# We are done!
- cp book/404.html $READTHEDOCS_OUTPUT/html
# Build and copy the API docs
- cargo install cargo-docs-rs
- RUSTC_BOOTSTRAP=1 cargo docs-rs -p askama
- cp -a -r -t $READTHEDOCS_OUTPUT/html/ target/x86_64-unknown-linux-gnu/doc/