-
-
Notifications
You must be signed in to change notification settings - Fork 184
252 lines (210 loc) · 7.66 KB
/
publish-api-and-stubs.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
name: publish-api-and-stubs
on:
schedule:
- cron: "0 1 * * *" # Run at 1 AM UTC
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
env:
PYTHON_VERSION: "3.11"
jobs:
build:
name: Build UPBGE
runs-on: ubuntu-24.04
steps:
- name: Setup APT
run: |
sudo curl https://raw.githubusercontent.com/UPBGE/upbge/master/.github/workflows/03oracular.list \
-o /etc/apt/sources.list.d/03oracular.list && \
sudo curl https://raw.githubusercontent.com/UPBGE/upbge/master/.github/workflows/03ubuntu \
-o /etc/apt/apt.conf.d/03ubuntu
- name: Install Tools
run: |
sudo apt update && \
sudo apt dist-upgrade && \
sudo apt install -y build-essential git-lfs git subversion cmake ninja-build \
cmake-curses-gui cmake-gui patch libx11-dev \
libxxf86vm-dev libxcursor-dev libxi-dev libxrandr-dev libxinerama-dev libegl-dev \
libwayland-dev wayland-protocols libxkbcommon-dev libdbus-1-dev linux-libc-dev
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '${{env.PYTHON_VERSION}}'
- name: Install Python Dependencies
run: |
curl https://bootstrap.pypa.io/get-pip.py | python && \
python -m pip install numpy requests cython idna charset-normalizer urllib3 certifi zstandard pybind11
- name: Setup Python Path
run: |
sudo sh -c "echo '$pythonLocation/lib' >> /etc/ld.so.conf.d/python.conf" && \
sudo ldconfig
- name: Checkout sources
uses: actions/checkout@v3
with:
repository: "UPBGE/upbge"
ref: "master"
path: "upbge"
- name: Checkout addons and addons_contrib
run: |
cd upbge/scripts && \
git clone https://github.com/UPBGE/blender-addons.git addons && \
git submodule sync && \
git submodule update --init --recursive --remote && \
git submodule foreach git checkout main && \
git submodule foreach git pull --rebase origin main && \
git clone https://projects.blender.org/blender/blender-addons-contrib.git addons_contrib
- name: Download Precompiled Libs
run: |
cd upbge && \
./build_files/utils/make_update.py --use-linux-libraries
- name: Configure CMake
run: |
cmake -S upbge -B build \
-C upbge/build_files/cmake/config/blender_release.cmake \
-DWITH_GAMEENGINE=ON \
-DWITH_PLAYER=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_INSTALL_PORTABLE=ON \
-DWITH_MOD_OCEANSIM=OFF \
-DWITH_CYCLES=OFF \
-DWITH_LIBMV=OFF \
-DWITH_LIBMV_SCHUR_SPECIALIZATIONS=OFF \
-DWITH_HYDRA=OFF \
-DWITH_VULKAN_BACKEND=OFF \
-DWITH_GHOST_WAYLAND=OFF \
-DPYTHON_VERSION=${{env.PYTHON_VERSION}}
- name: Build UPBGE
run: make -C build -j `nproc`
- name: Copy Release Scripts
run: make -C build install
- name: Archive Build
if: ${{ !env.ACT }}
run: tar zcvf build.tar.gz build
- name: Upload Build
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v4
with:
name: blender
path: build.tar.gz
retention-days: 3
publish_api:
name: Publish API Documentation
runs-on: ubuntu-24.04
needs: [build]
steps:
- name: Download Build
if: ${{ !env.ACT }}
uses: actions/download-artifact@v4
with:
name: blender
- name: Extract Build
if: ${{ !env.ACT }}
run: tar zxvf build.tar.gz
- name: Setup APT
run: |
sudo curl https://raw.githubusercontent.com/UPBGE/upbge/master/.github/workflows/03oracular.list \
-o /etc/apt/sources.list.d/03oracular.list && \
sudo curl https://raw.githubusercontent.com/UPBGE/upbge/master/.github/workflows/03ubuntu \
-o /etc/apt/apt.conf.d/03ubuntu
- name: Install Tools
run: |
sudo apt update && \
sudo apt dist-upgrade && \
sudo apt install -y libxi6 libxxf86vm1 libxfixes3 libgl1 libx11-dev wayland-protocols
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '${{env.PYTHON_VERSION}}'
- name: Install Python Dependencies
run: |
curl https://bootstrap.pypa.io/get-pip.py | python && \
python -m pip install sphinx furo yapf tqdm numpy
- name: Setup Python Path
run: |
sudo sh -c "echo '$pythonLocation/lib' >> /etc/ld.so.conf.d/python.conf" && \
sudo ldconfig
- name: Checkout sources
uses: actions/checkout@v3
with:
repository: "UPBGE/upbge"
ref: "master"
path: "upbge"
- name: Prepare API Documentation
working-directory: build
run: |
rm -Rf bin/4.4/python && \
bin/blender --python-use-system-env --background -noaudio --factory-startup \
--python ../upbge/doc/python_api/sphinx_doc_gen.py -- \
--output "${{ github.workspace }}/python_api"
- name: Build API Documentation
working-directory: python_api
run: |
sphinx-build -b html -j auto sphinx-in upbge-api-reference && \
rm -Rf upbge-api-reference/.doctrees && \
zip -r upbge-api-reference/upbge-api-reference.zip upbge-api-reference
- name: Publish to UPBGE
uses: peaceiris/actions-gh-pages@v4
with:
external_repository: UPBGE/UPBGE-API
publish_branch: master
publish_dir: python_api/upbge-api-reference
deploy_key: ${{ secrets.APIDOCS_DEPLOY_KEY }}
- name: Archive Documents
if: ${{ !env.ACT }}
run: tar zcvf apidocs.tar.gz python_api
- name: Upload Documents
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v4
with:
name: apidocs
path: apidocs.tar.gz
retention-days: 3
publish_stubs:
name: Publish API Stubs
runs-on: ubuntu-24.04
needs: [publish_api]
steps:
- name: Download Build
if: ${{ !env.ACT }}
uses: actions/download-artifact@v4
with:
name: blender
- name: Extract Build
if: ${{ !env.ACT }}
run: tar zxvf build.tar.gz
- name: Download Documents
if: ${{ !env.ACT }}
uses: actions/download-artifact@v4
with:
name: apidocs
- name: Extract Documents
if: ${{ !env.ACT }}
run: tar zxvf apidocs.tar.gz
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '${{env.PYTHON_VERSION}}'
- name: Install Python Dependencies
run: |
curl https://bootstrap.pypa.io/get-pip.py | python && \
python -m pip install bpystubgen
- name: Build API Stubs
working-directory: python_api
run: |
python -m bpystubgen --quiet sphinx-in upbge-stub && \
curl https://raw.githubusercontent.com/mysticfall/bpystubgen/main/package/setup.py -o upbge-stub/setup.py && \
curl https://raw.githubusercontent.com/mysticfall/bpystubgen/main/package/README.md -o upbge-stub/README.md
- name: Build Python Package
working-directory: python_api/upbge-stub
run: |
sed -i "s/#APP_NAME#/upbge/g" setup.py && \
sed -i "s/#APP_VERSION#/0.3.1/g" setup.py && \
sed -i "s/#BUILD_NUMBER#/${{ github.run_id }}/g" setup.py && \
python setup.py sdist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
packages-dir: python_api/upbge-stub/dist
skip-existing: true