-
Notifications
You must be signed in to change notification settings - Fork 18
154 lines (134 loc) · 4.35 KB
/
gh-pages.yml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Build & Deploy static content to GitHub Pages
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:
jobs:
build:
# build on macos until bindgen is fixed
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# sphinx-multiversion uses tags to build
# the documentation in multiple versions.
- name: Checkout | Fetch tags
run: git fetch --tags origin
- name: Setup | mdBook | 1/2
uses: hecrj/setup-rust-action@f344d1a51e8ad6e1c6c51d9cf8d5a6edf4cfd230
- name: Setup | mdBook | 2/2
uses: peaceiris/actions-mdbook@4b5ef36b314c2599664ca107bb8c02412548d79d
with:
mdbook-version: "latest"
- name: Setup | System
run: |
brew install doxygen gmp ninja node
pip install --upgrade pip
- name: Setup | OCaml | 1/2
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.14.1
- name: Setup | OCaml | 2/2
run: |
opam install --yes ocamlfind odoc ctypes zarith cppo dune
- name: Setup | JS
run: |
npm install -g jsdoc
- name: Setup | Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Setup | Sphinx
run: |
cd docs/reference
pip install -r requirements.txt
- name: Build | Book
run: |
# We `cd` into this directory first because the book
# uses references relative to this directory, i.e.,
# `../../../rust/src/aead.rs`.
pushd docs/book
mdbook build
popd
mv docs/book/book build
- name: Build | C API Reference
run: |
mkdir build/c
sphinx-multiversion docs/reference build/c
- name: Build | OCaml API Reference
run: |
mkdir -p build/ocaml/main
./opam.sh
cd opam
eval $(opam env)
opam install . --yes
dune build @doc --only-packages=hacl-star
cp -r _build/default/_doc/_html/* ../build/ocaml/main/
# TODO: #423 ctypes.stubs need to be added to old tags to build documentation.
# https://github.com/cryspen/hacl-packages/commit/81303b83a54a92d3b5f54f1b8ddbea60438cc2bf
# - name: Build | OCaml API Reference for Tags
# run: |
# mkdir -p build/ocaml
# for branch in $(git for-each-ref --format='%(refname)' refs/tags/); do
# if [[ "$branch" == *"ocaml-"* ]]; then
# rm -rf opam
# tag=$(echo $branch | cut -d'/' -f 3)
# git checkout $tag
# echo "Building documentation for $tag"
# mkdir -p build/ocaml/$tag
# ./opam.sh
# cd opam
# eval $(opam env)
# opam install . --yes
# dune build @doc --only-packages=hacl-star
# cp -r _build/default/_doc/_html/* ../build/ocaml/$tag/
# cd ../
# fi
# done
- name: Build | JS API Reference
run: |
git checkout main
cp -r js/* src/wasm
cd src/wasm
mkdir doc
node api_doc.js
jsdoc doc/readable_api.js -d doc/out
cd ../..
mkdir -p build/js
cp -r src/wasm/doc/out build/js/main
- name: Build | Rust Docs
run: |
mkdir -p build/rust
cd rust/hacl-sys
cargo doc --no-deps
cp -r target/doc ../../build/rust/main
cd ../
cargo doc --no-deps --all-features
cp -r target/doc/* ../build/rust/main
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "build"
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
steps:
- name: Setup | Pages
uses: actions/configure-pages@v2
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1