From 65e5440e25d200bb45e0b88b8ba33f0bd90227d3 Mon Sep 17 00:00:00 2001 From: Mike Chang Date: Thu, 12 Oct 2023 10:22:46 -0700 Subject: [PATCH 1/2] Add dockerfile detection, qemu environment for build scripts, longfile support Signed-off-by: Mike Chang --- .github/workflows/build-package.yaml | 35 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml index 93245c20..c47b1024 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" @@ -55,8 +55,9 @@ jobs: 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 @@ -120,14 +121,14 @@ jobs: - 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 @@ -167,30 +168,36 @@ jobs: restore-keys: ${{ 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 +217,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 }} From ea6b28b965f11d912246aa19aec1294a466ce5ae Mon Sep 17 00:00:00 2001 From: Mike Chang Date: Thu, 12 Oct 2023 10:27:51 -0700 Subject: [PATCH 2/2] Add git longfile config Signed-off-by: Mike Chang --- .github/workflows/build-package.yaml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml index c47b1024..38751caa 100644 --- a/.github/workflows/build-package.yaml +++ b/.github/workflows/build-package.yaml @@ -49,10 +49,6 @@ 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) PACKPATH=$(echo $DIFF | egrep -o "package-system/[^ ]*") @@ -115,8 +111,10 @@ 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 @@ -166,8 +164,7 @@ 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') }}