Skip to content

Draft [breaking]

Draft [breaking] #9443

Workflow file for this run

name: Build docs
on:
push:
branches:
- main
# Run in PRs with conflicts (https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request)
pull_request_target:
types: [opened, synchronize, reopened]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
env:
RUSTC_WRAPPER: sccache
SCCACHE_S3_USE_SSL: ${{ secrets.CACHE_SSL }}
GIT_LFS_SKIP_SMUDGE: 1
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
SCCACHE_BUCKET: namada-cache
SCCACHE_ENDPOINT: ${{ secrets.CACHE_ENDPOINT }}
AWS_ACCESS_KEY_ID: ${{ secrets.CACHE_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CACHE_SECRET_KEY }}
AWS_REGION: us-east-1
jobs:
docs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
nightly_version: [nightly-2024-02-10]
mdbook_version: [rust-lang/[email protected]]
mdbook_mermaid: [badboy/[email protected]]
mdbook_linkcheck: [Michael-F-Bryan/[email protected]]
mdbook_open_on_gh: [badboy/[email protected]]
mdbook_admonish: [tommilligan/[email protected]]
mdbook_katex: [lzanini/[email protected]]
mdbook_pagetoc: [slowsage/[email protected]]
make:
- name: Build development docs
folder: documentation/dev
bucket: namada-dev-static-website
command: cargo run --bin namada_encoding_spec && cd documentation/dev && mdbook build
steps:
- name: Checkout repo
uses: actions/checkout@v4
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install libudev
run: sudo apt-get update && sudo apt-get -y install libudev-dev
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Setup rust toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
profile: default
override: true
- name: Setup rust nightly
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
toolchain: ${{ matrix.nightly_version }}
profile: default
- name: Show rust toolchain info
run: rustup show
- name: Start sccache server
run: sccache --start-server
- name: Install cargo tool
run: |
curl -k https://installer.heliax.click/${{ matrix.mdbook_version }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_mermaid }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_linkcheck }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_open_on_gh }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_admonish }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_katex }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_pagetoc }}! | bash
cd ${{ matrix.make.folder }} && mdbook-admonish install
- name: ${{ matrix.make.name }}
run: ${{ matrix.make.command }}
- name: Zip doc folder
run: tar -cvf ${{ matrix.make.bucket }}.tar ${{ matrix.make.folder }}/book
- name: Upload rendered docs
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.make.bucket }}-${{ github.event.pull_request.head.sha || github.sha }}
path: ${{ matrix.make.bucket }}.tar
- name: Print sccache stats
if: always()
run: sccache --show-stats
- name: Stop sccache server
if: always()
run: sccache --stop-server || true
- name: Clean cargo cache
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache
cargo-cache
rust-docs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- name: Checkout repo
uses: actions/checkout@v4
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install libudev
run: sudo apt-get update && sudo apt-get -y install libudev-dev
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Setup rust toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
profile: default
override: true
- name: Setup rust nightly
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
toolchain: ${{ matrix.nightly_version }}
profile: default
- name: Show rust toolchain info
run: rustup show
- name: Start sccache server
run: sccache --start-server
- name: Build rust-docs
run: make build-doc
- name: Print sccache stats
if: always()
run: sccache --show-stats || true
- name: Stop sccache server
if: always()
run: sccache --stop-server || true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.9.1
- name: Login to private registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.REGISTRY_URL }}/namada-rust-docs
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
- name: Build and push `namada-rust-docs image`
uses: docker/build-push-action@v4
with:
context: .
file: docker/docs/Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Clean cargo cache
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache
cargo-cache