-
Notifications
You must be signed in to change notification settings - Fork 0
286 lines (232 loc) · 9.65 KB
/
build_linux.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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
name: Build bpy for Linux
on:
workflow_dispatch:
inputs:
tag:
description: 'Blender Tag to build'
required: true
default: 'v4.3.2'
python_version:
description: 'Python version to use'
required: true
default: '3.11.9'
workflow_call:
inputs:
tag:
description: 'Blender Tag to build'
required: true
type: string
python_version:
description: 'Python version to use'
required: true
default: '3.10.11'
type: string
jobs:
build:
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: Set environment variables
id: set_env
run: |
TAG=${{ inputs.tag || github.event.inputs.tag }}
PYTHON_VERSION=${{ inputs.python_version || github.event.inputs.python_version }}
echo "TAG=$TAG" >> $GITHUB_ENV
echo "PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_ENV
# - name: Checkout Blender repository recursively
# uses: actions/checkout@v2
# with:
# repository: blender/blender
# ref: ${{ env.TAG }} # Checkout the tag specified in the workflow dispatch
# submodules: 'recursive' # Recursively checkout submodules
# path: blender
# - name: Set up Conda
# uses: conda-incubator/setup-miniconda@v2
# with:
# auto-update-conda: true
# python-version: ${{ env.PYTHON_VERSION }}
# # environment-file: environment.yml
# activate-environment: bpy-env
# channels: conda-forge
# - name: Install Conda Dependencies
# run: |
# conda install -y cuda-toolkit setuptools -c "nvidia/label/cuda-12.3.1" -c conda-forge
# # find / -name nvcc
# - name: Add conda NVCC subdirectories to PATH
# run: |
# # for dir in $(find /home/runner/conda_pkgs_dir/ -mindepth 1 -type d -name *nvcc*); do
# # echo "$dir" >> $GITHUB_PATH
# # echo "$dir"
# # done
# echo "/usr/share/miniconda/bin" >> $GITHUB_PATH
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up CUDA
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
# Install CUDA toolkit
sudo apt-get install -y cuda-toolkit-12-6
echo "/usr/local/cuda-12.6/bin" >> $GITHUB_PATH
# - name: Setup terminal session
# uses: fawazahmed0/action-debug@main
# with:
# credentials: "user:p@ss!"
- name: Add CUDA compilation flags
run: |
nvcc --version
# echo 'set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)' >> ./blender/build_files/cmake/config/bpy_module.cmake
- name: Set CUDA environment variables
run: |
NVCC_PATH=$(which nvcc)
CUDA_HOME=$(dirname $(dirname $NVCC_PATH))
echo "CUDA_HOME=$CUDA_HOME" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
# echo "CPLUS_INCLUDE_PATH=/usr/share/miniconda/include:$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
# echo "C_INCLUDE_PATH=/usr/share/miniconda/include:$C_INCLUDE_PATH" >> $GITHUB_ENV
echo $CUDA_HOME
echo $LD_LIBRARY_PATH
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# with:
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow
# limit-access-to-actor: true
# ## limits ssh access and adds the ssh public keys of the listed GitHub users
# limit-access-to-users: michaelgold
# - name: Cache Blender dependencies
# uses: actions/cache@v2
# with:
# path: |
# ./lib
# key: ${{ runner.os }}-blender-lib-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-blender-lib-
- name: Install Linux Dependencies
run: |
sudo apt update
sudo apt-get install -y build-essential git subversion cmake libx11-dev libxxf86vm-dev libxcursor-dev libxi-dev libxrandr-dev libxinerama-dev libegl-dev
sudo apt-get install -y libwayland-dev wayland-protocols libxkbcommon-dev libdbus-1-dev linux-libc-dev
# Add additional required development libraries
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libfreetype6-dev libboost-all-dev
sudo apt-get install -y libglu1-mesa-dev libgl1-mesa-dev zlib1g-dev libxmu-dev libxi-dev libxxf86vm-dev
# Add libepoxy for OpenGL handling
sudo apt-get install -y libepoxy-dev
# Add Vulkan development packages
sudo apt-get install -y libvulkan-dev
echo "Running install_linux_packages.py"
# - name: Verify X11 Installation
# run: |
# dpkg -l | grep libx11-dev
# - name: Set Environment Variables for X11
# run: |
# echo "LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" >> $GITHUB_ENV
# - name: Unset Miniconda from LD_LIBRARY_PATH
# run: |
# export LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | sed 's|:/usr/share/miniconda/lib||')
# - name: Download blender precompiled libraries
# run: |
# if [ ! -d "./lib" ]; then
# mkdir ./lib
# cd ./lib
# svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_x86_64_glibc_228
# fi
# - name: Install Cuda Toolkit
# uses: Jimver/[email protected]
# id: cuda-toolkit
# with:
# cuda: '12.1.0'
# - name: Cache build files (for testing only)
# uses: actions/cache@v2
# with:
# path: |
# ./build_linux_bpy
# key: ${{ runner.os }}-blender-build-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-blender-build-
- name: Extract Blender Major Version Number
id: version_extraction
run: |
python -c "import sys; version_tag = sys.argv[1].lstrip('v'); parts = version_tag.split('.'); major_version = '.'.join(parts[:2]); print(f'MAJOR_VERSION={major_version}')" "${{ env.TAG }}" >> $GITHUB_ENV
# - name: Download Precompiled Binaries for the release
# run: |
# mkdir ./lib
# cd ./lib
# svn checkout https://svn.blender.org/svnroot/bf-blender/tags/blender-${{ env.MAJOR_VERSION }}-release/lib/linux_x86_64_glibc_228/
# # - name: Download Blender Python API Stubs
# # id: download-artifact
# # uses: dawidd6/action-download-artifact@v2
# # with:
# # workflow: build_all.yml
# # # github_token: ${{secrets.GITHUB_TOKEN}}
# # name: blender-python-api-stubs-${{ env.TAG }}
# # path: ./build_linux_bpy/bin/
# - name: Download Blender Python API Stubs
# id: download-artifact
# uses: actions/download-artifact@v4
# with:
# name: blender-python-api-stubs-${{ env.TAG }}
# path: ./build_linux_bpy/bin/
# - name: Build Blender
# run: |
# echo "Building bpy for Linux with tag ${{ env.TAG }}"
# cd ./blender
# make update
# make bpy
# # make bpy VERBOSE=1
- name: Install Python Dependencies
run: |
pip install -r ./requirements.txt
- name: Update Python
run: |
pip install -U pip setuptools wheel
- name: Build Blender
run: |
python -m src.buildbpy.main --tag ${{ env.TAG }} --install --publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Install Blender
# run: python -c "import shutil, site; shutil.copytree('./build_linux_bpy/bin/bpy', site.getsitepackages()[0] + '/bpy')"
# - name: Install docs prereqs
# run: |
# pip install bpystubgen
# - name: Generate Api Docs and stubs
# run: |
# cd ./blender
# python ./doc/python_api/sphinx_doc_gen.py -- --output=../python_api
# python -m bpystubgen ../python_api/sphinx-in ../python_api/output
# - name: Copy BPY Stubs to bin folder
# run: |
# cp -R ./python_api/output/* ./build_linux_bpy/bin/
# - name: Setup terminal session
# uses: fawazahmed0/action-debug@main
# with:
# credentials: "user:p@ss!"
# - name: Make Wheel
# run: |
# # PYTHON3=$(which python3)
# # PYTHON=$(which python)
# # sudo rm $PYTHON3
# # ln -s $PYTHON $PYTHON3
# pip install -U pip setuptools wheel
# cp ./workspace/make_bpy_wheel.py ./blender/build_files/utils/
# python ./blender/build_files/utils/make_bpy_wheel.py ./build_linux_bpy/bin/
# - name: Upload Wheel as Artifact
# uses: actions/upload-artifact@v2
# with:
# name: bpy-linux
# path: |
# ./build_linux_bpy/bin/*.whl
# - name: Install Dependencies
# run: |
# python -m pip install --upgrade pip ndg-httpsclient pyopenssl pyasn1
# python -m pip install bpystubgen requests python-dotenv typer=='0.9.0' httpx
# - name: Publish Wheel
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: python workspace/build_blender.py publish-github ${{ env.TAG }} ./build_linux_bpy/bin