Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 0 additions & 86 deletions .github/actions/build-swiftusd/action.yml

This file was deleted.

67 changes: 0 additions & 67 deletions .github/actions/install-cmake/action.yml

This file was deleted.

70 changes: 70 additions & 0 deletions .github/scripts/build-openusd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#===----------------------------------------------------------------------===#
# This source file is part of github.com/apple/SwiftUsd
#
# Copyright © 2025 Apple Inc. and the SwiftUsd project authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#===----------------------------------------------------------------------===#

import argparse
import json
import os
import re
import subprocess
from swiftusd_ci_common import *

def install_cmake():
print("Downloading CMake...")
run(["curl", "-L", "https://github.com/Kitware/CMake/releases/download/v3.28.6/cmake-3.28.6-macos-universal.dmg",
"--output", "CMake.dmg"],
cwd=Environment.Path.tmp_dir, logOutput=False)

print("Verifying SHA256 checksum...")
# Hard-coded checksum taken from https://github.com/Kitware/CMake/releases/download/v3.28.6/cmake-3.28.6-SHA-256.txt,
# cmake-3.28.6-macos-universal.dmg
run(["shasum", "-a", "256", "-c"],
input="d676ca7eb85be6d39c9c7595d858c3508b4076ed2ddb229a630c8ad0f22281dd *CMake.dmg",
cwd=Environment.Path.tmp_dir)

print("Attaching DMG...")
run(["hdiutil", "attach", "CMake.dmg"], cwd=Environment.Path.tmp_dir, logOutput=False)

print("Copying CMake.app to permanent location...")
copy_src = "/Volumes/cmake-3.28.6-macos-universal/CMake.app/."
copy_dest = Environment.Path.github_workspace / "../CMake.app"
run(["cp", "-R", copy_src, copy_dest],
cwd=Environment.Path.github_workspace, logOutput=False)

print("Detaching DMG...")
run(["hdiutil", "detach", "/Volumes/cmake-3.28.6-macos-universal"])

env = os.environ.copy()
env["PATH"] = str(copy_dest / "Contents" / "bin") + ":" + env["PATH"]

print("Testing CMake is in PATH...")
run(["which", "cmake"], env=env)

return env

if __name__ == "__main__":
env = install_cmake()
clone_openusd(checkout=Environment.GitRef.openusd)
print("Patching OpenUSD...")
run(["git", "restore", "."], cwd=Environment.Path.openusd, logOutput=False)
run(["git", "clean", "-fd"], cwd=Environment.Path.openusd, logOutput=False)
run(["patch", "-p1", "-i", Environment.Path.swiftusd / "openusd-patch.patch"], cwd=Environment.Path.openusd, logOutput=False)
print("Building OpenUSD...")
run(["python3", "-u", "build_scripts/build_usd.py"] + get_openusd_build_flags(Environment.TestCombination.target_platform), env=env, cwd=Environment.Path.openusd)

46 changes: 46 additions & 0 deletions .github/scripts/compute-openusd-build-cache-key.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#===----------------------------------------------------------------------===#
# This source file is part of github.com/apple/SwiftUsd
#
# Copyright © 2025 Apple Inc. and the SwiftUsd project authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#===----------------------------------------------------------------------===#

from swiftusd_ci_common import *
import re

if __name__ == "__main__":
openusd_patch_hash = run(["shasum", "-a", "256", "./openusd-patch.patch"], cwd=Environment.Path.swiftusd, logOutput=False).output[0]
# extract the hash, dropping the file name
openusd_patch_hash = re.search(r"([0-9a-f]+)", openusd_patch_hash).groups(1)[0]
compiler_version = run(["swift", "--version"], logOutput=False).output[0]
# extract `(swiftlang VERSION clang-VERSION)`, dropping the parentheses
compiler_version = re.search(r"\((swiftlang.*)\)", compiler_version).groups(1)[0]
host_version = run(["sw_vers", "--productVersion"], logOutput=False).output[0] + "(" + run(["sw_vers", "--buildVersion"], logOutput=False).output[0] + ")"
# Turn branch names like `dev` into a hash commit to avoid incorrect cache key matches
clone_openusd()
rev_parsed_ref = run(["git", "rev-parse", Environment.GitRef.openusd], cwd=Environment.Path.openusd, logOutput=False).output[0]
build_flags = "".join(get_openusd_build_flags(Environment.TestCombination.target_platform))

result = " ".join([
Environment.TestCombination.target_platform,
compiler_version,
Environment.TestCombination.target_platform + host_version,
build_flags,
rev_parsed_ref,
openusd_patch_hash
])

printAndWrite(output=f"cache-key='{result}'")
41 changes: 41 additions & 0 deletions .github/scripts/compute-test-artifact-name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#===----------------------------------------------------------------------===#
# This source file is part of github.com/apple/SwiftUsd
#
# Copyright © 2025 Apple Inc. and the SwiftUsd project authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#===----------------------------------------------------------------------===#

from swiftusd_ci_common import *


if __name__ == "__main__":
# Artifact names cannot contain any of the following characters:
# `":<>|*?\r\n\/`
result = " ".join([
"SwiftUsd-Tests",
Environment.TestCombination.target_platform,
Environment.TestCombination.build_system,
Environment.TestCombination.config,
Environment.GitRef.swiftusd,
Environment.GitRef.openusd,
Environment.GitRef.swiftusd_tests,
Environment.TestCombination.github_run_id,
])

for c in ":<>|*?\r\n/\\":
result = result.replace(c, "")

printAndWrite(output=f"artifact_name={result}")
46 changes: 46 additions & 0 deletions .github/scripts/define-build-matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#===----------------------------------------------------------------------===#
# This source file is part of github.com/apple/SwiftUsd
#
# Copyright © 2025 Apple Inc. and the SwiftUsd project authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#===----------------------------------------------------------------------===#

from swiftusd_ci_common import *
import argparse
import json

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--targets", required=True)
args = parser.parse_args()

all_targets = ["macOS", "iOS", "iOSSimulator", "visionOS", "visionOSSimulator"]

if args.targets == "ALL":
result = all_targets
else:
result = []
for x in args.targets.split(","):
x = x.strip()
if x in all_targets:
if x not in result:
result.append(x)
else:
raise ValueError(f"Unknown target '{x}'")

result = {"target" : result}

printAndWrite(output=f"matrix={json.dumps(result)}")
Loading