Skip to content

Commit

Permalink
support blender install linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ikappaki committed Jul 30, 2024
1 parent 0ba4c57 commit fae65a5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/tests-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ concurrency:
jobs:
run-tests:
runs-on: ${{matrix.os}}
env:
BB_BLENDER_TEST_HOME: "~/blender"
strategy:
matrix:
# os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest]
version: ['3.11']
blender: ['4.2']
blender: ['4.2.0']

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -55,9 +57,7 @@ jobs:
- name: Install Blender
if: steps.cache-blender.outputs.cache-hit != 'true'
run: |
wget https://download.blender.org/release/Blender${{ matrix.blender }}/blender-${{ matrix.blender }}.0-linux-x64.tar.xz
mkdir ~/blender
tar -xf blender-${{ matrix.blender }}.0-linux-x64.tar.xz -C ~/blender --strip-components=1
poetry run python scripts/blender_install.py ${{ matrix.blender }} ~/blender
- name: "Save Blender in cache"
if: steps.cache-blender.outputs.cache-hit != 'true'
Expand All @@ -73,8 +73,6 @@ jobs:
- name: Run integration tests
run: |
~/blender/blender --version
export PATH="$PATH:$HOME/blender"
poetry build
poetry run python scripts/bb_package_install.py
poetry run pytest -m integration -v
14 changes: 11 additions & 3 deletions scripts/blender_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import requests
import shutil
import sys
import zipfile

tmp_dir = ".bb-tmp"

Expand All @@ -24,6 +23,10 @@
if system == 'Windows':
filename = f'blender-{version}-windows-x64.zip'
extension = ".zip"
elif system == 'Linux':
filename = f'blender-{version}-linux-x64.tar.xz'
extension = ".tar.xz"

assert filename, f":error :system-unsupported {system}"
assert extension

Expand All @@ -49,8 +52,13 @@
extract_dir = os.path.join(tmp_dir, filename[:filename.rfind(extension)])
print(f'\n:extracting {filename_path} :to {tmp_dir} :as {extract_dir}')
if system == 'Windows':
with zipfile.ZipFile(filename_path) as zip_ref:
zip_ref.extractall(tmp_dir)
import zipfile
with zipfile.ZipFile(filename_path) as zip_ref:
zip_ref.extractall(tmp_dir)
elif system == 'Linux':
import tarfile
with tarfile.open(filename_path) as tar:
tar.extractall(path=tmp_dir)
print(f":extract :done")
assert os.path.exists(extract_dir)

Expand Down
7 changes: 4 additions & 3 deletions tests/basilisp_blender/integration/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
def blender_path_get():
blender_home = os.getenv(ENV_BLENDER_HOME_)
assert blender_home, f":error :env-var-not-set {ENV_BLENDER_HOME_}"
blender_home_abs = os.path.abspath(os.path.expanduser(blender_home))
exec_path = None
envpath = os.environ.get('PATH', '')
envpath_new = blender_home
envpath_new = blender_home_abs
try:
os.environ['PATH'] = envpath_new
exec_path = shutil.which('blender')
finally:
os.environ['PATH'] = envpath
assert exec_path, f":error :blender-exec-not-found-in {ENV_BLENDER_HOME_}={blender_home}"
print(f":blender-found-at {ENV_BLENDER_HOME_}={blender_home}")
assert exec_path, f":error :blender-exec-not-found-in {ENV_BLENDER_HOME_}={blender_home_abs}"
print(f":blender-found-at {ENV_BLENDER_HOME_}={blender_home_abs} :exec {exec_path}")
return exec_path

def file_exists_wait(filepath, count, interval_ms):
Expand Down

0 comments on commit fae65a5

Please sign in to comment.