Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pablode committed Jul 31, 2024
1 parent caffd8f commit 7b4f71e
Show file tree
Hide file tree
Showing 3 changed files with 232 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/_build-usd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build gatling for USD

on:
workflow_call:
outputs:
archive-name:
description: "Name of the archive containing the build artifacts"
value: build-${{ inputs.build-config }}-${{ github.sha }}
inputs:
build-config:
description: "Name of the CMake build configuration"
required: false
type: string
default: "Release"
usd-version:
description: "Name of the USD release, in the form 'XX.XX'"
required: true
type: string
mdl-sdk-cache-key-prefix:
description: "Prefix of the MDL SDK cache key"
required: false
type: string
default: "MDL-SDK"
upload-archives:
description: "Whether build results should be uploaded or not"
required: false
type: boolean
default: false

jobs:
build:
name: Build USD v${{ inputs.usd-version }} for ${{ matrix.name }} (${{ inputs.build-config }})

strategy:
matrix:
include:
- name: Ubuntu / clang
image: ubuntu-20.04
usd-download-url: "https://github.com/pablode/USD/releases/download/v${{ inputs.usd-version }}-ci-release/USD${{ inputs.usd-version }}_Linux_x64.tar.gz"
usd-install-path: "/home/runner/work/USD/USD/INSTALL"
upload-archive: false
cmake-params: -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++

uses: ./.github/workflows/_build.yml
with:
image: ${{ matrix.image }}
build-config: ${{ inputs.build-config }}
usd-download-url: ${{ matrix.usd-download-url }}
usd-install-path: ${{ matrix.usd-install-path }}
upload-archive: ${{ matrix.upload-archive }}
archive-name: build-${{ inputs.build-config }}-${{ github.sha }}
archive-file-name: ${{ matrix.archive-file-name }}
mdl-sdk-cache-key: ${{ inputs.mdl-sdk-cache-key-prefix }}_${{ matrix.image }}
cmake-params: ${{ matrix.cmake-params }}
155 changes: 155 additions & 0 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: Build gatling

on:
workflow_call:
inputs:
image:
required: true
type: string
build-config:
required: true
type: string
# Must match CI installation path (see USD issue #1025)
usd-download-url:
required: true
type: string
usd-install-path:
required: true
type: string
upload-archive:
required: false
type: boolean
default: false
archive-name:
required: true
type: string
archive-file-name:
required: false
type: string
mdl-sdk-cache-key:
required: true
type: string
cmake-params:
required: false
type: string
houdini-packaging:
required: false
type: boolean
default: false

defaults:
run:
shell: bash

jobs:
build:
name: Build gatling
runs-on: ${{ inputs.image }}

env:
mdl-sdk-dir: "MDL-SDK/INSTALL"

steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install packages
if: runner.os == 'Linux'
run: |
# Use latest stable mesa because Storm requires OpenGL 4.6
sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt update
sudo apt upgrade
sudo apt-get install mesa-utils xvfb qt5-default libgl1-mesa-dev
- name: Fetch USD binaries
run: curl ${{ inputs.usd-download-url }} -L -v -o USD.tar.gz

- name: Unpack USD binaries
run: mkdir -p ${{ inputs.usd-install-path }} && tar -xvf USD.tar.gz -C ${{ inputs.usd-install-path }}

# We need to put the USD libs in the PATH because we build against USD's MaterialX
# distribution. The libs are shared and loaded for gi_test's ctest discovery.
- name: Set up USD environment variables (Windows)
if: runner.os == 'Windows'
run: |
echo "${{ inputs.usd-install-path }}/lib" >> $GITHUB_PATH
echo "${{ inputs.usd-install-path }}/bin" >> $GITHUB_PATH
- name: Set up environment variables (Linux)
if: runner.os == 'Linux'
run: |
echo "LD_LIBRARY_PATH=${{ inputs.usd-install-path }}/lib" >> $GITHUB_ENV
echo "DISPLAY=:1" >> $GITHUB_ENV
- name: Start virtual framebuffer
run: |
Xvfb :1 -screen 0 1280x960x24 &
- name: Test glxinfo
run: glxinfo

- name: Create temporary folders
run: mkdir BUILD INSTALL

- name: Restore MDL SDK
id: restore-mdl-sdk
uses: actions/cache/restore@v4
with:
path: "${{ env.mdl-sdk-dir }}"
key: ${{ inputs.mdl-sdk-cache-key }}
fail-on-cache-miss: true

- name: Install NASM
if: runner.os == 'Windows'
uses: ilammy/[email protected]

- name: Generate build system files using CMake
working-directory: BUILD
run: |
cmake .. \
-DUSD_ROOT=${{ inputs.usd-install-path }} \
-DMDL_ROOT=../${{ env.mdl-sdk-dir }} \
-DCMAKE_BUILD_TYPE=${{ inputs.build-config }} \
-DCMAKE_INSTALL_PREFIX="$PWD/../INSTALL" \
${{ inputs.cmake-params }}
- name: Build gatling
working-directory: BUILD
run: cmake --build . --config ${{ inputs.build-config }} -j 2 --target hdGatling gatling gi_test hdGatling_test

- name: Install gatling
working-directory: BUILD
run: cmake --install . --config ${{ inputs.build-config }} --component hdGatling

- name: Run tests
working-directory: BUILD
run: ./bin/hdGatling_test

- name: Package for Houdini
if: inputs.houdini-packaging
working-directory: INSTALL
run: |
mkdir -p dso/usd
mkdir -p dso/usd_plugins
mkdir -p soho/parameters
cp ../dist/houdini/UsdRenderers.json .
cp ../dist/houdini/HdGatlingRendererPlugin_Viewport.ds soho/parameters/
cp ../dist/houdini/plugInfo.json dso/usd_plugins/
mv hdGatling dso/usd_plugins
mv hdGatling* dso/usd
- name: Create archive
if: inputs.upload-archive
working-directory: INSTALL
run: tar -zcvf ${{ inputs.archive-file-name }} *

- name: Upload archive
if: inputs.upload-archive
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.archive-name }}
path: INSTALL/${{ inputs.archive-file-name }}
retention-days: 7
23 changes: 23 additions & 0 deletions .github/workflows/_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run Test

on:
push:
paths-ignore:
- '**.md'
- '**.glsl'

jobs:
build-mdl-sdk:
name: Build MDL SDK
uses: pablode/MDL-SDK/.github/workflows/[email protected]
with:
cache-key-prefix: ${{ vars.MDL_SDK_CACHE_KEY_PREFIX }}

build-2405:
name: Build gatling for USD v24.05 (Release)
needs: build-mdl-sdk
uses: ./.github/workflows/_build-usd.yml
with:
usd-version: 24.05
mdl-sdk-cache-key-prefix: ${{ vars.MDL_SDK_CACHE_KEY_PREFIX }}

0 comments on commit 7b4f71e

Please sign in to comment.