-
Notifications
You must be signed in to change notification settings - Fork 487
137 lines (117 loc) · 4.01 KB
/
build_pr_documentation.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
name: Build PR documentation
on:
workflow_dispatch:
pull_request:
branches: [ main ]
paths:
- "optimum/**.py"
- "docs/**.mdx"
- "docs/**.yml"
- ".github/workflows/build_pr_documentation.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build_documentation:
runs-on: ubuntu-22.04
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
PR_NUMBER: ${{ github.event.number }}
EVENT_CONTEXT: ${{ toJSON(github.event) }}
PR_CLONE_URL: ${{ github.event.pull_request.head.repo.clone_url }}
steps:
- uses: actions/checkout@v2
with:
repository: 'huggingface/doc-builder'
path: doc-builder
- uses: actions/checkout@v2
with:
repository: 'huggingface/optimum'
path: optimum
- uses: actions/checkout@v2
with:
repository: 'huggingface/optimum-habana'
path: optimum-habana
- uses: actions/checkout@v2
with:
repository: 'huggingface/optimum-intel'
path: optimum-intel
- uses: actions/checkout@v2
with:
repository: 'huggingface/optimum-furiosa'
path: optimum-furiosa
- uses: actions/checkout@v2
with:
repository: 'huggingface/optimum-amd'
path: optimum-amd
- uses: actions/checkout@v2
with:
repository: 'huggingface/optimum-tpu'
path: optimum-tpu
- name: Setup environment
run: |
python -m venv venv-doc
source venv-doc/bin/activate
pip uninstall -y doc-builder
cd doc-builder
git pull origin main
pip install .
pip install black
cd ..
- name: Make Habana documentation
run: |
sudo docker system prune -a -f
cd optimum-habana
make doc BUILD_DIR=habana-doc-build VERSION=pr_$PR_NUMBER
sudo mv habana-doc-build ../optimum
cd ..
- name: Make Intel documentation
run: |
sudo docker system prune -a -f
cd optimum-intel
make doc BUILD_DIR=intel-doc-build VERSION=pr_$PR_NUMBER
sudo mv intel-doc-build ../optimum
cd ..
# TODO: enable Furiosa doc build in PRs once archive.furiosa.ai is public
- name: Make Furiosa documentation
run: |
echo "For PRs we don't build Furiosa doc"
- name: Make AMD documentation
run: |
sudo docker system prune -a -f
cd optimum-amd
make doc BUILD_DIR=amd-doc-build VERSION=pr_$PR_NUMBER
sudo mv amd-doc-build ../optimum
cd ..
- name: Make TPU documentation
run: |
sudo docker system prune -a -f
source venv-doc/bin/activate
cd optimum-tpu
pip install -U pip
pip install . -f https://storage.googleapis.com/libtpu-releases/index.html
doc-builder build optimum.tpu docs/source/ --build_dir tpu-doc-build --version pr_$PR_NUMBER --version_tag_suffix "" --html --clean
mv tpu-doc-build ../optimum
cd ..
- name: Make Optimum documentation
run: |
sudo docker system prune -a -f
cd optimum
make doc BUILD_DIR=optimum-doc-build VERSION=pr_$PR_NUMBER COMMIT_SHA_OPTIMUM=$COMMIT_SHA CLONE_URL=$PR_CLONE_URL
cd ..
- name: Combine subpackage documentation
run: |
cd optimum
sudo python docs/combine_docs.py --subpackages nvidia amd intel neuron tpu habana furiosa --version pr_$PR_NUMBER
sudo mv optimum-doc-build ../
cd ..
- name: Save commit_sha & pr_number
run: |
sudo chmod -R ugo+rwx optimum-doc-build
cd optimum-doc-build
echo ${{ env.COMMIT_SHA }} > ./commit_sha
echo ${{ env.PR_NUMBER }} > ./pr_number
- uses: actions/upload-artifact@v3
with:
name: doc-build-artifact
path: optimum-doc-build/