Skip to content

Commit

Permalink
Update Dockerfile and add Dependabot automation (#3)
Browse files Browse the repository at this point in the history
* Update badges

Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>

* Bump derive_builder to 0.13

Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>

* Update Dockerfile

Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>

* Link only necessary libs

Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>

* Update Rust CI

Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>

* CI: Add Dependabot automation

Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>

---------

Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
  • Loading branch information
AndrejOrsula committed Mar 9, 2024
1 parent 75b7bfe commit ea827b5
Show file tree
Hide file tree
Showing 9 changed files with 349 additions and 177 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
--- ./build_scripts/build_usd.py
+++ ./build_scripts/build_usd.py
@@ -695,7 +695,7 @@
BOOST_URL = "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz"
BOOST_VERSION_FILE = "include/boost/version.hpp"
elif Linux():
- BOOST_URL = "https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.gz"
+ BOOST_URL = "https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.gz"
BOOST_VERSION_FILE = "include/boost/version.hpp"
elif Windows():
# The default installation of boost on Windows puts headers in a versioned
@@ -1166,6 +1166,10 @@

def InstallOpenEXR(context, force, buildArgs):
with CurrentWorkingDirectory(DownloadURL(OPENEXR_URL, context, force)):
+ PatchFile(
+ "OpenEXR/IlmImf/ImfTiledMisc.cpp",
+ [("#include <algorithm>\n", "#include <algorithm>\n#include <limits>\n")],
+ )
RunCMake(context, force,
['-DPYILMBASE_ENABLE=OFF',
'-DOPENEXR_VIEWERS_ENABLE=OFF',
@@ -1561,10 +1565,9 @@

def InstallAlembic(context, force, buildArgs):
with CurrentWorkingDirectory(DownloadURL(ALEMBIC_URL, context, force)):
- if MacOS():
- PatchFile("CMakeLists.txt",
- [("ADD_DEFINITIONS(-Wall -Werror -Wextra -Wno-unused-parameter)",
- "ADD_DEFINITIONS(-Wall -Wextra -Wno-unused-parameter)")])
+ PatchFile("CMakeLists.txt",
+ [("ADD_DEFINITIONS(-Wall -Werror -Wextra -Wno-unused-parameter)",
+ "ADD_DEFINITIONS(-Wall -Wextra -Wno-unused-parameter)")])
cmakeOptions = ['-DUSE_BINARIES=OFF', '-DUSE_TESTS=OFF']
if context.enableHDF5:
# HDF5 requires the H5_BUILT_AS_DYNAMIC_LIB macro be defined if
@@ -1589,6 +1592,14 @@

def InstallDraco(context, force, buildArgs):
with CurrentWorkingDirectory(DownloadURL(DRACO_URL, context, force)):
+ PatchFile(
+ "src/draco/core/hash_utils.h",
+ [("#include <functional>\n", "#include <functional>\n#include <cstddef>\n")],
+ )
+ PatchFile(
+ "src/draco/io/parser_utils.cc",
+ [("#include <iterator>\n", "#include <iterator>\n#include <limits>\n")],
+ )
cmakeOptions = [
'-DBUILD_USD_PLUGIN=ON',
]
27 changes: 27 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Dependabot automation
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot_automation:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
steps:
- name: Fetch metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve the PR
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: gh pr review --approve "$PR_URL"
- name: Enable auto-merge for the PR
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: gh pr merge --auto --merge "$PR_URL"
16 changes: 13 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ concurrency:
cancel-in-progress: true

env:
MSRV: "1.70"
CARGO_TERM_COLOR: always
SYS_LIB_PACKAGE_NAME: omniverse_sys
LIB_PACKAGE_NAME: omniverse
Expand All @@ -38,7 +39,7 @@ jobs:
fail-fast: false
matrix:
toolchain:
- "1.70" # Minimal supported Rust version (MSRV)
- MSRV
- stable
- beta
steps:
Expand All @@ -47,9 +48,18 @@ jobs:
with:
save-if: ${{ github.event_name == 'push'}}
- uses: dtolnay/rust-toolchain@master
if: ${{ matrix.toolchain != 'MSRV' && matrix.toolchain != 'stable' }}
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy
- uses: dtolnay/rust-toolchain@master
if: ${{ matrix.toolchain == 'MSRV' }}
with:
toolchain: ${{ env.MSRV }}
- uses: dtolnay/rust-toolchain@master
if: ${{ matrix.toolchain == 'stable' }}
with:
toolchain: ${{ matrix.toolchain }}
components: clippy

## Install dependencies
- run: sudo apt-get update && sudo apt-get install -yq --no-install-recommends cmake libarchive-dev libgl-dev libglu-dev libilmbase-dev libssl-dev libx11-dev libxt-dev nvidia-cuda-dev pybind11-dev
Expand Down Expand Up @@ -100,7 +110,7 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
fail_ci_if_error: false

deny:
runs-on: ubuntu-latest
Expand Down
13 changes: 6 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ cpp_build = { version = "0.5" }
ctor = { version = "0.2" }
cxx = { version = "1.0", default_features = false, features = ["std", "c++17"] }
cxxbridge-flags = { version = "1.0", default_features = false }
derive_builder = { version = "0.12" }
derive_builder = { version = "0.13" }
once_cell = { version = "1.18" }
pxr = { version = "0.1" }
python-config-rs = { version = "0.1" }
semver = { version = "1" }
thiserror = { version = "1.0" }
urlencoding = { version = "2" }
Expand Down
131 changes: 108 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Base image <https://hub.docker.com/_/ubuntu>
ARG BASE_IMAGE_NAME="ubuntu"
ARG BASE_IMAGE_TAG="jammy"
FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} AS base
FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG}

### Use bash as the default shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand All @@ -10,31 +10,90 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN echo "#!/usr/bin/env bash" >> /entrypoint.bash && \
chmod +x /entrypoint.bash

### Install Rust
ARG RUST_VERSION="1.74"
RUN apt-get update && \
### Build OpenUSD
ARG OPENUSD_VERSION="22.11"
COPY ./.docker/internal/pxr_sys/patches/src/build_scripts/build_usd.py.patch /tmp/build_usd.py.patch
# hadolint ignore=SC2016
RUN OPENUSD_DL_PATH="/tmp/OpenUSD-${OPENUSD_VERSION}.tar.gz" && \
OPENUSD_SRC_DIR="/tmp/OpenUSD-${OPENUSD_VERSION}" && \
OPENUSD_INSTALL_DIR="${HOME}/openusd" && \
echo -e "\n# OpenUSD ${OPENUSD_VERSION}" >> /entrypoint.bash && \
echo "export OPENUSD_PATH=\"${OPENUSD_INSTALL_DIR}\"" >> /entrypoint.bash && \
echo '# export PATH="${OPENUSD_PATH}/bin${PATH:+:${PATH}}"' >> /entrypoint.bash && \
echo '# export LD_LIBRARY_PATH="${OPENUSD_PATH}/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"' >> /entrypoint.bash && \
echo '# export PYTHONPATH="${OPENUSD_PATH}/lib/python${PYTHONPATH:+:${PYTHONPATH}}"' >> /entrypoint.bash && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
build-essential \
ca-certificates \
curl && \
clang \
cmake \
curl \
libarchive-dev \
libgl-dev \
libglfw3-dev \
libglib2.0-dev \
libglu-dev \
libglu1-mesa-dev \
libilmbase-dev \
libssl-dev \
libtbb2-dev \
libx11-dev \
libxt-dev \
pkg-config \
python3-dev \
python3-pip && \
rm -rf /var/lib/apt/lists/* && \
curl --proto "=https" --tlsv1.2 -sSfL "https://sh.rustup.rs" | sh -s -- --no-modify-path -y --default-toolchain "${RUST_VERSION}" --profile default && \
echo -e "\n# Rust ${RUST_VERSION}" >> /entrypoint.bash && \
echo "source \"${HOME}/.cargo/env\" --" >> /entrypoint.bash && \
echo "export CARGO_TARGET_DIR=\"${HOME}/ws_target\"" >> /entrypoint.bash && \
echo "export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=\"-Clink-arg=-fuse-ld=mold -Ctarget-cpu=native\"" >> /entrypoint.bash

### Finalize the entrypoint and source it in the ~/.bashrc
# hadolint ignore=SC2016
RUN echo -e "\n# Execute the command" >> /entrypoint.bash && \
echo -en 'exec "${@}"\n' >> /entrypoint.bash && \
echo -e "\n# Source the entrypoint" >> "${HOME}/.bashrc" && \
echo -en "source /entrypoint.bash --\n" >> "${HOME}/.bashrc"
ENTRYPOINT ["/entrypoint.bash"]
python3 -m pip install --no-cache-dir PyOpenGL==3.1.7 pyside6==6.6.0 && \
curl --proto "=https" --tlsv1.2 -sSfL "https://github.com/PixarAnimationStudios/OpenUSD/archive/refs/tags/v${OPENUSD_VERSION}.tar.gz" -o "${OPENUSD_DL_PATH}" && \
mkdir -p "${OPENUSD_SRC_DIR}" && \
tar xf "${OPENUSD_DL_PATH}" -C "${OPENUSD_SRC_DIR}" --strip-components=1 && \
rm "${OPENUSD_DL_PATH}" && \
if [[ "${OPENUSD_VERSION}" = "22.11" ]]; then \
patch --unified --strip=1 --batch --follow-symlinks --ignore-whitespace --input=/tmp/build_usd.py.patch --directory="${OPENUSD_SRC_DIR}" ; \
fi && \
rm /tmp/build_usd.py.patch && \
python3 "${OPENUSD_SRC_DIR}/build_scripts/build_usd.py" \
--build-shared \
--build-variant=release --prefer-speed-over-safety \
--use-cxx11-abi=0 \
--build-args USD,"-DPXR_LIB_PREFIX=lib" \
--no-tests --no-examples --no-tutorials --no-tools --no-docs \
--usdview \
--python --no-debug-python \
--usd-imaging \
--no-ptex \
--openvdb \
--no-embree \
--no-prman \
--no-openimageio \
--no-opencolorio \
--alembic \
--no-hdf5 \
--draco \
--materialx \
"${OPENUSD_INSTALL_DIR}" && \
rm -rf "${OPENUSD_SRC_DIR}" "${OPENUSD_INSTALL_DIR}/src"

### Configure the workspace
ARG WORKSPACE="/root/ws"
ENV WORKSPACE="${WORKSPACE}"
WORKDIR ${WORKSPACE}
### Download Carbonite
ARG CARB_APP_REDOWNLOAD_VERSION="105.1.2"
ARG CARB_APP_REDOWNLOAD_BUILD_HASH="release.133510.b82c1e1e"
ARG CARB_APP_REDOWNLOAD_URL="https://d4i3qtqj3r0z5.cloudfront.net/kit-sdk%40${CARB_APP_REDOWNLOAD_VERSION}%2B${CARB_APP_REDOWNLOAD_BUILD_HASH}.tc.linux-x86_64.release.7z"
ARG CARB_APP_PATH="/root/carb_app"
RUN echo -e "\n# Carb app ${CARB_APP_REDOWNLOAD_VERSION}" >> /entrypoint.bash && \
echo "export CARB_APP_PATH=\"${CARB_APP_PATH}\"" >> /entrypoint.bash && \
echo "# source \"${CARB_APP_PATH}/setup_python_env.sh\" --" >> /entrypoint.bash && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
ca-certificates \
curl \
p7zip-full && \
rm -rf /var/lib/apt/lists/* && \
rm -rf "${CARB_APP_PATH}" && \
CARB_APP_DL_PATH="/tmp/kit-sdk-${CARB_APP_REDOWNLOAD_VERSION}+${CARB_APP_REDOWNLOAD_BUILD_HASH}.tc.linux-x86_64.release.7z" && \
curl --proto "=https" --tlsv1.2 -sSfL "${CARB_APP_REDOWNLOAD_URL}" -o "${CARB_APP_DL_PATH}" && \
7z x "${CARB_APP_DL_PATH}" -o"${CARB_APP_PATH}" && \
rm "${CARB_APP_DL_PATH}"

### Install dependencies
RUN apt-get update && \
Expand All @@ -49,13 +108,39 @@ RUN apt-get update && \
libssl-dev \
libx11-dev \
libxt-dev \
mold \
nvidia-cuda-dev \
pkg-config \
pybind11-dev \
python3-dev && \
rm -rf /var/lib/apt/lists/*

### Install Rust
ARG RUST_VERSION="1.75"
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
ca-certificates \
curl \
mold && \
rm -rf /var/lib/apt/lists/* && \
curl --proto "=https" --tlsv1.2 -sSfL "https://sh.rustup.rs" | sh -s -- --no-modify-path -y --default-toolchain "${RUST_VERSION}" --profile default && \
echo -e "\n# Rust ${RUST_VERSION}" >> /entrypoint.bash && \
echo "source \"${HOME}/.cargo/env\" --" >> /entrypoint.bash && \
echo "export CARGO_TARGET_DIR=\"${HOME}/ws_target\"" >> /entrypoint.bash && \
echo "export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=\"-Clink-arg=-fuse-ld=mold -Ctarget-cpu=native\"" >> /entrypoint.bash

### Finalize the entrypoint and source it in the ~/.bashrc
# hadolint ignore=SC2016
RUN echo -e "\n# Execute the command" >> /entrypoint.bash && \
echo -en 'exec "${@}"\n' >> /entrypoint.bash && \
echo -e "\n# Source the entrypoint" >> "${HOME}/.bashrc" && \
echo -en "source /entrypoint.bash --\n" >> "${HOME}/.bashrc"
ENTRYPOINT ["/entrypoint.bash"]

### Configure the workspace
ARG WORKSPACE="/root/ws"
ENV WORKSPACE="${WORKSPACE}"
WORKDIR ${WORKSPACE}

### Copy the source
COPY . "${WORKSPACE}"

Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# omniverse_rs

<p align="left">
<a href="https://crates.io/crates/omniverse"> <img alt="crates.io" src="https://img.shields.io/crates/v/omniverse.svg"></a>
<a href="https://github.com/AndrejOrsula/omniverse_rs/actions/workflows/rust.yml"> <img alt="Rust" src="https://github.com/AndrejOrsula/omniverse_rs/actions/workflows/rust.yml/badge.svg"></a>
<a href="https://github.com/AndrejOrsula/omniverse_rs/actions/workflows/docker.yml"> <img alt="Docker" src="https://github.com/AndrejOrsula/omniverse_rs/actions/workflows/docker.yml/badge.svg"></a>
<a href="https://codecov.io/gh/AndrejOrsula/omniverse_rs"> <img alt="codecov" src="https://codecov.io/gh/AndrejOrsula/omniverse_rs/branch/main/graph/badge.svg"></a>
<a href="https://crates.io/crates/omniverse"> <img alt="crates.io" src="https://img.shields.io/crates/v/omniverse.svg"></a>
<!-- <a href="https://docs.rs/omniverse"> <img alt="docs.rs" src="https://docs.rs/omniverse/badge.svg"></a> -->
<a href="https://github.com/AndrejOrsula/omniverse_rs/actions/workflows/rust.yml"> <img alt="Rust" src="https://github.com/AndrejOrsula/omniverse_rs/actions/workflows/rust.yml/badge.svg"></a>
<a href="https://github.com/AndrejOrsula/omniverse_rs/actions/workflows/docker.yml"> <img alt="Docker" src="https://github.com/AndrejOrsula/omniverse_rs/actions/workflows/docker.yml/badge.svg"></a>
<a href="https://deps.rs/repo/github/AndrejOrsula/omniverse_rs"> <img alt="deps.rs" src="https://deps.rs/repo/github/AndrejOrsula/omniverse_rs/status.svg"></a>
<a href="https://codecov.io/gh/AndrejOrsula/omniverse_rs"> <img alt="codecov.io" src="https://codecov.io/gh/AndrejOrsula/omniverse_rs/branch/main/graph/badge.svg"></a>

</p>

Rust interface for NVIDIA [Omniverse](https://www.nvidia.com/en-us/omniverse).
Expand Down
1 change: 0 additions & 1 deletion omniverse_sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ bindgen = { workspace = true }
built_different = { workspace = true }
cpp_build = { workspace = true }
pxr = { workspace = true }
python-config-rs = { workspace = true }
urlencoding = { workspace = true }
walkdir = { workspace = true }

Expand Down

0 comments on commit ea827b5

Please sign in to comment.