-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (66 loc) · 2.67 KB
/
Copy pathdocs.yml
File metadata and controls
71 lines (66 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
name: Docs
on:
push:
branches:
- master
workflow_dispatch:
# Allow the deploy job to publish to GitHub Pages via OIDC.
permissions:
contents: read
pages: write
id-token: write
# Never run two Pages deployments concurrently, but let an in-flight one finish.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
# .cargo/config.toml pins build.target to musl, so cargo doc emits its
# output under this target-specific directory, not plain target/doc.
DOC_DIR: target/x86_64-unknown-linux-musl/doc
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: x86_64-unknown-linux-musl
- name: Install musl C toolchain
# cargo doc still *compiles* deps (running their build scripts) to
# document our crates. ring's build script needs the musl C compiler
# for the musl target, even though no final binary is linked.
run: sudo apt update && sudo apt install -y musl-tools
- name: Build rustdoc
# --workspace: document all member crates (lib, metrics-cache, metrics-fetcher)
# --no-deps: skip third-party deps, only our own crates
# --document-private-items: this is an internal maintenance doc site
run: cargo doc --workspace --no-deps --document-private-items
- name: Redirect root to the metrics-cache crate
# cargo doc produces no top-level index.html for a workspace, so point
# the Pages root at the primary crate (hyphen -> underscore in the path).
run: echo '<meta http-equiv="refresh" content="0; url=metrics_cache/index.html">' > "$DOC_DIR/index.html"
- uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.DOC_DIR }}
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# The Pages deployment service flakes fairly regularly ("Deployment
# failed, try again later" after a successful build). Retry once, and
# never fail the workflow over it: the docs BUILD failing is signal,
# the deploy hiccuping is GitHub weather.
- id: deployment
uses: actions/deploy-pages@v4
continue-on-error: true
- id: deployment-retry
if: steps.deployment.outcome == 'failure'
uses: actions/deploy-pages@v4
continue-on-error: true
- if: steps.deployment.outcome == 'failure' && steps.deployment-retry.outcome == 'failure'
run: echo "::warning::Pages deployment failed twice; docs were built but not published this run."