Skip to content

Commit

Permalink
Init windows runner
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaScheller committed Sep 23, 2023
1 parent d1821bd commit 5bb968e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 76 deletions.
65 changes: 40 additions & 25 deletions .github/scripts/houdini.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create_sidefx_service(client_id, client_secret_key):
def get_sidefx_platform():
"""Get the active platform usable for SideFX platform API calls
Returns:
string: The active platform
str: The active platform
"""
current_platform = platform.system()
if current_platform == 'Windows' or current_platform.startswith('CYGWIN'):
Expand All @@ -50,34 +50,26 @@ def download_sidefx_product_release(dir_path, release):
dir_path (str): The target directory
release (dict): The download build release dict
Returns:
folder_dir_path: The folder dir path of the unpacked tar file
str: The file path of the downloaded file
"""
# Download tar file
tar_file_name = release['filename']
tar_file_path = os.path.join(dir_path, tar_file_name)
# Download file
download_file_name = release['filename']
download_file_path = os.path.join(dir_path, download_file_name)
request = requests.get(release['download_url'], stream=True)
if request.status_code == 200:
with open(tar_file_path, 'wb') as tar_file:
with open(download_file_path, 'wb') as download_file:
request.raw.decode_content = True
shutil.copyfileobj(request.raw, tar_file)
shutil.copyfileobj(request.raw, download_file)
else:
raise Exception('Error downloading file!')
# Verify tar file checksum
tar_file_hash = hashlib.md5()
with open(tar_file_path, 'rb') as tar_file:
for chunk in iter(lambda: tar_file.read(4096), b''):
tar_file_hash.update(chunk)
if tar_file_hash.hexdigest() != release['hash']:
# Verify file checksum
download_file_hash = hashlib.md5()
with open(download_file_path, 'rb') as download_file:
for chunk in iter(lambda: download_file.read(4096), b''):
download_file_hash.update(chunk)
if download_file_hash.hexdigest() != release['hash']:
raise Exception('Checksum does not match!')
# Unpack tar file
with tarfile.open(tar_file_path) as tar_file:
tar_file.extractall(dir_path)
os.remove(tar_file_path)
# Get folder name
product_release_folder_name = tar_file_name
product_release_folder_name = product_release_folder_name.replace(".tar", "")
product_release_folder_name = product_release_folder_name.replace(".gz", "")
return os.path.join(dir_path, product_release_folder_name)
return download_file_path


def install_sidefx_houdini():
Expand All @@ -86,6 +78,7 @@ def install_sidefx_houdini():
sidefx_service = create_sidefx_service(SIDEFX_CLIENT_ID, SIDEFX_CLIENT_SECRET_KEY)
sidefx_platform = get_sidefx_platform()
sidefx_product = "houdini"
print(sidefx_platform)
# Get release data
releases_list = sidefx_service.download.get_daily_builds_list(product=sidefx_product,
platform=sidefx_platform,
Expand All @@ -95,15 +88,26 @@ def install_sidefx_houdini():
version=latest_production_release["version"],
build=latest_production_release["build"],
platform=sidefx_platform)


# Download latest production release
downloads_dir_path = os.path.join(os.path.expanduser("~"), "Downloads")
if not os.path.isdir(downloads_dir_path):
os.makedirs(downloads_dir_path)
houdini_installer_dir_path = download_sidefx_product_release(downloads_dir_path,
latest_production_release_download)
houdini_installer_file_path = download_sidefx_product_release(downloads_dir_path,
latest_production_release_download)
# Install latest production release
hfs_dir_path = ""
if sidefx_platform == "linux":
# Unpack tar file
with tarfile.open(houdini_installer_file_path) as tar_file:
tar_file.extractall(downloads_dir_path)
os.remove(houdini_installer_file_path)
# Get folder name
houdini_installer_dir_name = houdini_installer_dir_name['filename']
houdini_installer_dir_name = houdini_installer_dir_name.replace(".tar", "")
houdini_installer_dir_name = houdini_installer_dir_name.replace(".gz", "")
houdini_installer_dir_path = os.path.join(downloads_dir_path, houdini_installer_dir_name)
cmd = [os.path.join(houdini_installer_dir_path, "houdini.install"),
"--auto-install", "--accept-EULA", "2021-10-13",
"--install-houdini", "--no-install-license", "--no-install-avahi",
Expand All @@ -115,11 +119,22 @@ def install_sidefx_houdini():
raise Exception("Failed to install Houdini, ran into the following error:\n {error}".format(error=status.stderr))
hfs_dir_path = os.path.join("/opt", "hfs{}.{}".format(latest_production_release["version"],
latest_production_release["build"]))
hfs_versionless_dir_path = os.path.join(os.path.dirname(hfs_dir_path), "hfs")
elif sidefx_platform == "win64":
cmd = [houdini_installer_file_path,
"/S", "/AcceptEULA=2021-10-13",
"/MainApp", "/LicenseServer=No", "/StartMenu=No",
"/HQueueServer=No", "/HQueueClient=No",
"/EngineMaya=No", "/Engine3dsMax", "/EngineUnity", "/EngineUnreal=No", "/SideFXLabs=No"]
status = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if status.returncode != 0:
raise Exception("Failed to install Houdini, ran into the following error:\n {error}".format(error=status.stderr))
hfs_dir_path = os.path.join("C:\Program Files\Side Effects Software", "Houdini {}.{}".format(latest_production_release["version"], latest_production_release["build"]))
hfs_versionless_dir_path = os.path.join(os.path.dirname(hfs_dir_path), "Houdini")
else:
raise Exception("Platform {platform} is currently not"
"supported!".format(platform=platform))
# Create version-less symlink
hfs_version_less_dir_path = os.path.join(os.path.dirname(hfs_dir_path), "hfs")
os.symlink(hfs_dir_path, hfs_version_less_dir_path)


Expand Down
52 changes: 4 additions & 48 deletions .github/workflows/build_houdini.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ concurrency:

jobs:

build:
runs-on: ubuntu-latest
build_windows:
runs-on: windows-2019
environment: houdini
steps:
- name: Checkout repository
Expand All @@ -26,54 +26,10 @@ jobs:
git checkout tags/$latest_release_tag
- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install -y zip
sudo apt-get install -y build-essential cmake
sudo apt-get install -y python3 python3-pip
sudo pip3 install requests
pip3 install requests
- name: Install Houdini
env:
SIDEFX_CLIENT_ID: '${{ secrets.SIDEFX_CLIENT_ID }}'
SIDEFX_CLIENT_SECRET_KEY: '${{ secrets.SIDEFX_CLIENT_SECRET_KEY }}'
run: |
sudo --preserve-env python3 .github/scripts/houdini.py --install
- name: Build USD File Resolver
run: |
.github/scripts/houdini_build.sh fileResolver
- name: Build USD Python Resolver
run: |
.github/scripts/houdini_build.sh pythonResolver
- name: Create single .zip archive
run: |
pushd /opt/hfs > /dev/null && source houdini_setup && popd > /dev/null
ARTIFACT_FILE_NAME=UsdAssetResolver_houdini-${HOUDINI_MAJOR_RELEASE}.${HOUDINI_MINOR_RELEASE}.${HOUDINI_BUILD_VERSION}-linux.zip
cd dist && zip -r $ARTIFACT_FILE_NAME * && cd ..
mkdir artifacts && mv dist/$ARTIFACT_FILE_NAME artifacts/$ARTIFACT_FILE_NAME
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: UsdAssetResolver
path: artifacts/*.zip

deploy:
runs-on: ubuntu-latest
permissions:
contents: write
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: UsdAssetResolver
path: artifacts
- name: Upload artifact as release asset
run: |
git fetch --all --tags
latest_release_tag=$(git tag -l --sort=-version:refname v* | head -1)
gh release upload $latest_release_tag artifacts/*.zip --clobber
env:
GITHUB_TOKEN: ${{ github.TOKEN }}


python3 .github/scripts/houdini.py --install
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Usd Asset Resolver
[![Deploy Documentation to GitHub Pages](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/mdbook.yml/badge.svg)](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/mdbook.yml)

[![Build USD Asset Resolvers against Houdini](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/build_houdini.yml/badge.svg)](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/build_houdini.yml)
[![Deploy Documentation to GitHub Pages](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/mdbook.yml/badge.svg)](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/mdbook.yml) [![Build USD Asset Resolvers against Houdini](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/build_houdini.yml/badge.svg)](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/build_houdini.yml)

This repository holds reference implementations for [Usd](https://openusd.org/release/index.html) [asset resolvers](https://openusd.org/release/glossary.html#usdglossary-assetresolution). The resolvers are compatible with the AR 2.0 standard proposed in the [Asset Resolver 2.0 Specification](https://openusd.org/release/wp_ar2.html). As the Usd documentation offers quite a good overview over the overall asset resolution system, we will not be covering it in this repository's documentation.

Expand Down

0 comments on commit 5bb968e

Please sign in to comment.