Skip to content

Commit

Permalink
Add Houdini Python 39/37 build support
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaScheller committed Feb 24, 2024
1 parent 36a6926 commit 860885c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 22 deletions.
32 changes: 21 additions & 11 deletions .github/scripts/houdini.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,23 @@ def download_sidefx_product_release(dir_path, release):
return download_file_path


def install_sidefx_houdini(houdini_version):
def install_sidefx_product(product, version):
"""Install the latest production release of Houdini
Args:
houdini_version (str): The target Houdini version (e.g. 20.0, 19.5, etc.)
product (str): The target product name (e.g. houdini, houdini-py39, etc.)
version (str|None): The target product version (e.g. 20.0, 19.5, etc.)
"""
# Connect to SideFX API
logging.info("Connecting to SideFX API")
sidefx_service = create_sidefx_service(SIDEFX_CLIENT_ID, SIDEFX_CLIENT_SECRET_KEY)
sidefx_platform = get_sidefx_platform()
sidefx_product = "houdini"
sidefx_product_name = product
sidefx_product_version = version

# Get release data
releases_list = sidefx_service.download.get_daily_builds_list(
product=sidefx_product,
version=houdini_version,
product=sidefx_product_name,
version=sidefx_product_version,
platform=sidefx_platform,
only_production=True,
)
Expand Down Expand Up @@ -230,14 +232,16 @@ def install_sidefx_houdini(houdini_version):
os.symlink(hfs_dir_path, hfs_symlink_dir_path)


def create_sidefx_houdini_artifact(artifact_src, artifact_dst, artifact_prefix):
def create_sidefx_houdini_artifact(artifact_src, artifact_dst, artifact_prefix, artifact_product_name):
"""Create a .zip artifact based on the source directory content.
The output name will have will end in the houdini build name.
Args:
artifact_src (str): The source directory
artifact_dst (str): The target directory
artifact_prefix (str): The file name prefix, the suffix will be the Houdini build name
artifact_product_name (str): The file name product name.
This defines the Houdini product name, e.g. like houdini-py39
Returns:
str: The artifact file path
"""
Expand All @@ -256,7 +260,7 @@ def create_sidefx_houdini_artifact(artifact_src, artifact_dst, artifact_prefix):
)
hfs_build_name = re_digitdot.sub("", hfs_build_name)
artifact_file_path = os.path.join(
artifact_dst, f"{artifact_prefix}_houdini-{hfs_build_name}-{sidefx_platform}"
artifact_dst, f"{artifact_prefix}_{artifact_product_name}-{hfs_build_name}-{sidefx_platform}"
)
artifact_dir_path = os.path.dirname(artifact_file_path)
if not os.path.exists(artifact_dir_path):
Expand All @@ -269,20 +273,26 @@ def create_sidefx_houdini_artifact(artifact_src, artifact_dst, artifact_prefix):
parser = argparse.ArgumentParser()
parser.add_argument("--install", action="store_true", help="Install Houdini")
parser.add_argument(
"--install_version",
help="Houdini version to install. If not provided, fallback to the latest version.",
"--install_houdini_product_name",
help="Houdini product name to install. If not provided, fallback to the default.",
)
parser.add_argument(
"--install_houdini_product_version",
help="Houdini product version to install. If not provided, fallback to the latest version.",
)
parser.add_argument("--artifact", action="store_true", help="Create artifact")
parser.add_argument("--artifact_src", help="Artifact source directory")
parser.add_argument("--artifact_dst", help="Artifact target directory")
parser.add_argument("--artifact_prefix", help="Artifact name prefix")
parser.add_argument("--artifact_product_name", help="Artifact product name")
args = parser.parse_args()
# Execute
# Install Houdini
if args.install:
install_sidefx_houdini(args.install_version)
install_sidefx_product(args.install_houdini_product_name,
args.install_houdini_product_version)
# Create artifact tagged with Houdini build name (expects Houdini to be installed via the above install command)
if args.artifact:
create_sidefx_houdini_artifact(
args.artifact_src, args.artifact_dst, args.artifact_prefix
args.artifact_src, args.artifact_dst, args.artifact_prefix, args.artifact_product_name
)
40 changes: 29 additions & 11 deletions .github/workflows/build_houdini.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ jobs:
environment: houdini
strategy:
matrix:
houdini_version: ["19.5", "20.0"]
houdini_product_name: ["houdini"]
houdini_product_version: ["19.5", "20.0"]
include:
- houdini_product_name: "houdini-py39"
houdini_product_version: "20.0"
- houdini_product_name: "houdini-py37"
houdini_product_version: "19.5"
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -48,7 +54,7 @@ jobs:
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 --install_version ${{ matrix.houdini_version }}
sudo --preserve-env python3 .github/scripts/houdini.py --install --install_houdini_product_name ${{ matrix.houdini_product_name }} --install_houdini_product_version ${{ matrix.houdini_product_version }}
- name: Build USD File Resolver
run: |
.github/scripts/houdini_build.sh fileResolver
Expand All @@ -64,19 +70,25 @@ jobs:
- name: Create single .zip archive
run: |
repo_root=$(cd .; pwd)
python3 .github/scripts/houdini.py --artifact --artifact_src=$repo_root/dist --artifact_dst=$repo_root/artifacts --artifact_prefix=UsdAssetResolver
python3 .github/scripts/houdini.py --artifact --artifact_src=$repo_root/dist --artifact_dst=$repo_root/artifacts --artifact_prefix=UsdAssetResolver --artifact_product_name ${{ matrix.houdini_product_name }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: UsdAssetResolver-Linux-Houdini-${{ matrix.houdini_version }}
name: UsdAssetResolver-linux-${{ matrix.houdini_product_name }}-${{ matrix.houdini_product_version }}
path: artifacts/*.zip

build_windows:
runs-on: windows-2019
environment: houdini
strategy:
matrix:
houdini_version: ["19.5", "20.0"]
houdini_product_name: ["houdini"]
houdini_product_version: ["19.5", "20.0"]
include:
- houdini_product_name: "houdini-py39"
houdini_product_version: "20.0"
- houdini_product_name: "houdini-py37"
houdini_product_version: "19.5"
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -102,7 +114,7 @@ jobs:
SIDEFX_CLIENT_ID: '${{ secrets.SIDEFX_CLIENT_ID }}'
SIDEFX_CLIENT_SECRET_KEY: '${{ secrets.SIDEFX_CLIENT_SECRET_KEY }}'
run: |
python3 .github\scripts\houdini.py --install --install_version ${{ matrix.houdini_version }}
python3 .github\scripts\houdini.py --install --install_houdini_product_name ${{ matrix.houdini_product_name }} --install_houdini_product_version ${{ matrix.houdini_product_version }}
- name: Build USD File Resolver
run: |
.\.github\scripts\houdini_build.bat fileResolver
Expand All @@ -117,11 +129,11 @@ jobs:
.\.github\scripts\houdini_build.bat httpResolver
- name: Create single .zip archive
run: |
& python $pwd\.github\scripts\houdini.py --artifact --artifact_src=$pwd\dist --artifact_dst=$pwd\artifacts --artifact_prefix=UsdAssetResolver
& python $pwd\.github\scripts\houdini.py --artifact --artifact_src=$pwd\dist --artifact_dst=$pwd\artifacts --artifact_prefix=UsdAssetResolver --artifact_product_name ${{ matrix.houdini_product_name }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: UsdAssetResolver-Windows-Houdini-${{ matrix.houdini_version }}
name: UsdAssetResolver-windows-${{ matrix.houdini_product_name }}-${{ matrix.houdini_product_version }}
path: artifacts/*.zip

deploy:
Expand All @@ -131,8 +143,14 @@ jobs:
needs: [build_linux, build_windows]
strategy:
matrix:
os: ["Linux", "Windows"]
houdini_version: ["19.5", "20.0"]
os: ["linux", "windows"]
houdini_product_name: ["houdini"]
houdini_product_version: ["19.5", "20.0"]
include:
- houdini_product_name: "houdini-py39"
houdini_product_version: "20.0"
- houdini_product_name: "houdini-py37"
houdini_product_version: "19.5"
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -141,7 +159,7 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: UsdAssetResolver-${{ matrix.os }}-Houdini-${{ matrix.houdini_version }}
name: UsdAssetResolver-${{ matrix.os }}-${{ matrix.houdini_product_name }}-${{ matrix.houdini_product_version }}
path: artifacts
- name: Upload artifacts as release assets
run: |
Expand Down

0 comments on commit 860885c

Please sign in to comment.