Переглянути джерело

Github Actions AR (#18605)

* Add GHA AR workflow for Windows, Linux, and Android

Signed-off-by: Mike Chang <[email protected]>
Mike Chang 3 місяців тому
батько
коміт
6d4292eb7e

+ 194 - 0
.github/workflows/android-build.yml

@@ -0,0 +1,194 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+name: Android Build
+
+# These jobs are to be triggered by ar.yml
+
+on:
+  workflow_dispatch:
+  workflow_call:
+    inputs:
+      compiler: 
+        required: true
+        type: string
+      config: 
+        required: true
+        type: string
+      image: 
+        required: true
+        type: string
+      platform: 
+        required: true
+        type: string
+      type: 
+        required: true
+        type: string
+      last_artifact: 
+        required: false
+        type: boolean
+
+run-name: ${{ inputs.platform }} - ${{ inputs.type }}
+
+# Activate compiler cache
+env: 
+  O3DE_ENABLE_COMPILER_CACHE: true
+  O3DE_COMPILER_CACHE_PATH: 'C:\ProgramData\Chocolatey\bin\ccache.exe'
+  NDK_VERSION: 25.1.8937393
+
+# Note: All 3P Github Actions use the commit hash for security reasons 
+# Avoid using the tag version, which is vulnerable to supply chain attacks
+
+jobs:
+  Build:
+    strategy:
+      fail-fast: false
+
+    runs-on: ${{ inputs.image }}
+        
+    steps:
+      - name: Checkout repo
+        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+        with:
+          show-progress: false
+
+      - name: Git LFS pull
+        # Minimal pull for profile builds, otherwise pull all
+        run: |
+          git lfs install
+          if ("${{ inputs.type }}" -eq "profile") { git lfs pull --include "*.ico,*.bmp" } else { git lfs pull }
+
+      - name: Setup 3p, user, and build folders
+        # Symlink the .o3de folder to the github workspace to avoid permission issues
+        run: |
+          "3rdParty", "build", ".o3de" | % {New-Item "${{ github.workspace }}\$_" -ItemType 'Directory' -Force}
+          ".o3de" | % {New-Item -Path $env:USERPROFILE\$_ -ItemType SymbolicLink -Target ${{ github.workspace }}\$_ -Force}
+          "AutomatedTesting\Cache", "AutomatedTesting\user" | % {New-Item "${{ github.workspace }}\$_" -ItemType 'Directory' -Force}
+
+      - name: Setup ccache
+        uses: Chocobo1/setup-ccache-action@f84f86840109403e0fe0ded8b0766c9633affa16 # v1.4.7
+        continue-on-error: true
+        if: always()
+        with:
+          windows_compile_environment: msvc
+          prepend_symlinks_to_path: false
+          store_cache: false
+          restore_cache: false
+          ccache_options: |
+            max_size=15G
+            cache_dir=${{ github.workspace }}\.ccache
+      
+      - name: Get last run
+        # Get the last runid of the target branch of a PR or the current branch
+        uses: dawidd6/action-download-artifact@07ab29fd4a977ae4d2b275087cf67563dfdf0295 # v9
+        id: last-run-id
+        if: ${{ inputs.last_artifact }}
+        continue-on-error: true
+        with:
+          workflow_search: true
+          workflow_conclusion: ""
+          branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.ref_name }}
+          search_artifacts: true
+          name: O3DE-${{ inputs.platform }}-${{ inputs.config }}-build
+          dry_run: true
+
+      - name: Set artifact run ID
+        # Set the run ID of the artifact to be used for the download step
+        id: set-artifact-run-id
+        if: steps.last-run-id.outcome == 'success' && inputs.last_artifact == true
+        run: |
+          $runId = ${{ fromJSON(steps.last-run-id.outputs.artifacts)[0].workflow_run.id }}
+          echo "artifact_run_id=$runId" >> $env:GITHUB_OUTPUT
+          echo "Using artifacts from previous run: $runId"
+      
+      - name: Restore artifact cache
+        # Restore the artifact from the "Get last run" step or from the current run
+        uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
+        id: restore-artifact-cache
+        continue-on-error: true
+        with:
+          name: O3DE-${{ inputs.platform }}-${{ inputs.config }}-build
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          run-id: ${{ steps.set-artifact-run-id.outputs.artifact_run_id || github.run_id }}
+
+      - name: Extract artifact
+        # Extract the tar file from the artifact
+        id: extract-artifact
+        if: ${{ steps.restore-artifact-cache.outcome == 'success' }}
+        continue-on-error: true
+        run: |        
+          if (Test-Path ${{ github.workspace }}\cache.tar) {          
+            tar -xvpf ${{ github.workspace }}\cache.tar
+            rm ${{ github.workspace }}\cache.tar
+          }
+      
+      - name: Setup cmake
+        # Pin the version of cmake  
+        uses: lukka/get-cmake@56d043d188c3612951d8755da8f4b709ec951ad6 # v3.31.6
+        with:
+          cmakeVersion: "~3.30.0"
+
+      - name: Set MSBuild options
+        # Configuire VS environment variables through the developer command prompt for MSVC
+        uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
+                
+      - name: Configure environment
+        # Install dependencies for gradle and clang builds from the NDK
+        continue-on-error: true
+        run: |
+          echo "Installing dependencies"
+          echo "Getting python..."
+          python\get_python.bat
+
+          echo "Installing NDK ${{ env.NDK_VERSION }}..."
+          & "$env:ANDROID_HOME\cmdline-tools\latest\bin\sdkmanager.bat" --install 'ndk;${{ env.NDK_VERSION }}' --sdk_root=$env:ANDROID_HOME
+          echo "LY_NDK_DIR=$env:ANDROID_HOME\ndk\${{ env.NDK_VERSION }}" >> $env:GITHUB_ENV
+          echo "JDK_HOME=$env:JAVA_HOME_17_X64" >> $env:GITHUB_ENV
+          echo "JAVA_HOME=$env:JAVA_HOME_17_X64" >> $env:GITHUB_ENV
+          echo "GRADLE_BUILD_HOME=$env:GRADLE_HOME" >> $env:GITHUB_ENV
+          
+      - name: Build ${{ inputs.type }}
+        # Builds with presets in ../scripts/build/Platform/Android/build_config.json
+        env:
+          LY_3RDPARTY_PATH: ${{ github.workspace }}\3rdParty
+          USE_CCACHE: 1
+          NDK_CCACHE: ${{ env.O3DE_COMPILER_CACHE_PATH }}
+          CMAKE_C_COMPILER_LAUNCHER: ${{ env.O3DE_COMPILER_CACHE_PATH }}
+          CMAKE_CXX_COMPILER_LAUNCHER: ${{ env.O3DE_COMPILER_CACHE_PATH }}
+
+        run: |
+          scripts\o3de.bat register --this-engine # Resolves registration issue with gradle build
+          python\python.cmd -u scripts\build\ci_build.py --platform ${{ inputs.platform }} --type ${{ inputs.type }} 
+      
+      - name: Compress artifacts
+        # Compress with posix format to preserve permissions and timestamps at nanosecond precision
+        id: compress-artifacts
+        if: ${{ (steps.extract-artifact.outcome == 'success' || steps.extract-artifact.outcome == 'skipped') && !cancelled() && !contains(inputs.type, 'test') }}
+        continue-on-error: true
+        run: |
+          try {
+            tar --format=posix -cvpf ${{ github.workspace }}\cache.tar `
+              python `
+              3rdParty\packages `
+              AutomatedTesting\Cache `
+              AutomatedTesting\user `
+              .ccache
+          } catch {
+            echo "Warning: Error during tar compression"
+          }
+  
+      - name: Save artifacts
+        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+        if: ${{ steps.compress-artifacts.conclusion == 'success' && !cancelled() && !contains(inputs.type, 'test') }}
+        continue-on-error: true
+        with:
+          name: O3DE-${{ inputs.platform }}-${{ inputs.config }}-build
+          compression-level: 1
+          overwrite: true
+          path: |
+            ${{ github.workspace }}\cache.tar

+ 135 - 0
.github/workflows/ar.yml

@@ -0,0 +1,135 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+name: AR
+
+on:
+  pull_request:
+  workflow_dispatch:
+  push:
+    branches:
+      - main
+      - development
+      - stabilization/**
+      - hotfix/**
+
+jobs:
+
+# The following jobs are used to build the project for the different platforms.
+# The parameters are the following:
+# - compiler: The compiler to use (msvc, clang)
+# - config: The configuration to use (profile, release). This is defined by presets in ../scripts/build/Platform/<os>/build_config.json
+# - image: The image to use (windows-2022, ubuntu-22.04). The images are defined from runners images repo: https://github.com/actions/runner-images
+# - platform: The platform to use (Windows, Linux, Android)
+# - type: The type of build to use (profile, asset_profile, test_profile, test_cpu_profile, release)
+# - last_artifact: Whether to use the artifact from the last run, from the target branch if it's a pull request or its own branch if it's a push
+# - desktop: Whether to use the desktop environment for tests (Linux only)
+
+#### Windows Build ####
+    Windows-Profile:
+        uses: ./.github/workflows/windows-build.yml
+        with:
+            compiler: msvc
+            config: profile
+            image: windows-2022
+            platform: Windows
+            type: profile
+            last_artifact: true
+    
+    Windows-Asset:
+        needs: Windows-Profile
+        uses: ./.github/workflows/windows-build.yml
+        with:
+            compiler: msvc
+            config: profile
+            image: windows-2022
+            platform: Windows
+            type: asset_profile
+
+    Windows-Test:
+        needs: Windows-Asset
+        uses: ./.github/workflows/windows-build.yml
+        with:
+            compiler: msvc
+            config: profile
+            image: windows-2022
+            platform: Windows
+            type: test_cpu_profile
+
+    Windows-Release:
+        uses: ./.github/workflows/windows-build.yml
+        with:
+            compiler: msvc
+            config: release
+            image: windows-2022
+            platform: Windows
+            type: release
+            last_artifact: true
+
+#### Linux Build ####
+    Linux-Profile:
+        uses: ./.github/workflows/linux-build.yml
+        with:
+            compiler: clang
+            config: profile
+            image: ubuntu-22.04
+            platform: Linux
+            type: profile
+            last_artifact: true
+
+    Linux-Asset:
+        needs: Linux-Profile
+        uses: ./.github/workflows/linux-build.yml
+        with:
+            compiler: clang
+            config: profile
+            image: ubuntu-22.04
+            platform: Linux
+            type: asset_profile
+
+    Linux-Test:
+        needs: Linux-Asset
+        uses: ./.github/workflows/linux-build.yml
+        with:
+            compiler: clang
+            config: profile
+            image: ubuntu-22.04
+            platform: Linux
+            type: test_profile
+            desktop: true
+
+#### Android Build ####
+    Android-Profile:
+        uses: ./.github/workflows/android-build.yml
+        with:
+            compiler: clang
+            config: profile
+            image: windows-2022
+            platform: Android
+            type: profile
+            last_artifact: true
+
+    Android-Asset:
+        uses: ./.github/workflows/android-build.yml
+        with:
+            compiler: msvc
+            config: asset_profile
+            image: windows-2022
+            platform: Android
+            type: asset_profile
+            last_artifact: true
+            
+    Android-Gradle:
+        uses: ./.github/workflows/android-build.yml
+        with:
+            compiler: clang
+            config: gradle
+            image: windows-2022
+            platform: Android
+            type: gradle
+            last_artifact: true

+ 201 - 0
.github/workflows/linux-build.yml

@@ -0,0 +1,201 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+name: Linux Build
+
+# These jobs are to be triggered by ar.yml
+
+on:
+  workflow_dispatch:
+  workflow_call:
+    inputs:
+      compiler: 
+        required: true
+        type: string
+      config: 
+        required: true
+        type: string
+      image: 
+        required: true
+        type: string
+      platform: 
+        required: true
+        type: string
+      type: 
+        required: true
+        type: string
+      last_artifact: 
+        required: false
+        type: boolean
+      desktop:
+        required: false
+        type: boolean
+
+run-name: ${{ inputs.platform }} - ${{ inputs.type }}
+
+# Note: All 3P Github Actions use the commit hash for security reasons 
+# Avoid using the tag version, which is vulnerable to supply chain attacks
+
+jobs:
+  Build:
+    strategy:
+      fail-fast: false
+
+    runs-on: ${{ inputs.image }}
+
+    steps:
+      - name: Maximize build space
+        # Resize and combine disks as LVM in order to maximize the amount of space for builds
+        uses: easimon/maximize-build-space@fc881a613ad2a34aca9c9624518214ebc21dfc0c # v10
+        with:
+          root-reserve-mb: 6000
+          swap-size-mb: 200
+          remove-dotnet: true
+          remove-haskell: true
+          remove-codeql: true
+          remove-docker-images: true
+            
+      - name: Checkout repo
+        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+        with:
+          show-progress: false
+
+      - name: Git LFS pull
+        # Minimal pull for profile builds, otherwise pull all
+        run: |
+          git lfs install
+          [[ "${{ inputs.type }}" == "profile" ]] && git lfs pull --include "*.ico,*.bmp" || git lfs pull
+
+      - name: Setup 3p, user, and build folders
+        run: |
+          mkdir -p .o3de build 3rdParty && ln -sf "$(pwd)/.o3de" ~/.o3de
+
+      - name: Setup ccache
+        uses: Chocobo1/setup-ccache-action@f84f86840109403e0fe0ded8b0766c9633affa16 # v1.4.7
+        continue-on-error: true
+        if: always()
+        with:
+          prepend_symlinks_to_path: false
+          store_cache: false
+          restore_cache: false
+          ccache_options: |
+            max_size=15G
+            cache_dir=${{ github.workspace }}/.ccache
+
+      - name: Get last run
+        # Get the last runid of the target branch of a PR or the current branch
+        uses: dawidd6/action-download-artifact@07ab29fd4a977ae4d2b275087cf67563dfdf0295 # v9
+        id: last-run-id
+        if: ${{ inputs.last_artifact }}
+        continue-on-error: true
+        with:
+          workflow_search: true
+          workflow_conclusion: ""
+          branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.ref_name }}
+          search_artifacts: true
+          name: O3DE-${{ inputs.platform }}-${{ inputs.config }}-build
+          dry_run: true
+                  
+      - name: Set artifact run ID
+        # Set the run ID of the artifact to be used for the download step
+        id: set-artifact-run-id
+        if: steps.last-run-id.outcome == 'success' && inputs.last_artifact == true
+        run: |
+          runId=${{ fromJSON(steps.last-run-id.outputs.artifacts)[0].workflow_run.id }}
+          echo "artifact_run_id=$runId" >> $GITHUB_OUTPUT
+          echo "Using artifacts from previous run: $runId"
+      
+      - name: Restore artifact cache
+        # Restore the artifact from the "Get last run" step or from the current run
+        id: restore-artifact-cache
+        uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
+        continue-on-error: true
+        with:
+          name: O3DE-${{ inputs.platform }}-${{ inputs.config }}-build
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          run-id: ${{ steps.set-artifact-run-id.outputs.artifact_run_id || github.run_id }}
+
+      - name: Extract artifact
+        # Extract the tar file from the artifact
+        id: extract-artifact
+        continue-on-error: true
+        if: ${{ steps.restore-artifact-cache.outcome == 'success' }}
+        run: |
+          if [ -f ${{ github.workspace }}/cache.tar ]; then          
+            tar -xvpf ${{ github.workspace }}/cache.tar --ignore-failed-read
+            rm ${{ github.workspace }}/cache.tar
+          fi
+
+      - name: Setup cmake
+        # Pin the version of cmake
+        uses: lukka/get-cmake@56d043d188c3612951d8755da8f4b709ec951ad6 # v3.31.6
+        with:
+          cmakeVersion: "~3.30.0"
+
+      - name: Configure environment
+        # Install dependencies. The desktop packages are for tests and assetprocessor
+        continue-on-error: true
+        run: |
+          echo "Installing dependencies"
+          pushd ./scripts/build/build_node/Platform/Linux
+          sudo ./install-ubuntu.sh
+          popd
+          echo "Getting python..."
+          ./python/get_python.sh
+          echo "Installing additional python dependencies..."
+          ./python/pip.sh install tempfile2 PyGithub
+
+          # If desktop is true, install desktop and x11 packages, otherwise install base packages
+          [[ "${{ inputs.desktop }}" == "true" ]] && \
+           sudo apt-get install -qq ubuntu-desktop libreoffice- thunderbird- xorg mesa-utils vulkan-tools libevdev-dev libevdev2 -y || \
+           sudo apt-get install -qq libevdev-dev libevdev2 -y
+          sudo apt -y autoremove --purge
+          sudo apt -y autoclean
+          sudo apt clean
+          df -h
+          
+      - name: Build ${{ inputs.type }}
+        # Builds with presets in ../scripts/build/Platform/Linux/build_config.json
+        env:
+          LY_3RDPARTY_PATH: ${{ github.workspace }}/3rdParty
+          CC:  ${{ inputs.compiler == 'gcc' && 'gcc' || 'clang'   }}
+          CXX: ${{ inputs.compiler == 'gcc' && 'g++' || 'clang++' }}
+          CMAKE_C_COMPILER_LAUNCHER: ccache
+          CMAKE_CXX_COMPILER_LAUNCHER: ccache
+          DISPLAY: :0
+        run: |
+          export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
+          if [ "${{ inputs.desktop }}" == "true" ]; then 
+            Xvfb :0 -screen 0 1400x1050x16 & # Start X virtual framebuffer for tests
+          fi
+          python/python.sh -u scripts/build/ci_build.py --platform ${{ inputs.platform }} --type ${{ inputs.type }}
+
+      - name: Compress artifacts
+        # Compress with posix format to preserve permissions and timestamps at nanosecond precision
+        # Skip compression and upload if the type is a test to reduce dirty build artifacts from previous runs
+        id: compress-artifacts
+        if: ${{ (steps.extract-artifact.outcome == 'success' || steps.extract-artifact.outcome == 'skipped') && !cancelled() && !contains(inputs.type, 'test') }}
+        continue-on-error: true
+        run: |
+          tar --format=posix -cvpf ${{ github.workspace }}/cache.tar --ignore-failed-read \
+            python \
+            3rdParty/packages \
+            AutomatedTesting/Cache \
+            AutomatedTesting/user \
+            .ccache
+  
+      - name: Save artifacts
+        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+        if: ${{ steps.compress-artifacts.conclusion == 'success' && !cancelled() && !contains(inputs.type, 'test') }}
+        continue-on-error: true
+        with:
+          name: O3DE-${{ inputs.platform }}-${{ inputs.config }}-build
+          compression-level: 1
+          overwrite: true
+          path: |
+            ${{ github.workspace }}/cache.tar

+ 181 - 0
.github/workflows/windows-build.yml

@@ -0,0 +1,181 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+name: Windows Build
+
+# These jobs are to be triggered by ar.yml
+
+on:
+  workflow_dispatch:
+  workflow_call:
+    inputs:
+      compiler: 
+        required: true
+        type: string
+      config: 
+        required: true
+        type: string
+      image: 
+        required: true
+        type: string
+      platform: 
+        required: true
+        type: string
+      type: 
+        required: true
+        type: string
+      last_artifact: 
+        required: false
+        type: boolean
+
+run-name: ${{ inputs.platform }} - ${{ inputs.type }}
+
+# Activate compiler cache
+env:          
+  O3DE_ENABLE_COMPILER_CACHE: true
+  O3DE_COMPILER_CACHE_PATH: 'C:\ProgramData\Chocolatey\bin\ccache.exe'
+
+# Note: All 3P Github Actions use the commit hash for security reasons 
+# Avoid using the tag version, which is vulnerable to supply chain attacks
+
+jobs:
+  Build:
+    strategy:
+      fail-fast: false
+
+    runs-on: ${{ inputs.image }}
+
+    steps:
+      - name: Checkout repo
+        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+        with:
+          show-progress: false
+
+      - name: Git LFS pull
+        # Minimal pull for profile builds, otherwise pull all
+        run: |
+            git lfs install
+            if ("${{ inputs.type }}" -eq "profile") { git lfs pull --include "*.ico,*.bmp" } else { git lfs pull }
+          
+      - name: Setup 3p, user, and build folders
+        # Symlink the .o3de folder to the github workspace to avoid permission issues
+        run: |
+          "3rdParty", "build", ".o3de" | % {New-Item "${{ github.workspace }}\$_" -ItemType 'Directory' -Force}
+          ".o3de" | % {New-Item -Path $env:USERPROFILE\$_ -ItemType SymbolicLink -Target ${{ github.workspace }}\$_ -Force}
+          "AutomatedTesting\Cache", "AutomatedTesting\user" | % {New-Item "${{ github.workspace }}\$_" -ItemType 'Directory' -Force}
+
+      - name: Setup ccache
+        uses: Chocobo1/setup-ccache-action@f84f86840109403e0fe0ded8b0766c9633affa16 # v1.4.7
+        continue-on-error: true
+        if: always()
+        with:
+          windows_compile_environment: msvc
+          prepend_symlinks_to_path: false
+          store_cache: false
+          restore_cache: false
+          ccache_options: |
+            max_size=15G
+            cache_dir=${{ github.workspace }}\.ccache
+      
+      - name: Get last run
+        # Get the last runid of the target branch of a PR or the current branch
+        uses: dawidd6/action-download-artifact@07ab29fd4a977ae4d2b275087cf67563dfdf0295 # v9
+        id: last-run-id
+        if: ${{ inputs.last_artifact }}
+        continue-on-error: true
+        with:
+          workflow_search: true
+          workflow_conclusion: ""
+          branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.ref_name }}
+          search_artifacts: true
+          name: O3DE-${{ inputs.platform }}-${{ inputs.config }}-build
+          dry_run: true
+    
+      - name: Set artifact run ID
+        # Set the run ID of the artifact to be used for the download step
+        id: set-artifact-run-id
+        if: steps.last-run-id.outcome == 'success' && inputs.last_artifact == true
+        run: |
+          $runId = ${{ fromJSON(steps.last-run-id.outputs.artifacts)[0].workflow_run.id }}
+          echo "artifact_run_id=$runId" >> $env:GITHUB_OUTPUT
+          echo "Using artifacts from previous run: $runId"
+    
+      - name: Restore artifact cache
+        # Restore the artifact from the "Get last run" step or from the current run
+        uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
+        id: restore-artifact-cache
+        continue-on-error: true
+        with:
+          name: O3DE-${{ inputs.platform }}-${{ inputs.config }}-build
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          run-id: ${{ steps.set-artifact-run-id.outputs.artifact_run_id || github.run_id }}
+
+      - name: Extract artifact
+        # Extract the tar file from the artifact
+        id: extract-artifact
+        continue-on-error: true
+        if: ${{ steps.restore-artifact-cache.outcome == 'success' }}
+        run: |        
+          if (Test-Path ${{ github.workspace }}\cache.tar) {          
+            tar -xvpf ${{ github.workspace }}\cache.tar
+            rm ${{ github.workspace }}\cache.tar
+          }
+      
+      - name: Setup cmake
+        # Pin the version of cmake
+        uses: lukka/get-cmake@56d043d188c3612951d8755da8f4b709ec951ad6 # v3.31.6
+        with:
+          cmakeVersion: "~3.30.0" 
+
+      - name: Set MSBuild options
+        # Configuire VS environment variables through the developer command prompt for MSVC
+        uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
+
+      - name: Configure environment
+        run: |
+          echo "Installing dependencies"
+          echo "Getting python..."
+          python\get_python.bat
+          echo "Installing additional python dependencies..."
+          python\pip.sh install tempfile2 PyGithub
+          
+      - name: Build ${{ inputs.type }}
+        # Builds with presets in ../scripts/build/Platform/Windows/build_config.json
+        env:
+          LY_3RDPARTY_PATH: ${{ github.workspace }}\3rdParty
+        run: |
+          python\python.cmd -u scripts\build\ci_build.py --platform ${{ inputs.platform }} --type ${{ inputs.type }}
+      
+      - name: Compress artifacts
+        # Compress with posix format to preserve permissions and timestamps at nanosecond precision
+        # Skip compression and upload if the type is a test to reduce dirty build artifacts from previous runs
+        id: compress-artifacts
+        if: ${{ (steps.extract-artifact.outcome == 'success' || steps.extract-artifact.outcome == 'skipped') && !cancelled() && !contains(inputs.type, 'test') }}
+        continue-on-error: true
+        run: |
+          try {
+            tar --format=posix -cvpf ${{ github.workspace }}\cache.tar `
+              python `
+              3rdParty\packages `
+              AutomatedTesting\Cache `
+              AutomatedTesting\user `
+              .ccache
+          } catch {
+            echo "Warning: Error during tar compression"
+          }
+  
+      - name: Save artifacts
+        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+        if: ${{ steps.compress-artifacts.conclusion == 'success' && !cancelled() && !contains(inputs.type, 'test') }}
+        continue-on-error: true
+        with:
+          name: O3DE-${{ inputs.platform }}-${{ inputs.config }}-build
+          compression-level: 1
+          overwrite: true
+          path: |
+            ${{ github.workspace }}\cache.tar