|
@@ -34,41 +34,61 @@ jobs:
|
|
|
|
|
|
for FILE in $CHANGED_FILES; do
|
|
for FILE in $CHANGED_FILES; do
|
|
if [[ $FILE == package_build_list_host_* ]]; then
|
|
if [[ $FILE == package_build_list_host_* ]]; then
|
|
|
|
+ echo "Checking file $FILE"
|
|
PLATFORM=$(echo $FILE | sed -n 's/package_build_list_host_\(.*\).json/\1/p')
|
|
PLATFORM=$(echo $FILE | sed -n 's/package_build_list_host_\(.*\).json/\1/p')
|
|
- case $PLATFORM in
|
|
|
|
- linux*)
|
|
|
|
- OS_RUNNER="ubuntu-20.04"
|
|
|
|
- ;;
|
|
|
|
- windows)
|
|
|
|
- OS_RUNNER="windows-latest" # This is bundled with VS2022
|
|
|
|
- ;;
|
|
|
|
- darwin)
|
|
|
|
- OS_RUNNER="macos-13" # Use x86 runner image. Latest uses ARM64
|
|
|
|
- ;;
|
|
|
|
- *)
|
|
|
|
- OS_RUNNER="windows-latest" # default
|
|
|
|
- ;;
|
|
|
|
- esac
|
|
|
|
|
|
+ echo "Using platform $PLATFORM"
|
|
|
|
|
|
# Only get the changes that can be built
|
|
# Only get the changes that can be built
|
|
|
|
+ # First, get the diff output
|
|
|
|
+ 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 "^\+[^\+]" | egrep -v "^\+\+\+ ")
|
|
|
|
+
|
|
|
|
+ # Use an associative array to track which packages we've already processed
|
|
|
|
+ declare -A PROCESSED_PACKAGES
|
|
|
|
+
|
|
|
|
+ # Then, iterate over the lines
|
|
IFS=$'\n' # Process each line in the package build file
|
|
IFS=$'\n' # Process each line in the package build file
|
|
- for LINE in 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 "^\+[^\+]" | egrep -v "^\+\+\+ "); do
|
|
|
|
|
|
+ for LINE in $DIFF; do
|
|
unset IFS # Reset IFS to avoid word splitting
|
|
unset IFS # Reset IFS to avoid word splitting
|
|
PACKAGE=$(echo $LINE | cut -d'"' -f2)
|
|
PACKAGE=$(echo $LINE | cut -d'"' -f2)
|
|
- PACKPATH=$(echo $LINE | egrep -o "package-system/[^/ ]+(?=/| )" | head -n 1)
|
|
|
|
|
|
+
|
|
|
|
+ # Skip if we've already processed this package
|
|
|
|
+ if [[ -n "${PROCESSED_PACKAGES[$PACKAGE]}" ]]; then
|
|
|
|
+ continue
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ PACKPATH=$(echo $LINE | grep -oE "package-system/[^/ ]+" | head -n 1)
|
|
if [[ -z "${DOCKERFILE["$PACKAGE"]}" && -n "$PACKPATH" ]]; then
|
|
if [[ -z "${DOCKERFILE["$PACKAGE"]}" && -n "$PACKPATH" ]]; then
|
|
DOCKER=$(test -e ${PACKPATH%% }/Dockerfile* && echo 1 || echo 0) # Assume the build scripts will use the Dockerfile if found in the package path
|
|
DOCKER=$(test -e ${PACKPATH%% }/Dockerfile* && echo 1 || echo 0) # Assume the build scripts will use the Dockerfile if found in the package path
|
|
DOCKERFILE["$PACKAGE"]=1 # Mark Dockerfile check as done
|
|
DOCKERFILE["$PACKAGE"]=1 # Mark Dockerfile check as done
|
|
fi
|
|
fi
|
|
|
|
|
|
- # Special cases for certain packages
|
|
|
|
- if [[ $PACKAGE =~ "DirectXShaderCompilerDxc" ]] && [[ $PLATFORM =~ "windows" ]]; then
|
|
|
|
- OS_RUNNER="windows-2019"
|
|
|
|
|
|
+ # Determine the OS runner based on the package name
|
|
|
|
+ if [[ $PACKAGE =~ "aarch64" ]]; then
|
|
|
|
+ PACKAGE_OS="ubuntu-22.04-arm"
|
|
|
|
+ echo "OS Image selected for $PACKAGE: $PACKAGE_OS"
|
|
|
|
+ elif [[ $PACKAGE =~ "DirectXShaderCompilerDxc" ]] && [[ $PLATFORM =~ "windows" ]]; then
|
|
|
|
+ PACKAGE_OS="windows-2019"
|
|
|
|
+ echo "OS Image selected for $PACKAGE: $PACKAGE_OS"
|
|
|
|
+ elif [[ $PLATFORM =~ "linux" ]]; then
|
|
|
|
+ PACKAGE_OS="ubuntu-22.04"
|
|
|
|
+ echo "OS Image selected for $PACKAGE: $PACKAGE_OS"
|
|
|
|
+ elif [[ $PLATFORM =~ "windows" ]]; then
|
|
|
|
+ PACKAGE_OS="windows-latest"
|
|
|
|
+ echo "OS Image selected for $PACKAGE: $PACKAGE_OS"
|
|
|
|
+ elif [[ $PLATFORM =~ "darwin" ]]; then
|
|
|
|
+ PACKAGE_OS="macos-13"
|
|
|
|
+ echo "OS Image selected for $PACKAGE: $PACKAGE_OS"
|
|
|
|
+ else
|
|
|
|
+ PACKAGE_OS="windows-latest" # Default
|
|
|
|
+ echo "OS Image selected for $PACKAGE: $PACKAGE_OS (default)"
|
|
fi
|
|
fi
|
|
|
|
|
|
- PACKAGES_JSON["$PACKAGE"]="{\"package\": \"$PACKAGE\", \"os\": \"$OS_RUNNER\", \"dockerfile\": \"$DOCKER\"}"
|
|
|
|
|
|
+ PACKAGES_JSON["$PACKAGE"]="{\"package\": \"$PACKAGE\", \"os\": \"$PACKAGE_OS\", \"dockerfile\": \"$DOCKER\"}"
|
|
|
|
+
|
|
|
|
+ # Mark as processed
|
|
|
|
+ PROCESSED_PACKAGES[$PACKAGE]=1
|
|
done
|
|
done
|
|
unset IFS
|
|
unset IFS
|
|
fi
|
|
fi
|
|
@@ -138,7 +158,7 @@ jobs:
|
|
|
|
|
|
- name: Expand disk size for Linux
|
|
- name: Expand disk size for Linux
|
|
uses: easimon/maximize-build-space@v10
|
|
uses: easimon/maximize-build-space@v10
|
|
- if: runner.os == 'Linux'
|
|
|
|
|
|
+ if: runner.os == 'Linux' && !contains(matrix.os, 'arm')
|
|
with:
|
|
with:
|
|
root-reserve-mb: 20000
|
|
root-reserve-mb: 20000
|
|
swap-size-mb: 200
|
|
swap-size-mb: 200
|
|
@@ -231,6 +251,7 @@ jobs:
|
|
|
|
|
|
- name: Use sccache
|
|
- name: Use sccache
|
|
uses: hendrikmuhs/[email protected]
|
|
uses: hendrikmuhs/[email protected]
|
|
|
|
+ if: ${{ !contains(matrix.os, 'arm') }}
|
|
with:
|
|
with:
|
|
variant: sccache
|
|
variant: sccache
|
|
max-size: 2048M
|
|
max-size: 2048M
|
|
@@ -244,43 +265,12 @@ jobs:
|
|
sudo apt-get install -y qemu qemu-user-static
|
|
sudo apt-get install -y qemu qemu-user-static
|
|
|
|
|
|
- name: Run build command
|
|
- name: Run build command
|
|
- if: ${{ (!contains(matrix.package, 'aarch64')) || (matrix.dockerfile == '1') }}
|
|
|
|
env:
|
|
env:
|
|
CMAKE_CXX_COMPILER_LAUNCHER: sccache
|
|
CMAKE_CXX_COMPILER_LAUNCHER: sccache
|
|
CMAKE_C_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
|
|
CMAKE_GENERATOR: Ninja # ccache/sccache cannot be used as the compiler launcher under cmake if the generator is MSBuild
|
|
run: |
|
|
run: |
|
|
python3 scripts/o3de_package_scripts/build_package.py --search_path source ${{ matrix.package }}
|
|
python3 scripts/o3de_package_scripts/build_package.py --search_path source ${{ matrix.package }}
|
|
-
|
|
|
|
- - name: Run build command (aarch64) # Generic build for packages without a Dockerfile
|
|
|
|
- if: ${{ (contains(matrix.package, 'aarch64')) && (matrix.dockerfile != '1') }}
|
|
|
|
- uses: uraimo/[email protected]
|
|
|
|
- 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}/source/package_build_list_host_linux.json || rm ${PWD}/source/package_build_list_host_linux.json
|
|
|
|
- dockerRunArgs: |
|
|
|
|
- --platform=linux/arm64
|
|
|
|
- --user ${{ steps.configure.outputs.uid_gid }}
|
|
|
|
- --volume "${PWD}:/workspace"
|
|
|
|
- --volume "${PWD}/scripts:/scripts"
|
|
|
|
- --volume "${PWD}/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
|
|
- name: Upload packages
|
|
uses: actions/upload-artifact@v4
|
|
uses: actions/upload-artifact@v4
|