From 025ebab1ca002f41c6e620943f42a125661abd67 Mon Sep 17 00:00:00 2001 From: moudgils <47460854+moudgils@users.noreply.github.com> Date: Sat, 9 Sep 2023 15:42:07 -0700 Subject: [PATCH 01/13] Add support for a new android's 3p vulkan validaiton lib (#213) * Add support for a new android's 3p vulkan validaiton lib Signed-off-by: moudgils <47460854+moudgils@users.noreply.github.com> * Addressed feedback Signed-off-by: moudgils <47460854+moudgils@users.noreply.github.com> * Update package-system/vulkan-validationlayers/Findvulkan-validationlayers.cmake Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Signed-off-by: moudgils <47460854+moudgils@users.noreply.github.com> --------- Signed-off-by: moudgils <47460854+moudgils@users.noreply.github.com> Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> --- .../Findvulkan-validationlayers.cmake | 7 ++++++- .../vulkan-validationlayers/build_config.json | 12 +++++++++++- package_build_list_host_windows.json | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/package-system/vulkan-validationlayers/Findvulkan-validationlayers.cmake b/package-system/vulkan-validationlayers/Findvulkan-validationlayers.cmake index 82f2f985..574e93cb 100644 --- a/package-system/vulkan-validationlayers/Findvulkan-validationlayers.cmake +++ b/package-system/vulkan-validationlayers/Findvulkan-validationlayers.cmake @@ -16,9 +16,14 @@ endif() set(PATH_TO_DLL ${CMAKE_CURRENT_LIST_DIR}/vulkan-validationlayers/lib/release) set(_DLL_NAME ${PATH_TO_DLL}/${CMAKE_SHARED_LIBRARY_PREFIX}VkLayer_khronos_validation${CMAKE_SHARED_LIBRARY_SUFFIX}) -set(${MY_NAME}_RUNTIME_JSON_DEPENDENCIES ${PATH_TO_DLL}/VkLayer_khronos_validation.json) +if (${PAL_PLATFORM_NAME} STREQUAL "Windows") + set(${MY_NAME}_RUNTIME_JSON_DEPENDENCIES ${PATH_TO_DLL}/VkLayer_khronos_validation.json) +else() + set(${MY_NAME}_RUNTIME_JSON_DEPENDENCIES "") +endif() add_library(${TARGET_WITH_NAMESPACE} INTERFACE IMPORTED GLOBAL) + ly_add_target_files( TARGETS ${TARGET_WITH_NAMESPACE} diff --git a/package-system/vulkan-validationlayers/build_config.json b/package-system/vulkan-validationlayers/build_config.json index 73600337..53c98399 100644 --- a/package-system/vulkan-validationlayers/build_config.json +++ b/package-system/vulkan-validationlayers/build_config.json @@ -20,7 +20,17 @@ "custom_install_cmd": [ "install_vulkan_validation_windows.cmd" ] - } + }, + "Android":{ + "additional_download_packages":[ + [ "https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/download/sdk-1.3.261.0/android-binaries-sdk-1.3.261.0-android.zip", "28392f898378636eac76d78b1e18260b91b9688cbfe7b5b264b52a9136ea69c1", "sha256" ] + ], + "cmake_find_source":"Findvulkan-validationlayers.cmake", + "cmake_find_target":"Findvulkan-validationlayers.cmake", + "custom_install_cmd": [ + "install_vulkan_validation_android.cmd" + ] + } }, "Linux":{ "Linux":{ diff --git a/package_build_list_host_windows.json b/package_build_list_host_windows.json index 14b01ce6..f187a823 100644 --- a/package_build_list_host_windows.json +++ b/package_build_list_host_windows.json @@ -60,6 +60,7 @@ "tiff-4.2.0.15-rev4-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/tiff --platform-name Android --package-root ../../package-system --clean", "v-hacd-2.3-1a49edf-rev1-windows": "package-system/v-hacd/build_package_image.py --platform-name windows", "vulkan-validationlayers-1.3.261-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/vulkan-validationlayers --platform-name Windows --package-root ../../package-system --clean", + "vulkan-validationlayers-1.3.261-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/vulkan-validationlayers --platform-name Android --package-root ../../package-system --clean", "zlib-1.2.11-rev5-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Android --package-root ../../package-system --clean", "zlib-1.2.11-rev5-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Windows --package-root ../../package-system --clean" }, @@ -130,6 +131,7 @@ "tiff-4.2.0.15-rev4-android": "package-system/tiff-android", "v-hacd-2.3-1a49edf-rev1-windows": "package-system/v-hacd-windows", "vulkan-validationlayers-1.3.261-rev1-windows": "package-system/vulkan-validationlayers-windows", + "vulkan-validationlayers-1.3.261-rev1-android": "package-system/vulkan-validationlayers-android", "xxhash-0.7.4-rev1-multiplatform": "package-system/xxhash-multiplatform", "zlib-1.2.11-rev5-android": "package-system/zlib-android", "zlib-1.2.11-rev5-windows": "package-system/zlib-windows", From f2df42bcb69aea2e56a9a19bd7274960e737e644 Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Mon, 18 Sep 2023 20:06:54 -0700 Subject: [PATCH 02/13] Apply Fix for Qt running in Snap Packages (#214) - Apply fix for QDesktopServices/linux to fix issue with Snap confinements (https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1876237) - Remove openssl dependency since its no longer used - Minor script fixes - Update rev numbers for Linux (and aarch64) - Fix the 'custom_install_cmd' for Qt to reflect updates on how custom scripts are interpreted in the build config files - Add 3P OpenSSL dependency to Qt (to use O3DE static openssl instead of the system one) - Add qt patch for mac Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com> --- package-system/Qt/build-linux-aarch64.sh | 5 ++- package-system/Qt/build-linux-x86.sh | 5 ++- package-system/Qt/build-linux.sh | 20 +++++++--- package-system/Qt/build_config.json | 20 +++++----- package-system/Qt/docker_build_qt_linux.sh | 19 +++++++--- package-system/Qt/qt-linux.patch | 38 +++++++++++++++++++ .../{qt-image-format.patch => qt-mac.patch} | 0 package_build_list_host_linux-aarch64.json | 4 +- package_build_list_host_linux.json | 4 +- 9 files changed, 88 insertions(+), 27 deletions(-) create mode 100644 package-system/Qt/qt-linux.patch rename package-system/Qt/{qt-image-format.patch => qt-mac.patch} (100%) diff --git a/package-system/Qt/build-linux-aarch64.sh b/package-system/Qt/build-linux-aarch64.sh index e8bf44ed..9c66c2d6 100755 --- a/package-system/Qt/build-linux-aarch64.sh +++ b/package-system/Qt/build-linux-aarch64.sh @@ -11,7 +11,8 @@ TIFF_PACKAGE=tiff-4.2.0.15-rev3-linux-aarch64 ZLIB_PACKAGE=zlib-1.2.11-rev5-linux-aarch64 +OPENSSL_PACKAGE=OpenSSL-1.1.1t-rev1-linux-aarch64 -./build-linux.sh $TIFF_PACKAGE $ZLIB_PACKAGE || exit 1 +./build-linux.sh $TIFF_PACKAGE $ZLIB_PACKAGE $OPENSSL_PACKAGE -exit 0 +exit $? diff --git a/package-system/Qt/build-linux-x86.sh b/package-system/Qt/build-linux-x86.sh index 22d9868a..eb440e27 100755 --- a/package-system/Qt/build-linux-x86.sh +++ b/package-system/Qt/build-linux-x86.sh @@ -11,7 +11,8 @@ TIFF_PACKAGE=tiff-4.2.0.15-rev3-linux ZLIB_PACKAGE=zlib-1.2.11-rev5-linux +OPENSSL_PACKAGE=OpenSSL-1.1.1t-rev1-linux -./build-linux.sh $TIFF_PACKAGE $ZLIB_PACKAGE || exit 1 +./build-linux.sh $TIFF_PACKAGE $ZLIB_PACKAGE $OPENSSL_PACKAGE -exit 0 +exit $? diff --git a/package-system/Qt/build-linux.sh b/package-system/Qt/build-linux.sh index 3f4706da..e5530d7a 100755 --- a/package-system/Qt/build-linux.sh +++ b/package-system/Qt/build-linux.sh @@ -15,6 +15,9 @@ TIFF_FOLDER_NAME=$1 # Arg 2: The zlib package name ZLIB_FOLDER_NAME=$2 +# Arg 3: The openssl package name +OPENSSL_FOLDER_NAME=$3 + # Make sure docker is installed DOCKER_VERSION=$(docker --version) if [ $? -ne 0 ] @@ -51,7 +54,7 @@ fi # Run the Docker Image echo "Running docker build script" -docker run -v $TEMP_FOLDER/src:/data/workspace/src -v $TEMP_FOLDER/$TIFF_FOLDER_NAME:/data/workspace/$TIFF_FOLDER_NAME -v $TEMP_FOLDER/$ZLIB_FOLDER_NAME:/data/workspace/$ZLIB_FOLDER_NAME --tty ${DOCKER_IMAGE_NAME}:latest ./docker_build_qt_linux.sh +docker run -v $TEMP_FOLDER/src:/data/workspace/src -v $TEMP_FOLDER/$TIFF_FOLDER_NAME:/data/workspace/o3de_tiff -v $TEMP_FOLDER/$ZLIB_FOLDER_NAME:/data/workspace/o3de_zlib -v $TEMP_FOLDER/$OPENSSL_FOLDER_NAME:/data/workspace/o3de_openssl --tty ${DOCKER_IMAGE_NAME}:latest ./docker_build_qt_linux.sh if [ $? -ne 0 ] then echo "Error occurred running Docker image ${DOCKER_IMAGE_NAME}:latest." @@ -71,20 +74,27 @@ fi # Copy the build artifacts from the Docker Container echo "Copying the built contents from the docker container for image ${DOCKER_IMAGE_NAME}" -docker cp --quiet $CONTAINER_ID:/data/workspace/qt/. $TARGET_INSTALL_ROOT +docker cp $CONTAINER_ID:/data/workspace/qt/. $TARGET_INSTALL_ROOT if [ $? -ne 0 ] then echo "Error occurred copying build artifacts from Docker image ${DOCKER_IMAGE_NAME}:latest." exit 1 fi - # Clean up the docker image and container echo "Cleaning up container" -docker container rm $CONTAINER_ID || (echo "Warning: Unable to clean up container for image ${DOCKER_IMAGE_NAME}") +docker container rm $CONTAINER_ID +if [ $? -ne 0 ] +then + echo "Warning: Unable to clean up container for image ${DOCKER_IMAGE_NAME}" +fi echo "Cleaning up image" -docker rmi --force $IMAGE_ID || (echo "Warning: Unable to clean up image ${DOCKER_IMAGE_NAME}") +docker rmi --force $IMAGE_ID +if [ $? -ne 0 ] +then + echo "Warning: Unable to clean up image ${DOCKER_IMAGE_NAME}" +fi popd diff --git a/package-system/Qt/build_config.json b/package-system/Qt/build_config.json index 7c867f46..b996304c 100644 --- a/package-system/Qt/build_config.json +++ b/package-system/Qt/build_config.json @@ -26,7 +26,7 @@ "build-windows.bat" ], "custom_install_cmd": [ - "copy_platform_cmakes.py" + "{python}", "copy_platform_cmakes.py" ] } }, @@ -34,7 +34,7 @@ "Mac": { "cmake_find_source": "FindQt.cmake.mac", "package_version": "5.15.2-rev8", - "patch_file": "qt-image-format.patch", + "patch_file": "qt-mac.patch", "depends_on_packages": [ ["tiff-4.2.0.15-rev3-mac", "c2615ccdadcc0e1d6c5ed61e5965c4d3a82193d206591b79b805c3b3ff35a4bf", ""], ["zlib-1.2.11-rev5-mac", "b6fea9c79b8bf106d4703b67fecaa133f832ad28696c2ceef45fb5f20013c096", ""] @@ -43,15 +43,16 @@ "./build-darwin.sh" ], "custom_install_cmd": [ - "{python} copy_platform_cmakes.py" + "{python}", "copy_platform_cmakes.py" ] } }, "Linux": { "Linux": { - "package_version": "5.15.2-rev8", - "patch_file": "qt-image-format.patch", + "package_version": "5.15.2-rev9", + "patch_file": "qt-linux.patch", "depends_on_packages": [ + ["OpenSSL-1.1.1t-rev1-linux", "63aea898b7afe8faccd0c7261e62d2f8b7b870f678a4520d5be81e5815542b39", ""], ["tiff-4.2.0.15-rev3-linux", "2377f48b2ebc2d1628d9f65186c881544c92891312abe478a20d10b85877409a", ""], ["zlib-1.2.11-rev5-linux", "9be5ea85722fc27a8645a9c8a812669d107c68e6baa2ca0740872eaeb6a8b0fc", ""] ], @@ -59,13 +60,14 @@ "./build-linux-x86.sh" ], "custom_install_cmd": [ - "{python} copy_platform_cmakes.py" + "{python}", "copy_platform_cmakes.py" ] }, "Linux-aarch64": { - "package_version": "5.15.2-rev8", - "patch_file": "qt-image-format.patch", + "package_version": "5.15.2-rev9", + "patch_file": "qt-linux.patch", "depends_on_packages": [ + ["OpenSSL-1.1.1t-rev1-linux-aarch64", "f32721bec9c82d1bd7fb244d78d5dc4e2a47e7b808bb36027236ad377e241ea5", ""], ["tiff-4.2.0.15-rev3-linux-aarch64", "429461014b21a530dcad597c2d91072ae39d937a04b7bbbf5c34491c41767f7f", ""], ["zlib-1.2.11-rev5-linux-aarch64", "ce9d1ed2883d77ffc69c7982c078595c1f89ca55ec19d89fe7e6beb05f774775", ""] ], @@ -73,7 +75,7 @@ "./build-linux-aarch64.sh" ], "custom_install_cmd": [ - "{python} copy_platform_cmakes.py" + "{python}", "copy_platform_cmakes.py" ] } } diff --git a/package-system/Qt/docker_build_qt_linux.sh b/package-system/Qt/docker_build_qt_linux.sh index 8c7ecf30..84cc65f1 100755 --- a/package-system/Qt/docker_build_qt_linux.sh +++ b/package-system/Qt/docker_build_qt_linux.sh @@ -10,8 +10,9 @@ # TEMP_FOLDER and TARGET_INSTALL_ROOT get set from the pull_and_build_from_git.py script # Read the dependent 3P library paths from the arguments -TIFF_PACKAGE_DIR=$1 -ZLIB_PACKAGE_DIR=$2 +TIFF_PACKAGE_DIR=/data/workspace/o3de_tiff +ZLIB_PACKAGE_DIR=/data/workspace/o3de_zlib +OPENSSL_PACKAGE_DIR=/data/workspace/o3de_openssl set -euo pipefail @@ -20,6 +21,7 @@ MAKE_FLAGS=-j32 echo "Building Qt5 from source with dependencies on" echo " " $TIFF_PACKAGE_DIR echo " " $ZLIB_PACKAGE_DIR +echo " " $OPENSSL_PACKAGE_DIR # Base the Tiff of the dependent tiff O3DE package (static) @@ -27,11 +29,16 @@ TIFF_PREFIX=$TIFF_PACKAGE_DIR/tiff TIFF_INCDIR=$TIFF_PREFIX/include TIFF_LIBDIR=$TIFF_PREFIX/lib -# We need to also bring in the zlib dependency since Tiff is a static lib dependency +# Bring in the zlib dependency since Tiff is a static lib dependency ZLIB_PREFIX=$ZLIB_PACKAGE_DIR/zlib ZLIB_INCDIR=$ZLIB_PREFIX/include ZLIB_LIBDIR=$ZLIB_PREFIX/lib +# Bring in the openssl dependency based +OPENSSL_PREFIX=$OPENSSL_PACKAGE_DIR/OpenSSL +OPENSSL_INCDIR=$OPENSSL_PREFIX/include +OPENSSL_LIBDIR=$OPENSSL_PREFIX/lib + BUILD_PATH=/data/workspace/build INSTALL_PATH=/data/workspace/qt @@ -64,12 +71,14 @@ echo Configuring Qt... -no-egl \ -qpa xcb \ -xcb-xlib \ + -openssl \ -I $TIFF_INCDIR \ -I $ZLIB_INCDIR \ + -I $OPENSSL_INCDIR \ -L $TIFF_LIBDIR \ -L $ZLIB_LIBDIR \ + -L $OPENSSL_LIBDIR \ -c++std c++1z \ - -openssl \ -fontconfig if [ $? -ne 0 ] then @@ -99,7 +108,7 @@ for qtlib in "${qtarray[@]}"; do echo Installing $qtlib... make module-$qtlib-install_subtargets - if [ ?$ -ne 0 ] + if [ $? -ne 0 ] then echo "Failed installing Qt module $qtlib" exit 1 diff --git a/package-system/Qt/qt-linux.patch b/package-system/Qt/qt-linux.patch new file mode 100644 index 00000000..0e610138 --- /dev/null +++ b/package-system/Qt/qt-linux.patch @@ -0,0 +1,38 @@ +diff --git a/qtbase/src/platformsupport/services/genericunix/qgenericunixservices.cpp b/qtbase/src/platformsupport/services/genericunix/qgenericunixservices.cpp +index b583d636c0..4615ebb126 100644 +--- a/qtbase/src/platformsupport/services/genericunix/qgenericunixservices.cpp ++++ b/qtbase/src/platformsupport/services/genericunix/qgenericunixservices.cpp +@@ -203,8 +203,7 @@ static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url) + // handle_token (s) - A string that will be used as the last element of the @handle. + // writable (b) - Whether to allow the chosen application to write to the file. + +-#ifdef O_PATH +- const int fd = qt_safe_open(QFile::encodeName(url.toLocalFile()), O_PATH); ++ const int fd = qt_safe_open(QFile::encodeName(url.toLocalFile()), O_RDONLY); + if (fd != -1) { + QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), + QLatin1String("/org/freedesktop/portal/desktop"), +@@ -219,9 +218,6 @@ static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url) + + return QDBusConnection::sessionBus().call(message); + } +-#else +- Q_UNUSED(url) +-#endif + + return QDBusMessage::createError(QDBusError::InternalError, qt_error_string()); + } + +diff --git a/qtimageformats/src/imageformats/configure.json b/qtimageformats/src/imageformats/configure.json +index 5b876c3..f2fa1cc 100644 +--- a/qtimageformats/src/imageformats/configure.json ++++ b/qtimageformats/src/imageformats/configure.json +@@ -85,7 +85,7 @@ + }, + "sources": [ + { "type": "pkgConfig", "args": "libtiff-4" }, +- { "libs": "-ltiff" } ++ { "libs": "-ltiff -lz" } + ] + }, + "webp": { diff --git a/package-system/Qt/qt-image-format.patch b/package-system/Qt/qt-mac.patch similarity index 100% rename from package-system/Qt/qt-image-format.patch rename to package-system/Qt/qt-mac.patch diff --git a/package_build_list_host_linux-aarch64.json b/package_build_list_host_linux-aarch64.json index 598db8ed..50c9b583 100644 --- a/package_build_list_host_linux-aarch64.json +++ b/package_build_list_host_linux-aarch64.json @@ -34,7 +34,7 @@ "poly2tri-7f0487a-rev1-linux-aarch64": "package-system/poly2tri/build_package_image.py --platform-name linux-aarch64", "pyside2-5.15.2.1-py3.10-rev4-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/pyside2 --platform-name Linux-aarch64 --clean", "python-3.10.5-rev4-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux-aarch64 --clean", - "qt-5.15.2-rev8-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Qt --platform-name Linux-aarch64 --clean", + "qt-5.15.2-rev9-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Qt --platform-name Linux-aarch64 --clean", "sdformat-13.5.0-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux-aarch64 --clean", "SPIRVCross-2021.04.29-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Linux-aarch64 --clean", "SQLite-3.37.2-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Linux-aarch64 --clean", @@ -75,7 +75,7 @@ "poly2tri-7f0487a-rev1-linux-aarch64": "package-system/poly2tri-linux-aarch64", "pyside2-5.15.2.1-py3.10-rev4-linux-aarch64": "package-system/pyside2/temp/pyside2-linux-aarch64", "python-3.10.5-rev4-linux-aarch64": "package-system/python/temp/python-linux-aarch64", - "qt-5.15.2-rev8-linux-aarch64": "package-system/Qt/temp/qt-linux-aarch64", + "qt-5.15.2-rev9-linux-aarch64": "package-system/Qt/temp/qt-linux-aarch64", "sdformat-13.5.0-rev1-linux-aarch64": "package-system/sdformat/temp/sdformat-linux-aarch64", "SPIRVCross-2021.04.29-rev1-linux-aarch64": "package-system/SPIRVCross/temp/SPIRVCross-linux-aarch64", "SQLite-3.37.2-rev1-linux-aarch64": "package-system/sqlite/temp/SQLite-linux-aarch64", diff --git a/package_build_list_host_linux.json b/package_build_list_host_linux.json index b4ae5f1c..3d10297d 100644 --- a/package_build_list_host_linux.json +++ b/package_build_list_host_linux.json @@ -44,7 +44,7 @@ "python-3.10.5-rev4-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux --clean", "python-3.10.5-rev4-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux-aarch64 --clean", "mikkelsen-1.0.0.4-linux": "package-system/mikkelsen/build_package_image.py", - "qt-5.15.2-rev8-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Qt --platform-name Linux --package-root ../../package-system/Qt/temp --clean", + "qt-5.15.2-rev9-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Qt --platform-name Linux --package-root ../../package-system/Qt/temp --clean", "zlib-1.2.11-rev5-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Linux --package-root ../../package-system --clean", "lz4-1.9.4-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/lz4 --platform-name Linux --package-root ../../package-system/lz4/temp --clean", "expat-2.4.2-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Linux --package-root ../../package-system/expat/temp --clean", @@ -93,7 +93,7 @@ "unwind-1.2.1-linux": "package-system/unwind-linux", "SQLite-3.37.2-rev1-linux": "package-system/SQLite-linux", "xxhash-0.7.4-rev1-multiplatform": "package-system/xxhash-multiplatform", - "qt-5.15.2-rev8-linux": "package-system/Qt/temp/qt-linux", + "qt-5.15.2-rev9-linux": "package-system/Qt/temp/qt-linux", "zlib-1.2.11-rev5-linux": "package-system/zlib-linux", "lz4-1.9.4-rev2-linux": "package-system/lz4/temp/lz4-linux", "expat-2.4.2-rev2-linux": "package-system/expat/temp/expat-linux", From a69d237537428ba1dd7eea560705c951c0f40fcf Mon Sep 17 00:00:00 2001 From: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Date: Fri, 22 Sep 2023 17:28:19 -0500 Subject: [PATCH 03/13] Fixed building of libsdformat through the 3p The cmake configure command for libsdformat contained inadvertent [added text](https://github.com/o3de/3p-package-source/commit/4e3d9ba37c1dde699febc4f64942d2b08eece587#diff-f7b9acab9d6b21567f4c1bd73f7e353a1bab0f3d418dff40569ab812928386dcR193) which was causing it to fail to configure. Updated libsdformat to build using the configuration of Release with Debug Info. The Debug Info information is then detached from the libsdformat DSO and kept as a sidecar .dbg file next to it, that will load the debug information if available. This allows the the sdformat data structures to be seen in the debugger if the `libsdformat13.so.13.5.0.dbg` file has not been moved or deleted, but also doesn't increase the size of the actual `libsdformat13.so.13.5.0` library itself. This also provides a mechanism for linux/android 3rdParty libraries to be built in release and have debug information available for users of the engine via source. But also makes it possible for the SDK build or installer to skip copying over the `.dbg` files with debug information and therefore allow the SDK to be smaller. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> --- package-system/sdformat/Dockerfile | 4 +- .../sdformat/Findsdformat.cmake.template | 19 ++- package-system/sdformat/build_config.json | 2 +- .../sdformat/docker_build_sdformat.sh | 115 +++++++++++++++++- package_build_list_host_linux-aarch64.json | 4 +- package_build_list_host_linux.json | 8 +- 6 files changed, 139 insertions(+), 13 deletions(-) diff --git a/package-system/sdformat/Dockerfile b/package-system/sdformat/Dockerfile index b834e06e..ba2a808a 100644 --- a/package-system/sdformat/Dockerfile +++ b/package-system/sdformat/Dockerfile @@ -53,7 +53,9 @@ ARG INPUT_BUILD_FOLDER=build ARG INPUT_INSTALL_FOLDER=install # Provide the default CMAKE_BUILD_TYPE for the 3rdParty -ARG INPUT_CMAKE_BUILD_TYPE=Release +# Release with debug info will be built and then the debug information +# will be detached from the .dso +ARG INPUT_CMAKE_BUILD_TYPE=RelWithDebInfo ENV WORKSPACE=/data/workspace ENV LOCAL_FILESYSTEM=$WORKSPACE/temp diff --git a/package-system/sdformat/Findsdformat.cmake.template b/package-system/sdformat/Findsdformat.cmake.template index fdfc3b57..4aee987e 100644 --- a/package-system/sdformat/Findsdformat.cmake.template +++ b/package-system/sdformat/Findsdformat.cmake.template @@ -28,6 +28,8 @@ set($${LIB_NAME}_INCLUDE_DIRECTORIES $${$${LIB_NAME}_INCLUDE_DIR_ROOT} $${$${LIB_NAME}_INCLUDE_DIR_ROOT}/gz/$${LIB_NAME}$${LIB_VERSION_MAJOR}) set($${LIB_NAME}_LIBS_DIR $${CMAKE_CURRENT_LIST_DIR}/$${LIB_NAME}/lib) set($${LIB_NAME}_LIBRARY_RELEASE $${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${LIB_NAME}$${LIB_VERSION_MAJOR}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${LIB_VERSION_FULL}) +# The path to the dbg symbol file +set($${LIB_NAME}_LIBRARY_RELEASE_DBG "$${$${LIB_NAME}_LIBRARY_RELEASE}.dbg") add_library($${SDFORMAT_O3DE_NAMESPACE} SHARED IMPORTED GLOBAL) # If the find script is being called in an O3DE context use @@ -50,14 +52,17 @@ if (COMMAND ly_add_target_files) ly_add_target_files(TARGETS $${SDFORMAT_O3DE_NAMESPACE} FILES "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${LIB_NAME}$${LIB_VERSION_MAJOR}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${LIB_VERSION_MAJOR}" - "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${LIB_NAME}$${LIB_VERSION_MAJOR}$${CMAKE_SHARED_LIBRARY_SUFFIX}") + "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${LIB_NAME}$${LIB_VERSION_MAJOR}$${CMAKE_SHARED_LIBRARY_SUFFIX}" + # Copy the debug symbol .dbg into the binary directory as well + "$${$${LIB_NAME}_LIBRARY_RELEASE_DBG}" + ) endif() # Add the tinyxml2 dependency set(tinyxml2_libname "tinyxml2") set(tinyxml2_include_directories "$${$${LIB_NAME}_INCLUDE_DIR_ROOT}") # Tinyxml2 is built as a STATIC library -set(tinyxml2_lib_release "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_STATIC_LIBRARY_PREFIX}$${tinyxml2_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}") +set(tinyxml2_lib_release "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_STATIC_LIBRARY_PREFIX}$${tinyxml2_libname}$${CMAKE_STATIC_LIBRARY_SUFFIX}") # Add the 3rdParty::tinyxml2 target STATIC library set(tinyxml2_target "tinyxml2") @@ -84,6 +89,7 @@ set(gz_utils_libname "gz-$${gz_utils_raw_name}") set(gz_utils_include_directories "$${$${LIB_NAME}_INCLUDE_DIR_ROOT}/gz/$${gz_utils_raw_name}") # gz-utils is built as a SHARED library set(gz_utils_lib_release "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_utils_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${gz_utils_version_full}") +set(gz_utils_lib_release_dbg "$${gz_utils_lib_release}.dbg") # Add the 3rdParty::gz-utils target library set(gz_utils_target "gz-utils") @@ -106,7 +112,9 @@ if (COMMAND ly_add_target_files) ly_add_target_files(TARGETS $${gz_utils_target_namespace} FILES "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_utils_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${gz_utils_version_major}" - "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_utils_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}") + "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_utils_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}" + "$${gz_utils_lib_release_dbg}" + ) endif() # Add the gz-math dependency @@ -117,6 +125,7 @@ set(gz_math_libname "gz-$${gz_math_raw_name}") set(gz_math_include_directories "$${$${LIB_NAME}_INCLUDE_DIR_ROOT}/gz/$${gz_math_raw_name}") # gz-math is built as a SHARED library set(gz_math_lib_release "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_math_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${gz_math_version_full}") +set(gz_math_lib_release_dbg "$${gz_math_lib_release}.dbg") # Add the 3rdParty::gz-math target library set(gz_math_target "gz-math") @@ -139,7 +148,9 @@ if (COMMAND ly_add_target_files) ly_add_target_files(TARGETS $${gz_math_target_namespace} FILES "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_math_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${gz_math_version_major}" - "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_math_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}") + "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_math_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}" + "$${gz_math_lib_release_dbg}" + ) endif() # Add the dependent libraries as target_link_libraries diff --git a/package-system/sdformat/build_config.json b/package-system/sdformat/build_config.json index e874f52f..a05a501b 100644 --- a/package-system/sdformat/build_config.json +++ b/package-system/sdformat/build_config.json @@ -2,7 +2,7 @@ "git_url":"https://github.com/gazebosim/sdformat.git", "git_tag":"sdformat13_13.5.0", "package_name":"sdformat", - "package_version":"13.5.0-rev1", + "package_version":"13.5.0-rev2", "package_url":"https://github.com/gazebosim/sdformat.git", "package_license":"Apache-2.0", "package_license_file":"LICENSE", diff --git a/package-system/sdformat/docker_build_sdformat.sh b/package-system/sdformat/docker_build_sdformat.sh index 6e443be4..10ebd268 100755 --- a/package-system/sdformat/docker_build_sdformat.sh +++ b/package-system/sdformat/docker_build_sdformat.sh @@ -190,7 +190,7 @@ fi # instead of relying on an externally-installed package. # This keeps the dependencies self-contained. echo "Configuring ${LIB_NAME}" -CMD=(cmake -B ${BUILD_FOLDER} -S. -DCMAKE-DUSE_INTERNAL_URDF=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${INSTALL_FOLDER} -DCMAKE_PREFIX_PATH=\"${CMAKE_PREFIX_PATH}\") +CMD=(cmake -B ${BUILD_FOLDER} -S. -DUSE_INTERNAL_URDF=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${INSTALL_FOLDER} -DCMAKE_PREFIX_PATH=\"${CMAKE_PREFIX_PATH}\") # Update the RPATH to $ORIGIN to allow sdformat library to find the dependent libgz-utils/gz-math.so files on Linux CMD+=(-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE -DCMAKE_INSTALL_RPATH=\$ORIGIN) echo "${CMD[@]}" @@ -217,4 +217,117 @@ fi popd +# Finally detach the debug symbols to a separate dbg file for sdformat +echo "Detaching debug symbols for ${LIB_NAME}" +SDFORMAT_VERSION=13.5.0 +LIB_FILENAME="lib${LIB_NAME}13.so.${SDFORMAT_VERSION}" +LIB_DIRECTORY="${INSTALL_FOLDER}/lib" +LIB_PATH="${LIB_DIRECTORY}/${LIB_FILENAME}" +CMD="objcopy --only-keep-debug ${LIB_PATH} ${LIB_PATH}.dbg" +echo $CMD +eval $CMD +if [ $? -ne 0 ] +then + echo "Error detaching debug symbols for ${LIB_NAME}" + exit 1 +fi + +CMD="strip --strip-debug ${LIB_PATH}" +echo $CMD +eval $CMD +if [ $? -ne 0 ] +then + echo "Error stripping debugging symbols for ${LIB_NAME}" + exit 1 +fi + +# Change directory to the folder containing the sdformat library +pushd ${LIB_DIRECTORY} +CMD="objcopy --add-gnu-debuglink=${LIB_FILENAME}.dbg ${LIB_PATH}" +echo $CMD +eval $CMD +if [ $? -ne 0 ] +then + echo "Error adding debug symbol link for ${LIB_NAME}" + exit 1 +fi + +popd + +# Detach the debug symbols to a separate dbg file for gz-math +DEP_NAME=gz-math7 +echo "Detaching debug symbols for ${DEP_NAME}" +GZ_MATH_VERSION=7.2.0 +LIB_FILENAME="lib${DEP_NAME}.so.${GZ_MATH_VERSION}" +LIB_DIRECTORY="${GZ_MATH_INSTALL_FOLDER}/lib" +LIB_PATH="${LIB_DIRECTORY}/${LIB_FILENAME}" +CMD="objcopy --only-keep-debug ${LIB_PATH} ${LIB_PATH}.dbg" +echo $CMD +eval $CMD +if [ $? -ne 0 ] +then + echo "Error detaching debug symbols for ${DEP_NAME}" + exit 1 +fi + +CMD="strip --strip-debug ${LIB_PATH}" +echo $CMD +eval $CMD +if [ $? -ne 0 ] +then + echo "Error stripping debugging symbols for ${DEP_NAME}" + exit 1 +fi + +# Change directory to the folder containing the gz-math library +pushd ${LIB_DIRECTORY} +CMD="objcopy --add-gnu-debuglink=${LIB_FILENAME}.dbg ${LIB_PATH}" +echo $CMD +eval $CMD +if [ $? -ne 0 ] +then + echo "Error adding debug symbol link for ${DEP_NAME}" + exit 1 +fi + +popd + +# Detach the debug symbols to a separate dbg file for gz-utils +DEP_NAME=gz-utils2 +echo "Detaching debug symbols for ${DEP_NAME}" +GZ_UTILS_VERSION=2.0.0 +LIB_FILENAME="lib${DEP_NAME}.so.${GZ_UTILS_VERSION}" +LIB_DIRECTORY="${GZ_UTILS_INSTALL_FOLDER}/lib" +LIB_PATH="${LIB_DIRECTORY}/${LIB_FILENAME}" +CMD="objcopy --only-keep-debug ${LIB_PATH} ${LIB_PATH}.dbg" +echo $CMD +eval $CMD +if [ $? -ne 0 ] +then + echo "Error detaching debug symbols for ${DEP_NAME}" + exit 1 +fi + +CMD="strip --strip-debug ${LIB_PATH}" +echo $CMD +eval $CMD +if [ $? -ne 0 ] +then + echo "Error stripping debugging symbols for ${DEP_NAME}" + exit 1 +fi + +# Change directory to the folder containing the gz-utils library +pushd ${LIB_DIRECTORY} +CMD="objcopy --add-gnu-debuglink=${LIB_FILENAME}.dbg ${LIB_PATH}" +echo $CMD +eval $CMD +if [ $? -ne 0 ] +then + echo "Error adding debug symbol link for ${DEP_NAME}" + exit 1 +fi + +popd + exit 0 diff --git a/package_build_list_host_linux-aarch64.json b/package_build_list_host_linux-aarch64.json index 50c9b583..067c33a1 100644 --- a/package_build_list_host_linux-aarch64.json +++ b/package_build_list_host_linux-aarch64.json @@ -35,7 +35,7 @@ "pyside2-5.15.2.1-py3.10-rev4-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/pyside2 --platform-name Linux-aarch64 --clean", "python-3.10.5-rev4-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux-aarch64 --clean", "qt-5.15.2-rev9-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Qt --platform-name Linux-aarch64 --clean", - "sdformat-13.5.0-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux-aarch64 --clean", + "sdformat-13.5.0-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux-aarch64 --clean", "SPIRVCross-2021.04.29-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Linux-aarch64 --clean", "SQLite-3.37.2-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Linux-aarch64 --clean", "squish-ccr-deb557d-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Linux-aarch64 --clean", @@ -76,7 +76,7 @@ "pyside2-5.15.2.1-py3.10-rev4-linux-aarch64": "package-system/pyside2/temp/pyside2-linux-aarch64", "python-3.10.5-rev4-linux-aarch64": "package-system/python/temp/python-linux-aarch64", "qt-5.15.2-rev9-linux-aarch64": "package-system/Qt/temp/qt-linux-aarch64", - "sdformat-13.5.0-rev1-linux-aarch64": "package-system/sdformat/temp/sdformat-linux-aarch64", + "sdformat-13.5.0-rev2-linux-aarch64": "package-system/sdformat/temp/sdformat-linux-aarch64", "SPIRVCross-2021.04.29-rev1-linux-aarch64": "package-system/SPIRVCross/temp/SPIRVCross-linux-aarch64", "SQLite-3.37.2-rev1-linux-aarch64": "package-system/sqlite/temp/SQLite-linux-aarch64", "squish-ccr-deb557d-rev1-linux-aarch64": "package-system/squish-ccr/temp/squish-ccr-linux-aarch64", diff --git a/package_build_list_host_linux.json b/package_build_list_host_linux.json index 3d10297d..35e73333 100644 --- a/package_build_list_host_linux.json +++ b/package_build_list_host_linux.json @@ -31,8 +31,8 @@ "NvCloth-v1.1.6-4-gd243404-pr58-rev1-linux": "package-system/NvCloth/build_package_image.py --platform-name linux", "poly2tri-7f0487a-rev1-linux": "package-system/poly2tri/build_package_image.py --platform-name linux", "v-hacd-2.3-1a49edf-rev1-linux": "package-system/v-hacd/build_package_image.py --platform-name linux", - "sdformat-13.5.0-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux --clean", - "sdformat-13.5.0-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux-aarch64 --clean", + "sdformat-13.5.0-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux --clean", + "sdformat-13.5.0-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux-aarch64 --clean", "SPIRVCross-2021.04.29-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Linux --package-root ../../package-system --clean", "SQLite-3.37.2-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Linux --package-root ../../package-system --clean", "squish-ccr-deb557d-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Linux --clean", @@ -73,8 +73,8 @@ "openimageio-opencolorio-2.3.17-rev2-linux": "package-system/openimageio-opencolorio/temp/package-linux", "OpenSSL-1.1.1t-rev1-linux": "package-system/OpenSSL/temp/OpenSSL-linux", "OpenSSL-1.1.1t-rev1-linux-aarch64": "package-system/OpenSSL/temp/OpenSSL-linux-aarch64", - "sdformat-13.5.0-rev1-linux": "package-system/sdformat/temp/sdformat-linux", - "sdformat-13.5.0-rev1-linux-aarch64": "package-system/sdformat/temp/sdformat-linux-aarch64", + "sdformat-13.5.0-rev2-linux": "package-system/sdformat/temp/sdformat-linux", + "sdformat-13.5.0-rev2-linux-aarch64": "package-system/sdformat/temp/sdformat-linux-aarch64", "SPIRVCross-2021.04.29-rev1-linux": "package-system/SPIRVCross-linux", "squish-ccr-deb557d-rev1-linux": "package-system/squish-ccr/temp/squish-ccr-linux", "squish-ccr-deb557d-rev1-linux-aarch64": "package-system/squish-ccr/temp/squish-ccr-linux-aarch64", From 8097292c0cbad7f45dd9ec54b3cbe74884ca7c76 Mon Sep 17 00:00:00 2001 From: Mike Chang Date: Mon, 25 Sep 2023 10:20:35 -0700 Subject: [PATCH 04/13] Initial commit of build-container, build-package, and promote-packages Signed-off-by: Mike Chang --- .github/workflows/build-container.yaml | 49 +++++ .github/workflows/build-package.yaml | 238 ++++++++++++++++++++++++ .github/workflows/promote-packages.yaml | 155 +++++++++++++++ 3 files changed, 442 insertions(+) create mode 100644 .github/workflows/build-container.yaml create mode 100644 .github/workflows/build-package.yaml create mode 100644 .github/workflows/promote-packages.yaml diff --git a/.github/workflows/build-container.yaml b/.github/workflows/build-container.yaml new file mode 100644 index 00000000..59262275 --- /dev/null +++ b/.github/workflows/build-container.yaml @@ -0,0 +1,49 @@ +# This automation builds a aarch64 Ubuntu container +name: Build Container + +on: + # Allows you to run this workflow manually from the Actions tag + workflow_dispatch: + + push: + branches: + - main + - development + paths: + - .github/workflows/build-container.yaml + + +jobs: + build-container: + name: Build Ubuntu container for aarch64 + runs-on: ubuntu-latest + permissions: + contents: read + # We use ghcr.io to store the docker image cache for ARM builds + packages: write + steps: + - name: Run build command (aarch64) + uses: uraimo/run-on-arch-action@v2 + with: + env: | + GITHUB_WORKFLOW: ${{ github.workflow }} + SCCACHE_VER: 0.5.4 + arch: aarch64 + distro: ubuntu_latest + githubToken: ${{ github.token }} + shell: /bin/bash + install: | + apt-get update + apt-get install -y build-essential cmake curl git libssl-dev libffi-dev libbz2-dev libgdbm-compat-dev libgdbm-dev liblzma-dev libreadline-dev libtool \ + ninja-build python3 python3-pip tcl8.6-dev tk8.6-dev texinfo software-properties-common + python3 -m pip install boto3 certifi + curl -L 'https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-aarch64-unknown-linux-musl.tar.gz' \ + | tar xzf - -O --wildcards '*/sccache' > '/usr/local/bin/sccache' + chmod +x '/usr/local/bin/sccache' + run: | + lsb_release -a + uname -a + sccache --version + cmake --version + git --version + python3 --version \ No newline at end of file diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml new file mode 100644 index 00000000..79d89969 --- /dev/null +++ b/.github/workflows/build-package.yaml @@ -0,0 +1,238 @@ +# This automation builds 3p packages based on a PR + +name: Build 3P Packages + +on: + pull_request: + branches: + - main + - development + paths: + - 'package_build_list_host_*.json' + +jobs: + detect-changes: + name: Detecting changes in PR to build + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.detect-platform.outputs.matrix }} + + steps: + - name: Checkout 3P source repo + uses: actions/checkout@v4 + with: + fetch-depth: 10 + + - name: Get package and platform from JSON changes + id: detect-platform + run: | + CHANGED_FILES=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --name-only) + # Construct the package and os into a json string to be consumed by Github Actions runners + JSON="{\"include\":[" + for FILE in $CHANGED_FILES; do + if [[ $FILE == package_build_list_host_* ]]; then + PLATFORM=$(echo $FILE | sed -n 's/package_build_list_host_\(.*\).json/\1/p') + case $PLATFORM in + linux*) + OS_RUNNER="ubuntu-latest" + ;; + windows) + OS_RUNNER="windows-2019" + ;; + darwin) + OS_RUNNER="macos-latest" + ;; + *) + OS_RUNNER="windows-latest" # default + ;; + esac + + DIFF=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \ + --exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) + + if [[ $? -ne 0 ]]; then + echo No valid build change found. Exiting with non-zero + fi + + PACKAGE=$(echo $DIFF | cut -d'"' -f2) + + JSONline="{\"package\": \"$PACKAGE\", \"os\": \"$OS_RUNNER\"}," + if [[ "$JSON" != *"$JSONline"* ]]; then + JSON="$JSON$JSONline" + fi + fi + done + + # Remove last "," and add closing brackets + if [[ $JSON == *, ]]; then + JSON="${JSON%?}" + fi + JSON="$JSON]}" + echo $JSON + + # Set output + echo "matrix=$( echo "$JSON" )" >> $GITHUB_OUTPUT + + validate-changes: + name: Check changes for issues + needs: detect-changes + strategy: + fail-fast: false + matrix: ${{fromJson(needs.detect-changes.outputs.matrix)}} + runs-on: ubuntu-latest + + steps: + - name: Checkout 3P source repo + uses: actions/checkout@v4 + + - name: Check if package already exists in prod + env: + PROD_CDN: "https://d3t6xeg4fgfoum.cloudfront.net" + run: | + url="${{ env.PROD_CDN }}/${{ matrix.package }}" + if curl --head --silent --fail ${url}.tar.xz > /dev/null 2>&1; then + echo ${{ matrix.package }} already exists in prod. Check the rev in the json file to ensure it is incremented + exit 1 + else + echo ${{ matrix.package }} does not exist in CDN, continuing... + exit 0 + fi + + - name: Malware scan of repo + uses: dell/common-github-actions/malware-scanner@main + with: + directories: . + options: -r + + build-on-specific-os: + name: Build on "${{ matrix.os }}" for "${{ matrix.package }}" + needs: [detect-changes, validate-changes] + strategy: + fail-fast: false + matrix: ${{fromJson(needs.detect-changes.outputs.matrix)}} + runs-on: ${{ matrix.os }} + + steps: + - name: Configure + id: get-user + run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT + + - name: Checkout 3P source repo + uses: actions/checkout@v4 + with: + path: 3p-package-source + + - name: Checkout 3P scripts repo + uses: actions/checkout@v4 + with: + repository: o3de/3p-package-scripts + path: 3p-package-scripts + + - name: Update python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + cache: 'pip' + + - name: Install python dependancies + run: | + python3 -m pip install boto3 certifi + + - name: Update cmake/ninja + uses: lukka/get-cmake@latest + + - name: Update msbuild path + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1.12.0 + + - name: Use sccache + uses: hendrikmuhs/ccache-action@v1.2.10 + with: + variant: sccache + max-size: 2048M + key: ${{ matrix.package }}-${{ matrix.os }} + restore-keys: + ${{ matrix.package }}-${{ matrix.os }} + + - name: Run build command (windows) + if: contains(matrix.package, 'windows') + env: + CMAKE_CXX_COMPILER_LAUNCHER: sccache + CMAKE_C_COMPILER_LAUNCHER: sccache + CMAKE_GENERATOR: Ninja # ccache/sccache cannot be used as the compiler launcher under cmake if the generator is MSBuild + run: | + python3 3p-package-scripts/o3de_package_scripts/build_package.py --search_path 3p-package-source ${{ matrix.package }} + + - name: Run build command (linux/mac) + if: contains(matrix.package, 'linux') && ${{ !contains(matrix.package, 'aarch64') }} + env: + CMAKE_CXX_COMPILER_LAUNCHER: sccache + CMAKE_C_COMPILER_LAUNCHER: sccache + run: | + python3 3p-package-scripts/o3de_package_scripts/build_package.py --search_path 3p-package-source ${{ matrix.package }} + + - name: Run build command (linux aarch64) + if: contains(matrix.package, 'linux') && contains(matrix.package, 'aarch64') + uses: uraimo/run-on-arch-action@v2.5.1 + with: + arch: none + distro: none + base_image: ghcr.io/${{ github.repository }}/run-on-arch-${{ github.repository_owner }}-${{ github.event.repository.name }}-build-container-aarch64-ubuntu-latest:latest # built from build-container.yaml + setup: | + grep -q ${{ matrix.package }} ${PWD}/3p-package-source/package_build_list_host_linux.json || rm ${PWD}/3p-package-source/package_build_list_host_linux.json + dockerRunArgs: | + --platform=linux/arm64 + --user ${{ steps.get-user.outputs.uid_gid }} + --volume "${PWD}:/workspace" + --volume "${PWD}/3p-package-scripts:/scripts" + --volume "${PWD}/3p-package-source:/source" + env: | + CMAKE_CXX_COMPILER_LAUNCHER: sccache + CMAKE_C_COMPILER_LAUNCHER: sccache + SCCACHE_IDLE_TIMEOUT: 0 + SCCACHE_DIR: /workspace/.sccache + SCCACHE_CACHE_SIZE: 2048M + shell: /bin/bash + run: | + lsb_release -a + uname -a + sccache --start-server + sccache -z + ls -lah /workspace + python3 /scripts/o3de_package_scripts/build_package.py --search_path /source/ ${{ matrix.package }} + + - name: Upload packages + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.package }} + path: 3p-package-source/packages/* + + validate-packages: + name: Validating ${{ matrix.package }} + needs: [detect-changes, build-on-specific-os] + runs-on: 'ubuntu-latest' + strategy: + fail-fast: false + matrix: ${{fromJson(needs.detect-changes.outputs.matrix)}} + steps: + - name: Download packages + uses: actions/download-artifact@v3 + with: + name: ${{ matrix.package }} + + - name: Verify SHA256 + run: | + echo "$(cat ${{ matrix.package }}.tar.xz.SHA256SUMS)" + echo "$(cat ${{ matrix.package }}.tar.xz.SHA256SUMS | cut -d" " -f1) ${{ matrix.package }}.tar.xz" | sha256sum --check + + - name: Decompress package + if: ${{ !contains(matrix.package, 'aarch64') }} + run: | + tar -xvf ${{ matrix.package }}.tar.xz + + - name: Malware scan + uses: dell/common-github-actions/malware-scanner@main + with: + directories: . + options: -r + \ No newline at end of file diff --git a/.github/workflows/promote-packages.yaml b/.github/workflows/promote-packages.yaml new file mode 100644 index 00000000..9d4efba1 --- /dev/null +++ b/.github/workflows/promote-packages.yaml @@ -0,0 +1,155 @@ +# This automation promotes 3p packages based on a merge to default branches + +name: Promote 3P Packages + +on: + # Allows you to run this workflow manually from the Actions tag + workflow_dispatch: + + push: + branches: + - main + - development + paths: + - 'package_build_list_host_*.json' + +jobs: + deploy-dev: + name: Deploying to dev S3 bucket + runs-on: ubuntu-latest + environment: development + env: + PACKAGE_PATH: packages/ + outputs: + filelist: "${{ steps.dev-upload.outputs.filelist }}" + steps: + - name: Download packages + uses: dawidd6/action-download-artifact@v2.28.0 + with: + workflow: build-pr-packages.yaml + workflow_conclusion: success + commit: ${{github.event.pull_request.head.sha}} + check_artifacts: true + path: ${{ env.PACKAGE_PATH }} + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id : ${{ secrets.AWS_CREDS_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_CREDS_SECRET_KEY }} + aws-region : ${{ secrets.AWS_CREDS_REGION_NAME }} + + - name: Copy to S3 + id: dev-upload + shell: bash + run: | + find ${{ env.PACKAGE_PATH }} -type f | while read file; do + filename=$(basename "$file") + aws s3 cp "$file" "s3://${{ secrets.AWS_PACKAGE_DEV_S3_BUCKET }}/$filename" --acl bucket-owner-full-control + FILELIST="$FILELIST$filename," + echo "filelist=$( echo "$FILELIST" )" >> $GITHUB_OUTPUT + done + + create-o3de-3p-pr: + name: Create PR in O3DE to update version + needs: deploy-dev + runs-on: ubuntu-latest + env: + O3DE_REPO_PATH: o3de + DEV_CDN: https://d1gg6ket0m44ly.cloudfront.net + UPLOADED_FILES: "${{ needs.deploy-dev.outputs.filelist }}" + + steps: + - name: Checkout o3de repository + uses: actions/checkout@v4 + with: + repository: o3de/o3de + token: ${{ secrets.GHA_TOKEN }} + path: o3de + + - name: Copy dev package from S3 + run: | + IFS=',' read -ra FILES <<< "$UPLOADED_FILES" + for filename in "${FILES[@]}"; do + if [[ $filename == *.tar.xz.SHA256SUMS ]]; then + wget "${{ env.DEV_CDN }}/$filename" + fi + done + + - name: Update BuiltInPackages with new SHA256 and version + shell: bash + run: | + IFS=',' read -ra FILENAMES <<<"$UPLOADED_FILES" + for filename in "${FILENAMES[@]}"; do + if [[ $filename == *.tar.xz.SHA256SUMS ]]; then + content=$(cat "$filename") + file=$(echo "$content" | awk -F'*' '{print $2}' | sed 's/.tar.xz//g') # *--o3de--.tar.xz + hash=$(echo "$content" | awk '{print $1}') + PACKAGE_NAME=$(echo "$file" | cut -d'-' -f1-2) # Extract package name without platform + PARTIAL_PACKAGE_NAME=$(echo "$PACKAGE_NAME" | cut -d'-' -f1) # Extract the first part of the package name for matching + PLATFORM=$(echo "$file" | cut -d'-' -f5) + + # Determine x86 or aarch64 cmake file name based on file suffix + if [[ $file == *linux-aarch64 ]]; then + CMAKE_FILE=BuiltInPackages_linux_aarch64.cmake + elif [[ $file == *linux ]]; then + CMAKE_FILE=BuiltInPackages_linux_x86_64.cmake + else + CMAKE_FILE=BuiltInPackages_$PLATFORM.cmake + fi + + FILE_PATH="${{ env.O3DE_REPO_PATH }}/cmake/3rdParty/Platform/${PLATFORM^}/$CMAKE_FILE" + + # Sample the first line after the comment "# platform-specific" to detect width + sample_line=$(awk '/# platform-specific/{getline; print}' "$FILE_PATH") + # Detect the width of the line until TARGETS + width_before_targets=$(echo "$sample_line" | awk -F'TARGETS' '{print length($1 FS) - length("ly_associate_package(PACKAGE_NAME ") - length(" TARGETS")}') + # Construct the new line using printf with the detected width + new_line=$(printf "ly_associate_package(PACKAGE_NAME %-*s TARGETS %-27s PACKAGE_HASH %s" $width_before_targets "$file" "$PARTIAL_PACKAGE_NAME" "$hash") + + grep -q "$PARTIAL_PACKAGE_NAME" "$FILE_PATH" + if [ $? -eq 0 ]; then + sed -i "s|ly_associate_package(PACKAGE_NAME $PARTIAL_PACKAGE_NAME-[^ ]* .*PACKAGE_HASH [a-f0-9]\{64\}|$new_line|g" "$FILE_PATH" + else + echo "$new_line" >> "$FILE_PATH" + fi + fi + done + + echo "package_name=$PACKAGE_NAME" >> $GITHUB_ENV + + - name: Commit and create PR + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GHA_TOKEN }} + path: ${{ env.O3DE_REPO_PATH }} + base: development + branch: "update-3p-${{ env.package_name }}-cmake-file" + commit-message: "Update 3P version and SHA256 hash for ${{ env.package_name }}" + title: "Update 3P version and SHA256 hash for ${{ env.package_name }}" + body: "Automated PR to update 3P version and SHA256 for ${{ env.package_name }}" + draft: true + signoff: true + delete-branch: true + + deploy-prod: + name: Deploying to prod S3 bucket + needs: [deploy-dev, create-o3de-3p-pr] + runs-on: ubuntu-latest + environment: production + env: + UPLOADED_FILES: "${{ needs.deploy-dev.outputs.filelist }}" + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id : ${{ secrets.AWS_CREDS_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_CREDS_SECRET_KEY }} + aws-region : ${{ secrets.AWS_CREDS_REGION_NAME }} + + - name: Promote dev package to prod + run: | + IFS=',' read -ra FILES <<< "$UPLOADED_FILES" + for filename in "${FILES[@]}"; do + aws s3 cp "s3://${{ secrets.AWS_PACKAGE_DEV_S3_BUCKET }}/$filename" "s3://${{ secrets.AWS_PACKAGE_PROD_S3_BUCKET }}/$filename" --acl bucket-owner-full-control + done \ No newline at end of file From 36404139555ae7b0d909674b3b7429a6c8f03cdd Mon Sep 17 00:00:00 2001 From: Mike Chang Date: Mon, 25 Sep 2023 11:52:50 -0700 Subject: [PATCH 05/13] Apply suggestions from code review Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Signed-off-by: Mike Chang --- .github/workflows/build-package.yaml | 48 +++++++++++++++------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml index 79d89969..ab3e3065 100644 --- a/.github/workflows/build-package.yaml +++ b/.github/workflows/build-package.yaml @@ -30,37 +30,38 @@ jobs: # Construct the package and os into a json string to be consumed by Github Actions runners JSON="{\"include\":[" for FILE in $CHANGED_FILES; do - if [[ $FILE == package_build_list_host_* ]]; then - PLATFORM=$(echo $FILE | sed -n 's/package_build_list_host_\(.*\).json/\1/p') - case $PLATFORM in - linux*) - OS_RUNNER="ubuntu-latest" - ;; - windows) - OS_RUNNER="windows-2019" - ;; - darwin) - OS_RUNNER="macos-latest" - ;; - *) - OS_RUNNER="windows-latest" # default - ;; - esac - - DIFF=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \ + if [[ $FILE == package_build_list_host_* ]]; then + PLATFORM=$(echo $FILE | sed -n 's/package_build_list_host_\(.*\).json/\1/p') + case $PLATFORM in + linux*) + OS_RUNNER="ubuntu-latest" + ;; + windows) + OS_RUNNER="windows-2019" + ;; + darwin) + OS_RUNNER="macos-latest" + ;; + *) + OS_RUNNER="windows-latest" # default + ;; + esac + + DIFF=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \ --exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) + if [[ $? -ne 0 ]]; then echo No valid build change found. Exiting with non-zero fi PACKAGE=$(echo $DIFF | cut -d'"' -f2) - JSONline="{\"package\": \"$PACKAGE\", \"os\": \"$OS_RUNNER\"}," - if [[ "$JSON" != *"$JSONline"* ]]; then - JSON="$JSON$JSONline" - fi - fi + JSONline="{\"package\": \"$PACKAGE\", \"os\": \"$OS_RUNNER\"}," + if [[ "$JSON" != *"$JSONline"* ]]; then + JSON="$JSON$JSONline" + fi + fi done # Remove last "," and add closing brackets @@ -73,6 +74,7 @@ jobs: # Set output echo "matrix=$( echo "$JSON" )" >> $GITHUB_OUTPUT + validate-changes: name: Check changes for issues needs: detect-changes From 9491e9e5e5f019e56f61b9e8dc46e4a6d4c0185d Mon Sep 17 00:00:00 2001 From: Mike Chang Date: Mon, 25 Sep 2023 14:33:38 -0700 Subject: [PATCH 06/13] Reposition script spacing. Adds newline at EoF Signed-off-by: Mike Chang --- .github/workflows/build-container.yaml | 2 +- .github/workflows/build-package.yaml | 45 ++++++++++++------------- .github/workflows/promote-packages.yaml | 2 +- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build-container.yaml b/.github/workflows/build-container.yaml index 59262275..1638e751 100644 --- a/.github/workflows/build-container.yaml +++ b/.github/workflows/build-container.yaml @@ -46,4 +46,4 @@ jobs: sccache --version cmake --version git --version - python3 --version \ No newline at end of file + python3 --version diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml index ab3e3065..2123ac73 100644 --- a/.github/workflows/build-package.yaml +++ b/.github/workflows/build-package.yaml @@ -30,33 +30,32 @@ jobs: # Construct the package and os into a json string to be consumed by Github Actions runners JSON="{\"include\":[" for FILE in $CHANGED_FILES; do - if [[ $FILE == package_build_list_host_* ]]; then + if [[ $FILE == package_build_list_host_* ]]; then PLATFORM=$(echo $FILE | sed -n 's/package_build_list_host_\(.*\).json/\1/p') case $PLATFORM in - linux*) - OS_RUNNER="ubuntu-latest" - ;; - windows) - OS_RUNNER="windows-2019" - ;; - darwin) - OS_RUNNER="macos-latest" - ;; - *) - OS_RUNNER="windows-latest" # default - ;; - esac - - DIFF=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \ - --exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) - + linux*) + OS_RUNNER="ubuntu-latest" + ;; + windows) + OS_RUNNER="windows-2019" + ;; + darwin) + OS_RUNNER="macos-latest" + ;; + *) + OS_RUNNER="windows-latest" # default + ;; + esac + + DIFF=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \ + --exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) # Get oly the changes that can be built if [[ $? -ne 0 ]]; then echo No valid build change found. Exiting with non-zero fi - + PACKAGE=$(echo $DIFF | cut -d'"' -f2) - + JSONline="{\"package\": \"$PACKAGE\", \"os\": \"$OS_RUNNER\"}," if [[ "$JSON" != *"$JSONline"* ]]; then JSON="$JSON$JSONline" @@ -74,7 +73,6 @@ jobs: # Set output echo "matrix=$( echo "$JSON" )" >> $GITHUB_OUTPUT - validate-changes: name: Check changes for issues needs: detect-changes @@ -99,7 +97,7 @@ jobs: echo ${{ matrix.package }} does not exist in CDN, continuing... exit 0 fi - + - name: Malware scan of repo uses: dell/common-github-actions/malware-scanner@main with: @@ -202,7 +200,7 @@ jobs: sccache -z ls -lah /workspace python3 /scripts/o3de_package_scripts/build_package.py --search_path /source/ ${{ matrix.package }} - + - name: Upload packages uses: actions/upload-artifact@v3 with: @@ -237,4 +235,3 @@ jobs: with: directories: . options: -r - \ No newline at end of file diff --git a/.github/workflows/promote-packages.yaml b/.github/workflows/promote-packages.yaml index 9d4efba1..9b80fed7 100644 --- a/.github/workflows/promote-packages.yaml +++ b/.github/workflows/promote-packages.yaml @@ -152,4 +152,4 @@ jobs: IFS=',' read -ra FILES <<< "$UPLOADED_FILES" for filename in "${FILES[@]}"; do aws s3 cp "s3://${{ secrets.AWS_PACKAGE_DEV_S3_BUCKET }}/$filename" "s3://${{ secrets.AWS_PACKAGE_PROD_S3_BUCKET }}/$filename" --acl bucket-owner-full-control - done \ No newline at end of file + done From cbbc755f591746ee9e195a885b964c373139ccfd Mon Sep 17 00:00:00 2001 From: Mike Chang Date: Tue, 26 Sep 2023 11:39:40 -0700 Subject: [PATCH 07/13] Change prod cdn to repository environment variable Signed-off-by: Mike Chang --- .github/workflows/build-package.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml index 2123ac73..78fadd72 100644 --- a/.github/workflows/build-package.yaml +++ b/.github/workflows/build-package.yaml @@ -87,7 +87,7 @@ jobs: - name: Check if package already exists in prod env: - PROD_CDN: "https://d3t6xeg4fgfoum.cloudfront.net" + PROD_CDN: ${{ vars.PROD_CDN }} # Change this to compare on your own endpoint run: | url="${{ env.PROD_CDN }}/${{ matrix.package }}" if curl --head --silent --fail ${url}.tar.xz > /dev/null 2>&1; then From afd43af410c6734db32fe1eb75d6866b13607116 Mon Sep 17 00:00:00 2001 From: Mike Chang Date: Tue, 26 Sep 2023 11:41:58 -0700 Subject: [PATCH 08/13] Change dev cdn to an environment variable Signed-off-by: Mike Chang --- .github/workflows/promote-packages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/promote-packages.yaml b/.github/workflows/promote-packages.yaml index 9b80fed7..e9c6605e 100644 --- a/.github/workflows/promote-packages.yaml +++ b/.github/workflows/promote-packages.yaml @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest env: O3DE_REPO_PATH: o3de - DEV_CDN: https://d1gg6ket0m44ly.cloudfront.net + DEV_CDN: ${{ vars.DEV_CDN }} # Change this to use your own endpoint UPLOADED_FILES: "${{ needs.deploy-dev.outputs.filelist }}" steps: From 6e7933c2fca87b873b3d18b5172ff5f72d9a90cf Mon Sep 17 00:00:00 2001 From: Mike Chang Date: Wed, 27 Sep 2023 10:23:30 -0700 Subject: [PATCH 09/13] Packaging build automation fixes (#221) --- .github/workflows/build-package.yaml | 23 +++++++------------ .github/workflows/promote-packages.yaml | 30 ++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml index 78fadd72..0f395954 100644 --- a/.github/workflows/build-package.yaml +++ b/.github/workflows/build-package.yaml @@ -21,7 +21,7 @@ jobs: - name: Checkout 3P source repo uses: actions/checkout@v4 with: - fetch-depth: 10 + fetch-depth: 0 - name: Get package and platform from JSON changes id: detect-platform @@ -48,7 +48,7 @@ jobs: esac DIFF=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \ - --exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) # Get oly the changes that can be built + --exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) # Get only the changes that can be built if [[ $? -ne 0 ]]; then echo No valid build change found. Exiting with non-zero @@ -121,6 +121,7 @@ jobs: uses: actions/checkout@v4 with: path: 3p-package-source + fetch-depth: 0 - name: Checkout 3P scripts repo uses: actions/checkout@v4 @@ -154,25 +155,17 @@ jobs: restore-keys: ${{ matrix.package }}-${{ matrix.os }} - - name: Run build command (windows) - if: contains(matrix.package, 'windows') + - name: Run build command + if: ${{ !contains(matrix.package, 'aarch64') }} env: CMAKE_CXX_COMPILER_LAUNCHER: sccache CMAKE_C_COMPILER_LAUNCHER: sccache CMAKE_GENERATOR: Ninja # ccache/sccache cannot be used as the compiler launcher under cmake if the generator is MSBuild run: | python3 3p-package-scripts/o3de_package_scripts/build_package.py --search_path 3p-package-source ${{ matrix.package }} - - - name: Run build command (linux/mac) - if: contains(matrix.package, 'linux') && ${{ !contains(matrix.package, 'aarch64') }} - env: - CMAKE_CXX_COMPILER_LAUNCHER: sccache - CMAKE_C_COMPILER_LAUNCHER: sccache - run: | - python3 3p-package-scripts/o3de_package_scripts/build_package.py --search_path 3p-package-source ${{ matrix.package }} - - - name: Run build command (linux aarch64) - if: contains(matrix.package, 'linux') && contains(matrix.package, 'aarch64') + + - name: Run build command (aarch64) + if: contains(matrix.package, 'aarch64') uses: uraimo/run-on-arch-action@v2.5.1 with: arch: none diff --git a/.github/workflows/promote-packages.yaml b/.github/workflows/promote-packages.yaml index e9c6605e..6671d99d 100644 --- a/.github/workflows/promote-packages.yaml +++ b/.github/workflows/promote-packages.yaml @@ -3,8 +3,17 @@ name: Promote 3P Packages on: - # Allows you to run this workflow manually from the Actions tag + # Allows you to run this workflow manually from the Actions screen workflow_dispatch: + inputs: + PR-num: + type: string + required: false + description: PR number to pull from. Leave blank to pull from last successful run + Run-id-num: + type: string + required: false + description: Run id number (located in the build url) to pull from. Leave blank to pull from last successful run push: branches: @@ -27,10 +36,25 @@ jobs: uses: dawidd6/action-download-artifact@v2.28.0 with: workflow: build-pr-packages.yaml - workflow_conclusion: success - commit: ${{github.event.pull_request.head.sha}} + pr: ${{ inputs.PR-num }} + run_id: ${{ inputs.Run-id-num }} check_artifacts: true path: ${{ env.PACKAGE_PATH }} + + - name: Check if package already exists in prod + env: + PROD_CDN: ${{ vars.PROD_CDN }} # Change this to compare on your own endpoint + run: | + find ${{ env.PACKAGE_PATH }} -type f | while read file; do + filename=$(basename "$file") + url="${{ env.PROD_CDN }}/${filename}" + if curl --head --silent --fail ${url} > /dev/null 2>&1; then + echo ${filename} already exists in prod. Check the rev in the json file to ensure it is incremented + exit 1 + else + echo ${filename} does not exist in CDN, continuing... + fi + done - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 From 2e1ee7b803cc8c389c66dc9b16fb77bc0f591a1f Mon Sep 17 00:00:00 2001 From: Mike Chang Date: Wed, 27 Sep 2023 15:24:23 -0700 Subject: [PATCH 10/13] Add 3 dots to git diff to catch only the changed files at head (#222) --- .github/workflows/build-package.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml index 0f395954..81ee953a 100644 --- a/.github/workflows/build-package.yaml +++ b/.github/workflows/build-package.yaml @@ -26,7 +26,7 @@ jobs: - name: Get package and platform from JSON changes id: detect-platform run: | - CHANGED_FILES=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --name-only) + CHANGED_FILES=$(git diff ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} --name-only) # Construct the package and os into a json string to be consumed by Github Actions runners JSON="{\"include\":[" for FILE in $CHANGED_FILES; do @@ -47,8 +47,8 @@ jobs: ;; esac - DIFF=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \ - --exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) # Get only the changes that can be built + DIFF=$(git diff ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \ + --exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) # Get oly the changes that can be built if [[ $? -ne 0 ]]; then echo No valid build change found. Exiting with non-zero From 053a4b8a4ab4e60c79487e8f58b7f9cc310ed756 Mon Sep 17 00:00:00 2001 From: Mike Chang Date: Tue, 3 Oct 2023 10:52:43 -0700 Subject: [PATCH 11/13] Update Github Action VM to Ubuntu 20.04 and pin GCC/Clang versions (#223) --- .github/workflows/build-container.yaml | 42 ++++++++++++++++++++------ .github/workflows/build-package.yaml | 16 ++++++++-- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-container.yaml b/.github/workflows/build-container.yaml index 1638e751..6c9ab03a 100644 --- a/.github/workflows/build-container.yaml +++ b/.github/workflows/build-container.yaml @@ -23,26 +23,50 @@ jobs: packages: write steps: - name: Run build command (aarch64) - uses: uraimo/run-on-arch-action@v2 + uses: uraimo/run-on-arch-action@v2.5.1 with: env: | - GITHUB_WORKFLOW: ${{ github.workflow }} - SCCACHE_VER: 0.5.4 + GITHUB_WORKFLOW: ${{ github.workflow }} # Sets the docker image to the name of the workflow arch: aarch64 - distro: ubuntu_latest + distro: ubuntu20.04 githubToken: ${{ github.token }} shell: /bin/bash install: | + ## Set variables. "env" not supported in install phase + export CLANG_VER=12 + export GCC_VER=9 + export SCCACHE_VER=0.5.4 + export CMAKE_VER=3.27.6 + ## Install build dependancies from apt apt-get update - apt-get install -y build-essential cmake curl git libssl-dev libffi-dev libbz2-dev libgdbm-compat-dev libgdbm-dev liblzma-dev libreadline-dev libtool \ - ninja-build python3 python3-pip tcl8.6-dev tk8.6-dev texinfo software-properties-common + apt-get install -y build-essential curl git libssl-dev libffi-dev libbz2-dev libgdbm-compat-dev libgdbm-dev liblzma-dev libreadline-dev libtool \ + ninja-build python3 python3-pip tcl8.6-dev tk8.6-dev texinfo software-properties-common wget python3 -m pip install boto3 certifi - curl -L 'https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-aarch64-unknown-linux-musl.tar.gz' \ - | tar xzf - -O --wildcards '*/sccache' > '/usr/local/bin/sccache' - chmod +x '/usr/local/bin/sccache' + # Install Clang/GCC at specific version + apt-get install -y clang-${CLANG_VER} gcc-${GCC_VER} g++-${GCC_VER} + update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VER} 10 + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VER} 10 + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VER} 10 + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VER} 10 + ## Install sccache + wget -qO- "https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VER}/sccache-v${SCCACHE_VER}-aarch64-unknown-linux-musl.tar.gz" \ + | tar xzf - -O --wildcards '*/sccache' > '/usr/local/bin/sccache' \ + && chmod +x '/usr/local/bin/sccache' + ## Install cmake + wget -q "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-aarch64.sh" \ + -O /tmp/cmake-install.sh \ + && chmod u+x /tmp/cmake-install.sh \ + && mkdir /opt/cmake-${CMAKE_VER} \ + && /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-${CMAKE_VER} \ + && rm /tmp/cmake-install.sh \ + && ln -s /opt/cmake-${CMAKE_VER}/bin/* /usr/local/bin + rm -rf /var/lib/apt/lists/* run: | lsb_release -a uname -a + gcc --version + g++ --version + clang --version sccache --version cmake --version git --version diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml index 81ee953a..93245c20 100644 --- a/.github/workflows/build-package.yaml +++ b/.github/workflows/build-package.yaml @@ -34,7 +34,7 @@ jobs: PLATFORM=$(echo $FILE | sed -n 's/package_build_list_host_\(.*\).json/\1/p') case $PLATFORM in linux*) - OS_RUNNER="ubuntu-latest" + OS_RUNNER="ubuntu-20.04" ;; windows) OS_RUNNER="windows-2019" @@ -145,6 +145,18 @@ jobs: - name: Update msbuild path if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1.12.0 + + - name: Install clang/gcc + if: runner.os == 'Linux' + env: + CLANG_VER: 12 + GCC_VER: 9 + run: | + sudo apt-get install -y clang-${{ env.CLANG_VER }} gcc-${{ env.GCC_VER }} g++-${{ env.GCC_VER }} + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 10 + sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{ env.CLANG_VER }} 10 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 10 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_VER }} 10 - name: Use sccache uses: hendrikmuhs/ccache-action@v1.2.10 @@ -170,7 +182,7 @@ jobs: with: arch: none distro: none - base_image: ghcr.io/${{ github.repository }}/run-on-arch-${{ github.repository_owner }}-${{ github.event.repository.name }}-build-container-aarch64-ubuntu-latest:latest # built from build-container.yaml + base_image: ghcr.io/${{ github.repository }}/run-on-arch-${{ github.repository_owner }}-${{ github.event.repository.name }}-build-container-aarch64-ubuntu20-04:latest # built from build-container.yaml setup: | grep -q ${{ matrix.package }} ${PWD}/3p-package-source/package_build_list_host_linux.json || rm ${PWD}/3p-package-source/package_build_list_host_linux.json dockerRunArgs: | From 280f5e2c536b372a4d0a9a78ae180afb1a018ab1 Mon Sep 17 00:00:00 2001 From: jhmueller-huawei <101700150+jhmueller-huawei@users.noreply.github.com> Date: Fri, 6 Oct 2023 19:03:29 +0200 Subject: [PATCH 12/13] Update for dxc to the latest version. (#211) The new dxc version fixes multiple issues that we encounter during shader compilation with the older version. We have tested this on linux (x64) and windows, but could not test in on linux (aarch) or mac, letting the asset processor compile all shaders (some changes are needed: https://github.com/o3de/o3de/pull/16568). On windows when building with a newer visual studio version, `package-system/DirectXShaderCompiler/build_dxc_windows.cmd` needs to be modified, either removing or changing `-vs2019` to `-vs2022` as we did, but this is not included in this patch. Signed-off-by: Joerg H. Mueller --- .../FindDirectXShaderCompilerDxc.cmake.Linux | 1 - package-system/DirectXShaderCompiler/build_config.json | 4 ++-- package_build_list_host_darwin.json | 4 ++-- package_build_list_host_linux-aarch64.json | 4 ++-- package_build_list_host_linux.json | 4 ++-- package_build_list_host_windows.json | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/package-system/DirectXShaderCompiler/FindDirectXShaderCompilerDxc.cmake.Linux b/package-system/DirectXShaderCompiler/FindDirectXShaderCompilerDxc.cmake.Linux index 49659aa5..95b65add 100644 --- a/package-system/DirectXShaderCompiler/FindDirectXShaderCompilerDxc.cmake.Linux +++ b/package-system/DirectXShaderCompiler/FindDirectXShaderCompilerDxc.cmake.Linux @@ -26,7 +26,6 @@ ly_add_target_files(TARGETS ${TARGET_WITH_NAMESPACE} OUTPUT_SUBDIRECTORY "${outp set(${MY_NAME}_LIB_RUNTIME_DEPENDENCIES ${${MY_NAME}_LIB_DIR}/libdxcompiler.so - ${${MY_NAME}_LIB_DIR}/libdxcompiler.so.3.7 ) ly_add_target_files(TARGETS ${TARGET_WITH_NAMESPACE} OUTPUT_SUBDIRECTORY "${output_subfolder}/lib" FILES ${${MY_NAME}_LIB_RUNTIME_DEPENDENCIES}) diff --git a/package-system/DirectXShaderCompiler/build_config.json b/package-system/DirectXShaderCompiler/build_config.json index 2bcbca13..d8b72380 100644 --- a/package-system/DirectXShaderCompiler/build_config.json +++ b/package-system/DirectXShaderCompiler/build_config.json @@ -1,8 +1,8 @@ { "git_url":"https://github.com/o3de/DirectXShaderCompiler.git", - "git_tag":"release-1.6.2112-o3de", + "git_tag":"release-1.7.2308-o3de", "package_name":"DirectXShaderCompilerDxc", - "package_version":"1.6.2112-o3de-rev1", + "package_version":"1.7.2308-o3de-rev1", "package_url":"https://github.com/o3de/DirectXShaderCompiler", "package_license":"NCSA", "package_license_file":"LICENSE.TXT", diff --git a/package_build_list_host_darwin.json b/package_build_list_host_darwin.json index a1a6a193..616ff0b5 100644 --- a/package_build_list_host_darwin.json +++ b/package_build_list_host_darwin.json @@ -38,7 +38,7 @@ "SQLite-3.37.2-rev2-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Mac --package-root ../../package-system --clean", "squish-ccr-deb557d-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Mac --package-root ../../package-system --clean", "astc-encoder-3.2-rev5-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Mac --package-root ../../package-system --clean", - "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Mac --package-root ../../package-system --clean", + "DirectXShaderCompilerDxc-1.7.2308-o3de-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Mac --package-root ../../package-system --clean", "azslc-1.8.15-rev2-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Mac --package-root ../../package-system/azslc/temp --clean", "python-3.10.5-rev2-darwin": "package-system/python/build_package_image.py", "mcpp-2.7.2_az.2-rev1-mac": "package-system/mcpp/get_and_build_mcpp.py mcpp-2.7.2_az.2-rev1", @@ -95,7 +95,7 @@ "SPIRVCross-2021.04.29-rev1-mac": "package-system/SPIRVCross-mac", "squish-ccr-deb557d-rev1-mac": "package-system/squish-ccr-mac", "astc-encoder-3.2-rev5-mac": "package-system/astc-encoder-mac", - "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-mac": "package-system/DirectXShaderCompilerDxc-mac", + "DirectXShaderCompilerDxc-1.7.2308-o3de-rev1-mac": "package-system/DirectXShaderCompilerDxc-mac", "azslc-1.8.15-rev2-mac": "package-system/azslc/temp/azslc-mac", "SQLite-3.37.2-rev2-mac": "package-system/SQLite-mac", "xxhash-0.7.4-rev1-multiplatform": "package-system/xxhash-multiplatform", diff --git a/package_build_list_host_linux-aarch64.json b/package_build_list_host_linux-aarch64.json index 067c33a1..7ce85359 100644 --- a/package_build_list_host_linux-aarch64.json +++ b/package_build_list_host_linux-aarch64.json @@ -11,7 +11,7 @@ "AWSNativeSDK-1.9.50-rev4-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSNativeSDK --platform-name Linux-aarch64 --clean", "azslc-1.8.15-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Linux-aarch64 --clean", "cityhash-1.1-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/cityhash --platform-name Linux-aarch64 --clean", - "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux-aarch64 --clean", + "DirectXShaderCompilerDxc-1.7.2308-o3de-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux-aarch64 --clean", "expat-2.4.2-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Linux-aarch64 --clean", "freetype-2.11.1-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/freetype --platform-name Linux-aarch64 --clean", "googlebenchmark-1.7.0-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googlebenchmark --platform-name Linux-aarch64 --clean", @@ -52,7 +52,7 @@ "AWSNativeSDK-1.9.50-rev4-linux-aarch64": "package-system/AWSNativeSDK/temp/AWSNativeSDK-linux-aarch64", "azslc-1.8.15-rev1-linux-aarch64": "package-system/azslc/temp/azslc-linux-aarch64", "cityhash-1.1-rev1-linux-aarch64": "package-system/cityhash/temp/cityhash-linux-aarch64", - "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-linux-aarch64": "package-system/DirectXShaderCompiler/temp/DirectXShaderCompilerDxc-linux-aarch64", + "DirectXShaderCompilerDxc-1.7.2308-o3de-rev1-linux-aarch64": "package-system/DirectXShaderCompiler/temp/DirectXShaderCompilerDxc-linux-aarch64", "expat-2.4.2-rev2-linux-aarch64": "package-system/expat/temp/expat-linux-aarch64", "freetype-2.11.1-rev1-linux-aarch64": "package-system/freetype/temp/freetype-linux-aarch64", "googlebenchmark-1.7.0-rev1-linux-aarch64": "package-system/googlebenchmark/temp/googlebenchmark-linux-aarch64", diff --git a/package_build_list_host_linux.json b/package_build_list_host_linux.json index 35e73333..c0618505 100644 --- a/package_build_list_host_linux.json +++ b/package_build_list_host_linux.json @@ -38,7 +38,7 @@ "squish-ccr-deb557d-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Linux --clean", "squish-ccr-deb557d-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Linux-aarch64 --clean", "astc-encoder-3.2-rev3-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Linux --package-root ../../package-system --clean", - "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux --package-root ../../package-system --clean", + "DirectXShaderCompilerDxc-1.7.2308-o3de-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux --package-root ../../package-system --clean", "azslc-1.8.15-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Linux --package-root ../../package-system/azslc/temp --clean", "tiff-4.2.0.15-rev3-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/tiff --platform-name Linux --package-root ../../package-system --clean", "python-3.10.5-rev4-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux --clean", @@ -79,7 +79,7 @@ "squish-ccr-deb557d-rev1-linux": "package-system/squish-ccr/temp/squish-ccr-linux", "squish-ccr-deb557d-rev1-linux-aarch64": "package-system/squish-ccr/temp/squish-ccr-linux-aarch64", "astc-encoder-3.2-rev3-linux": "package-system/astc-encoder-linux", - "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-linux": "package-system/DirectXShaderCompilerDxc-linux", + "DirectXShaderCompilerDxc-1.7.2308-o3de-rev1-linux": "package-system/DirectXShaderCompilerDxc-linux", "azslc-1.8.15-rev2-linux": "package-system/azslc/temp/azslc-linux", "tiff-4.2.0.15-rev3-linux": "package-system/tiff-linux", "python-3.10.5-rev4-linux": "package-system/python/temp/python-linux", diff --git a/package_build_list_host_windows.json b/package_build_list_host_windows.json index f187a823..83dd8392 100644 --- a/package_build_list_host_windows.json +++ b/package_build_list_host_windows.json @@ -13,7 +13,7 @@ "AWSNativeSDK-1.9.50-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/AWSNativeSDK --platform-name Windows --package-root ../../package-system --clean", "Blast-v1.1.7_rc2-9-geb169fe-rev2-windows": "package-system/Blast/build_package_image.py --platform-name windows", "Crashpad-0.8.0-rev1-windows": "package-system/Crashpad/build_package_image.py", - "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Windows --package-root ../../package-system --clean", + "DirectXShaderCompilerDxc-1.7.2308-o3de-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Windows --package-root ../../package-system --clean", "expat-2.4.2-rev2-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Android --package-root ../../package-system/expat/temp --clean", "expat-2.4.2-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Windows --package-root ../../package-system/expat/temp --clean", "freetype-2.11.1-rev1-android": "Scripts/extras/pull_and_build_from_git.py ../../package-system/freetype --platform-name Android --package-root ../../package-system/freetype/temp --clean", @@ -77,7 +77,7 @@ "cityhash-1.1-multiplatform": "package-system/cityhash-multiplatform", "civetweb-1.8-rev1-windows": "package-system/civetweb-windows", "Crashpad-0.8.0-rev1-windows": "package-system/Crashpad-windows", - "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-windows": "package-system/DirectXShaderCompilerDxc-windows", + "DirectXShaderCompilerDxc-1.7.2308-o3de-rev1-windows": "package-system/DirectXShaderCompilerDxc-windows", "d3dx12-headers-rev1-windows": "package-system/d3dx12-windows", "expat-2.4.2-rev2-android": "package-system/expat/temp/expat-android", "expat-2.4.2-rev2-windows": "package-system/expat/temp/expat-windows", From a8019a5abb34270ded2526a847e0ef3b8dbf0697 Mon Sep 17 00:00:00 2001 From: Mike Chang Date: Thu, 12 Oct 2023 11:25:23 -0700 Subject: [PATCH 13/13] Add dockerfile detection, qemu env for build scripts, longpath support (#226) --- .github/workflows/build-package.yaml | 48 +++++++++++++++------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml index 93245c20..38751caa 100644 --- a/.github/workflows/build-package.yaml +++ b/.github/workflows/build-package.yaml @@ -37,7 +37,7 @@ jobs: OS_RUNNER="ubuntu-20.04" ;; windows) - OS_RUNNER="windows-2019" + OS_RUNNER="windows-latest" # This is bundled with VS2022 ;; darwin) OS_RUNNER="macos-latest" @@ -49,14 +49,11 @@ jobs: DIFF=$(git diff ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \ --exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) # Get oly the changes that can be built - - if [[ $? -ne 0 ]]; then - echo No valid build change found. Exiting with non-zero - fi PACKAGE=$(echo $DIFF | cut -d'"' -f2) - - JSONline="{\"package\": \"$PACKAGE\", \"os\": \"$OS_RUNNER\"}," + PACKPATH=$(echo $DIFF | egrep -o "package-system/[^ ]*") + DOCKER=$(test -f "$PACKPATH/Dockerfile" && echo 1 || echo 0) + JSONline="{\"package\": \"$PACKAGE\", \"os\": \"$OS_RUNNER\", \"dockerfile\": \"$DOCKER\"}," if [[ "$JSON" != *"$JSONline"* ]]; then JSON="$JSON$JSONline" fi @@ -114,20 +111,22 @@ jobs: steps: - name: Configure - id: get-user - run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT + id: configure + run: | + git config --global core.longpaths true + echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT - name: Checkout 3P source repo uses: actions/checkout@v4 with: - path: 3p-package-source + path: source fetch-depth: 0 - name: Checkout 3P scripts repo uses: actions/checkout@v4 with: repository: o3de/3p-package-scripts - path: 3p-package-scripts + path: scripts - name: Update python uses: actions/setup-python@v4 @@ -165,32 +164,37 @@ jobs: max-size: 2048M key: ${{ matrix.package }}-${{ matrix.os }} restore-keys: - ${{ matrix.package }}-${{ matrix.os }} - + ${{ matrix.package }}-${{ matrix.os }} + + - name: Set up QEMU (aarch64) # Only if the package folder contains a Dockerfile + if: ${{ (contains(matrix.package, 'aarch64')) && (matrix.dockerfile == '1') }} + run: | + sudo apt-get install -y qemu qemu-user-static + - name: Run build command - if: ${{ !contains(matrix.package, 'aarch64') }} + if: ${{ (!contains(matrix.package, 'aarch64')) || (matrix.dockerfile == '1') }} env: CMAKE_CXX_COMPILER_LAUNCHER: sccache CMAKE_C_COMPILER_LAUNCHER: sccache CMAKE_GENERATOR: Ninja # ccache/sccache cannot be used as the compiler launcher under cmake if the generator is MSBuild run: | - python3 3p-package-scripts/o3de_package_scripts/build_package.py --search_path 3p-package-source ${{ matrix.package }} + python3 scripts/o3de_package_scripts/build_package.py --search_path source ${{ matrix.package }} - - name: Run build command (aarch64) - if: contains(matrix.package, 'aarch64') + - name: Run build command (aarch64) # Generic build for packages without a Dockerfile + if: ${{ (contains(matrix.package, 'aarch64')) && (matrix.dockerfile != '1') }} uses: uraimo/run-on-arch-action@v2.5.1 with: arch: none distro: none base_image: ghcr.io/${{ github.repository }}/run-on-arch-${{ github.repository_owner }}-${{ github.event.repository.name }}-build-container-aarch64-ubuntu20-04:latest # built from build-container.yaml setup: | - grep -q ${{ matrix.package }} ${PWD}/3p-package-source/package_build_list_host_linux.json || rm ${PWD}/3p-package-source/package_build_list_host_linux.json + grep -q ${{ matrix.package }} ${PWD}/source/package_build_list_host_linux.json || rm ${PWD}/source/package_build_list_host_linux.json dockerRunArgs: | --platform=linux/arm64 - --user ${{ steps.get-user.outputs.uid_gid }} + --user ${{ steps.configure.outputs.uid_gid }} --volume "${PWD}:/workspace" - --volume "${PWD}/3p-package-scripts:/scripts" - --volume "${PWD}/3p-package-source:/source" + --volume "${PWD}/scripts:/scripts" + --volume "${PWD}/source:/source" env: | CMAKE_CXX_COMPILER_LAUNCHER: sccache CMAKE_C_COMPILER_LAUNCHER: sccache @@ -210,7 +214,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ matrix.package }} - path: 3p-package-source/packages/* + path: source/packages/* validate-packages: name: Validating ${{ matrix.package }}