name: Validate env: XMAKE_VERSION: 2.9.9 WINDOWS_SDK_VERSION: 22621 XMAKE_GLOBALDIR: ${{ github.workspace }}/../.xmake_shared concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref_name != 'main' }} on: pull_request: types: - 'opened' - 'reopened' - 'synchronize' branches: - 'main' paths-ignore: - '*.md' - 'LICENSE' - '.gitignore' - 'docs/**' - 'VERSION.txt' - '.github/workflows/create_release.yml' - '.github/workflows/mirror_releases.yml' - '.github/workflows/mirror.yml' push: branches: - 'main' paths-ignore: - '*.md' - 'LICENSE' - '.gitignore' - 'docs/**' - 'VERSION.txt' - '.github/workflows/create_release.yml' - '.github/workflows/mirror_releases.yml' - '.github/workflows/mirror.yml' jobs: clang-format: name: Check clang-format runs-on: [linux, x64, zen] steps: - uses: actions/checkout@v4 - name: clang-format uses: ue-foundation/clang-format-action@epic-batching-v1 with: clang-format-version: '13' check-path: 'src' windows-build: name: Build & Test Windows runs-on: [windows, x64, zen] timeout-minutes: 25 strategy: matrix: config: - 'debug' - 'release' arch: - 'x64' steps: - name: Checkout uses: actions/checkout@v4 - name: Trust workspace run: git config --global --add safe.directory "${{ github.workspace }}" - name: Runner info shell: powershell run: | Write-Host "=== Host ===" Write-Host "Hostname: $env:COMPUTERNAME" Write-Host "" Write-Host "=== CPU ===" Get-CimInstance Win32_Processor | Select-Object Name, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed | Format-List Write-Host "=== Memory (MB) ===" $os = Get-CimInstance Win32_OperatingSystem "{0,-20} {1,10:N0}" -f "TotalVisible:", ($os.TotalVisibleMemorySize / 1KB) "{0,-20} {1,10:N0}" -f "FreePhysical:", ($os.FreePhysicalMemory / 1KB) Write-Host "" Write-Host "=== Disks (GB) ===" Get-PSDrive -PSProvider FileSystem | Where-Object { $_.Used -ne $null -or $_.Free -ne $null } | Select-Object Name, @{N='UsedGB'; E={[math]::Round($_.Used/1GB,2)}}, @{N='FreeGB'; E={[math]::Round($_.Free/1GB,2)}}, @{N='TotalGB'; E={[math]::Round(($_.Used + $_.Free)/1GB,2)}}, Root | Format-Table -AutoSize - name: Setup xmake uses: ue-foundation/github-action-setup-xmake@v1.2.2 with: xmake-version: ${{env.XMAKE_VERSION}} - name: Config run: | xmake config -vD -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} --zensentry=yes - name: Clean reports if: ${{ matrix.config == 'debug' }} run: if (Test-Path build/reports) { Remove-Item -Recurse -Force build/reports } - name: Kill stale test processes if: ${{ matrix.config == 'debug' }} shell: powershell run: | scripts\test_scripts\kill-test-processes.ps1 -Label stale -BuildDir "${{ github.workspace }}\build" - name: Build & Test if: ${{ matrix.config == 'debug' }} env: ZEN_TEST_ARTIFACTS_S3: ${{ vars.ZEN_TEST_ARTIFACTS_S3 }} AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }} run: | xmake test -v -y --junit - name: Kill test processes if: ${{ always() && matrix.config == 'debug' }} shell: powershell run: | scripts\test_scripts\kill-test-processes.ps1 -Label leftover -BuildDir "${{ github.workspace }}\build" - name: Upload report if: ${{ (failure() || success()) && (matrix.config == 'debug') }} uses: actions/upload-artifact@v3-node20 with: name: reports-win64 path: build/reports/*.xml - name: Test Report if: ${{ (failure() || success()) && (matrix.config == 'debug') }} uses: ue-foundation/test-reporter@v2 with: name: Test Results (win64) path: build/reports/*.xml reporter: java-junit list-tests: 'failed' - name: Bundle if: ${{ matrix.config == 'release' }} run: | xmake bundle -v -y --codesignidentity="Epic Games" - name: Upload zenserver-win64 if: ${{ github.ref_name == 'main' && matrix.config == 'release' }} uses: actions/upload-artifact@v3-node20 with: name: zenserver-win64 path: build/zenserver-win64.zip linux-build: name: Build & Test Linux runs-on: [linux, x64, zen] timeout-minutes: 25 strategy: matrix: config: - 'debug' - 'release' arch: - 'x86_64' steps: - name: Checkout uses: actions/checkout@v4 - name: Runner info shell: bash run: | echo "=== Host ===" echo "Hostname: $(hostname)" echo "Kernel: $(uname -srm)" echo echo "=== CPU ===" if command -v lscpu >/dev/null; then lscpu | grep -E 'Model name|Socket|Core|Thread|CPU\(s\):' else grep -m1 'model name' /proc/cpuinfo echo "CPUs: $(nproc)" fi echo echo "=== Memory ===" free -h echo echo "=== Disks ===" df -h -x tmpfs -x devtmpfs -x squashfs 2>/dev/null || df -h - name: Install UE Toolchain run: | rm -rf ./.tmp-ue-toolchain ./scripts/ue_build_linux/get_ue_toolchain.sh ./.tmp-ue-toolchain - name: Setup xmake uses: ue-foundation/github-action-setup-xmake@v1.2.2 with: xmake-version: ${{env.XMAKE_VERSION}} - name: Config run: | xmake config -v -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} --zensentry=yes --toolchain=ue-clang --sdk=${{ github.workspace }}/.tmp-ue-toolchain - name: Clean reports if: ${{ matrix.config == 'debug' }} shell: bash run: rm -rf build/reports - name: Kill stale test processes if: ${{ matrix.config == 'debug' }} shell: bash run: | bash scripts/test_scripts/kill-test-processes.sh stale "${{ github.workspace }}/build" - name: Build & Test if: ${{ matrix.config == 'debug' }} env: ZEN_TEST_ARTIFACTS_S3: ${{ vars.ZEN_TEST_ARTIFACTS_S3 }} AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }} run: | xmake test -v -y --junit - name: Kill test processes if: ${{ always() && matrix.config == 'debug' }} shell: bash run: | bash scripts/test_scripts/kill-test-processes.sh leftover "${{ github.workspace }}/build" - name: Upload report if: ${{ (failure() || success()) && (matrix.config == 'debug') }} uses: actions/upload-artifact@v3-node20 with: name: reports-linux path: build/reports/*.xml - name: Test Report if: ${{ (failure() || success()) && (matrix.config == 'debug') }} uses: ue-foundation/test-reporter@v2 with: name: Test Results (linux) path: build/reports/*.xml reporter: java-junit list-tests: 'failed' - name: Bundle if: ${{ matrix.config == 'release' }} run: | xmake bundle -v -y - name: Crashpad Check if: ${{ matrix.config == 'release' }} shell: bash run: | ./scripts/test_linux/crashpad-test.sh build/linux/${{ matrix.arch }}/release/zenserver - name: Upload zenserver-linux if: ${{ github.ref_name == 'main' && matrix.config == 'release' }} uses: actions/upload-artifact@v3-node20 with: name: zenserver-linux path: build/zenserver-linux.zip macos-build: name: Build & Test MacOS runs-on: [macos, x64, zen] timeout-minutes: 25 strategy: matrix: config: - 'debug' - 'release' arch: - 'x86_64' steps: - name: Checkout uses: actions/checkout@v4 - name: Runner info shell: bash run: | echo "=== Host ===" echo "Hostname: $(hostname)" echo "Kernel: $(uname -srm)" echo echo "=== CPU ===" echo "Brand: $(sysctl -n machdep.cpu.brand_string 2>/dev/null || echo unknown)" echo "Cores: $(sysctl -n hw.physicalcpu 2>/dev/null || echo ?) physical / $(sysctl -n hw.logicalcpu 2>/dev/null || echo ?) logical" echo echo "=== Memory ===" mem_bytes=$(sysctl -n hw.memsize 2>/dev/null || echo 0) echo "Total: $(awk -v b="$mem_bytes" 'BEGIN{printf "%.2f GB\n", b/1024/1024/1024}')" if command -v vm_stat >/dev/null; then vm_stat | head -5 fi echo echo "=== Disks ===" df -h - name: Setup xmake uses: ue-foundation/github-action-setup-xmake@v1.2.2 with: xmake-version: ${{env.XMAKE_VERSION}} - name: Config run: | xmake config -v -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} --zensentry=yes - name: Clean reports if: ${{ matrix.config == 'debug' }} shell: bash run: rm -rf build/reports - name: Kill stale test processes if: ${{ matrix.config == 'debug' }} shell: bash run: | bash scripts/test_scripts/kill-test-processes.sh stale "${{ github.workspace }}/build" - name: Build & Test if: ${{ matrix.config == 'debug' }} env: ZEN_TEST_ARTIFACTS_S3: ${{ vars.ZEN_TEST_ARTIFACTS_S3 }} AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }} run: | xmake test -v -y --junit - name: Kill test processes if: ${{ always() && matrix.config == 'debug' }} shell: bash run: | bash scripts/test_scripts/kill-test-processes.sh leftover "${{ github.workspace }}/build" - name: Upload report if: ${{ (failure() || success()) && (matrix.config == 'debug') }} uses: actions/upload-artifact@v3-node20 with: name: reports-macos path: build/reports/*.xml - name: Test Report if: ${{ (failure() || success()) && (matrix.config == 'debug') }} uses: ue-foundation/test-reporter@v2 with: name: Test Results (macos) path: build/reports/*.xml reporter: java-junit list-tests: 'failed' - name: Bundle if: ${{ matrix.config == 'release' }} run: | xmake bundle -v -y --codesignidentity="Developer ID Application" - name: Upload zenserver-macos if: ${{ github.ref_name == 'main' && matrix.config == 'release' }} uses: actions/upload-artifact@v3-node20 with: name: zenserver-macos path: build/zenserver-macos.zip docker-build: name: Build Docker Images if: github.ref_name == 'main' runs-on: [linux, x64, zen] timeout-minutes: 15 needs: [linux-build, windows-build] steps: - uses: actions/checkout@v4 - name: Download Linux bundle uses: actions/download-artifact@v3-node20 with: name: zenserver-linux path: artifacts/linux - name: Download Windows bundle uses: actions/download-artifact@v3-node20 with: name: zenserver-win64 path: artifacts/win64 - name: Extract binaries run: | mkdir -p build/linux/x86_64/release unzip artifacts/linux/zenserver-linux.zip -d artifacts/linux-extracted cp artifacts/linux-extracted/zenserver build/linux/x86_64/release/ mkdir -p build/win-binary-staging unzip artifacts/win64/zenserver-win64.zip -d artifacts/win-extracted cp artifacts/win-extracted/zenserver.exe build/win-binary-staging/ - name: Login to Amazon ECR run: | aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 728559092788.dkr.ecr.us-east-1.amazonaws.com - name: Build and push Docker image (with Wine + Windows binary) run: | docker build \ -t 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:latest-wine \ --build-arg WIN_BINARY_DIR=build/win-binary-staging \ -f docker/Dockerfile . docker push 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:latest-wine - name: Build and push Docker image (Linux only, no Wine) run: | docker build \ -t 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:latest-linux \ --build-arg INSTALL_WINE=false \ -f docker/Dockerfile . docker push 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:latest-linux