-
Notifications
You must be signed in to change notification settings - Fork 1.9k
200 lines (197 loc) · 6.63 KB
/
build_docs.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: Build Documentation
# Build documentation on:
# - pushes to master and uploads to latest folder
# - Released and uploads to folder that matches release tag
on:
push:
branches:
- master
- 'releases/**'
pull_request:
branches:
- '*'
release:
types:
- published
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
cpp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- name: Build docs
run: nix build --print-build-logs .#vw-cpp-docs
- name: Upload built docs
uses: actions/upload-artifact@v4
with:
name: cxx_docs
path: result/html/
dump-options-build:
container:
image: vowpalwabbit/ubuntu1804-build:latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- run: |
sudo apt update
sudo apt install -y ninja-build
- name: Configure
run: cmake -S . -B build -G Ninja -DBUILD_TESTING=OFF
- name: Build dump options
run: cmake --build build -t vw-dump-options
- name: Upload vw-dump-options
uses: actions/upload-artifact@v4
with:
name: vw-dump-options
path: build/utl/dump_options/vw-dump-options
python-build:
container:
image: vowpalwabbit/manylinux2010-build:latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- run: echo "/opt/python/cp310-cp310/bin" >> $GITHUB_PATH
- name: Build wheel
shell: bash
run: |
pip wheel . -w wheel_output/ --global-option --cmake-options="-DSTATIC_LINK_VW_JAVA=On;-DPython_INCLUDE_DIR='/opt/python/cp310-cp310/include/python3.10/'" --verbose
auditwheel repair wheel_output/*whl -w audit_output/
- name: Upload built wheel
uses: actions/upload-artifact@v4
with:
name: python_wheel
path: audit_output/
python-doc:
needs: [python-build, dump-options-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- uses: actions/setup-node@v3
- uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: If this is a push build then set version to latest
if: ${{ github.event_name == 'push' }}
run: echo "VW_SPHINX_VERSION_OVERRIDE=latest" >> $GITHUB_ENV
- name: Download Wheel
uses: actions/download-artifact@v1
with:
name: python_wheel
- name: Download vw-dump-options
uses: actions/download-artifact@v1
with:
name: vw-dump-options
- name: Change permissions to rvw-dump-options
shell: bash
run: chmod +x ./vw-dump-options/vw-dump-options
- name: Install dependencies
shell: bash
run: |
pip install -r python/docs/build-requirements.txt
pip install -r requirements.txt
pip install PyYAML
npm install -g handlebars
- name: Install wheel
shell: bash
run: |
export wheel_files=(python_wheel/*)
export wheel_file="${wheel_files[0]}"
echo Installing ${wheel_file}...
pip install ${wheel_file}
- name: Generate CLI docs
run: |
cd python/docs/cmd_options_template
python generate_cmdline_docs.py --dump-options-bin ../../../vw-dump-options/vw-dump-options --template ./command_line_args.hbs --out ../source/ --extra-info ./cmdline_help_overrides.yml
- name: Build docs
run: |
cd python/docs
make html
- name: Upload built docs
uses: actions/upload-artifact@v4
with:
name: python_docs
path: python/docs/build/
upload:
needs: [cpp, python-doc]
runs-on: ubuntu-latest
# The upload step should only be run on the main repository and only for pushes or releases (not pull requests).
if: ${{ github.repository == 'VowpalWabbit/vowpal_wabbit' && (github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch') }}
steps:
- name: Set folder name to latest if push
if: ${{ github.event_name == 'push' }}
run: echo "FOLDER_NAME=latest" >> $GITHUB_ENV
- name: Set folder name to version if release
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
run: echo "FOLDER_NAME=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
- name: Download c++ Docs
uses: actions/download-artifact@v1
with:
name: cxx_docs
- name: Download Python Docs
uses: actions/download-artifact@v1
with:
name: python_docs
- name: Print contents of directory
shell: bash
run: |
pwd
ls
echo $GITHUB_WORKSPACE
- uses: actions/checkout@v1
with:
submodules: recursive
repository: VowpalWabbit/docs
ref: master
# For some reason, path is relative to the directory above GITHUB_WORKSPACE
# To ensure the rest of the script makes sense, we need to place this under vowpal_wabbit
path: vowpal_wabbit/docs
- name: Print contents of directory
shell: bash
run: |
echo $GITHUB_WORKSPACE
pwd
ls
cd docs
pwd
ls
- name: Copy c++ Docs
shell: bash
run: |
rm -rf docs/vowpal_wabbit/cpp/$FOLDER_NAME/
mkdir -p docs/vowpal_wabbit/cpp/$FOLDER_NAME/
cp -r cxx_docs/* docs/vowpal_wabbit/cpp/$FOLDER_NAME/
- name: Copy Python Docs
shell: bash
run: |
rm -rf docs/vowpal_wabbit/python/$FOLDER_NAME/
mkdir -p docs/vowpal_wabbit/python/$FOLDER_NAME/
cp -r python_docs/html/* docs/vowpal_wabbit/python/$FOLDER_NAME/
- name: Checkout master
shell: bash
run: |
cd docs
git checkout master
- name: Commit changes
shell: bash
run: |
cd docs
git add --all
git config --local user.email "[email protected]"
git config --local user.name "WoboWabbit"
git commit -m "Update documentation for commit: VowpalWabbit/vowpal_wabbit@${{ github.sha }}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: VowpalWabbit/docs
directory: docs
github_token: ${{ secrets.automation_github_token }}