rsproject/libadwaita-rs/.gitlab-ci.yml
2024-04-24 14:51:57 +08:00

74 lines
2.4 KiB
YAML

variables:
# format is <branch>=<name>
# the name is used in the URL
# latest release must be at the top
# (only relevant on main branch)
RELEASES: |
v0.6=0.6
v0.5=0.5
# we need the gir submodules
GIT_SUBMODULE_STRATEGY: recursive
# overwrite 'update = none' in .gitmodules
GIT_SUBMODULE_UPDATE_FLAGS: --checkout
image: "ghcr.io/gtk-rs/gtk4-rs/gtk4:latest"
before_script:
- sudo dnf install appstream-devel -y
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
- source $HOME/.cargo/env
- rustup toolchain install nightly --profile minimal --allow-downgrade -c rustfmt
- meson _build --prefix=/usr -Dlibadwaita:tests=false -Dlibadwaita:introspection=disabled -Dlibadwaita:examples=false -Dlibadwaita:vapi=false
- ninja -C _build install
- curl --proto '=https' --tlsv1.2 -sSf -o gir-rustdoc.py
https://gitlab.gnome.org/World/Rust/gir-rustdoc/-/raw/main/gir-rustdoc.py
- chmod +x gir-rustdoc.py
build:
script:
- cargo build --features v1_5 --examples
- xvfb-run -a -s "-screen 0 1024x768x24" cargo test --features v1_5
docs:
stage: test
variables:
GIT_SUBMODULE_STRATEGY: recursive
RUSTDOCFLAGS: "--cfg docsrs"
script:
# generate the docs
- cargo install rustdoc-stripper
- ./generator.py --embed-docs
- rustup default nightly
- eval $(./gir-rustdoc.py pre-docs)
- cargo doc --all-features --no-deps
- mv target/doc/ docs
# Fetch the libadwaita images
- git clone --depth=1 https://gitlab.gnome.org/GNOME/libadwaita --no-checkout ./adw-src
- cd ./adw-src
- git sparse-checkout init --cone
- git sparse-checkout set doc/images
- git checkout main
- mv ./doc/images/*.png ../docs/libadwaita
- cd ../
# Fix broken urls
- sed -i 's|style-classes.html|https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/style-classes.html|g' docs/libadwaita/struct.Flap.html
- sed -i 's|style-classes.html|https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/style-classes.html|g' docs/libadwaita/struct.StatusPage.html
artifacts:
paths:
- docs
pages:
stage: deploy
script:
- ./gir-rustdoc.py html-index
# main docs
- mkdir public/git
- mv docs public/git/docs
# stable docs
- ./gir-rustdoc.py docs-from-artifacts
artifacts:
paths:
- public
rules:
- if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH