diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..16a5ffdde9e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,153 @@ +name: Build ANGLE + +on: + push: + branches: + - main + pull_request: + types: [ opened, reopened ] + workflow_dispatch: + +jobs: + check-cache-date: + runs-on: ubuntu-latest + outputs: + reverify-cache: ${{ steps.check.outputs.reverify-cache }} + steps: + - name: Update cache once a week + id: check + env: + GH_TOKEN: ${{ github.token }} + run: | + if gh cache list -R AngelAuraMC/angle --json createdAt -q '.[0].createdAt' | grep -q .; then + echo "Cache exists" + else + echo "No cache found" + echo "reverify-cache=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + if (( $(date +%s) < $(( $(date -d "$(gh cache list -R AngelAuraMC/angle --json createdAt -q '.[0].createdAt')" +%s) + 604800 )) )); then + echo "Cache is new enough" + echo "reverify-cache=false" >> "$GITHUB_OUTPUT" + else + echo "Cache needs updating" + echo "reverify-cache=true" >> "$GITHUB_OUTPUT" + fi + + update-build-environment-cache: + needs: check-cache-date + permissions: + actions: write + runs-on: ubuntu-24.04 + steps: +# Do not remove this checkout else gclient sync gets confused on what rev of ANGLE to checkout + - name: Checkout + uses: actions/checkout@v4 +# if: needs.check-cache-date.outputs.reverify-cache == 'true' is spammed throughout this job because the job itself can't be skipped if we are to use needs for the build job + - name: Restore environment from cache + if: needs.check-cache-date.outputs.reverify-cache == 'true' + id: cached-environment-restore + uses: actions/cache/restore@v4 + with: + path: ./ + key: ios_and_android-build-environment + - name: Verify cached environment is valid + if: needs.check-cache-date.outputs.reverify-cache == 'true' + run: | + if [ ! -d "depot_tools" ] ; then + git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git + fi + export PATH="$PWD/depot_tools:$PATH" + gclient config --spec 'solutions = [ + { + "name": ".", + "url": "https://chromium.googlesource.com/angle/angle.git", + "deps_file": "DEPS", + "managed": False, + "custom_vars": {}, + }, + ] + target_os = ["ios", "android"]' + gclient sync -Rf --no-history --with_branch_heads + - name: Remove non-crossplatform files that cause build issues + if: needs.check-cache-date.outputs.reverify-cache == 'true' + run: | + rm -rf third_party/llvm-build # This only contains linux files if ran on a linux machine, it has to be deleted so gclient can fetch the files for macOS/iOS instead +# Stupid workaround, see https://github.com/azu/github-actions-overwrite-cache-example and https://github.com/actions/cache/issues/342 + - name: Delete Previous Cache + if: needs.check-cache-date.outputs.reverify-cache == 'true' + run: | + gh cache delete "${{ steps.cached-environment-restore.outputs.cache-primary-key }}" --repo $GITHUB_REPOSITORY || echo "Cache not found. Skipping delete." + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Save environment to cache + if: needs.check-cache-date.outputs.reverify-cache == 'true' + uses: actions/cache/save@v4 + with: + path: ./ + key: ios_and_android-build-environment + + build: + needs: update-build-environment-cache + strategy: + matrix: + include: + - os: android + arch: arm64 + runs-on: ubuntu-24.04 + - os: android + arch: arm + runs-on: ubuntu-24.04 + - os: android + arch: x86 + runs-on: ubuntu-24.04 + - os: android + arch: x64 + runs-on: ubuntu-24.04 + - os: ios + arch: arm64 + runs-on: macos-15 + runs-on: ${{ matrix.runs-on }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore environment from cache + id: cached-environment-restore + uses: actions/cache/restore@v4 + with: + path: ./ + key: ios_and_android-build-environment + - name: Fetch, verify, and setup build environment + run: | + export PATH="$PWD/depot_tools:$PATH" + echo "$PWD/depot_tools" >> $GITHUB_PATH + gclient config --spec 'solutions = [ + { + "name": ".", + "url": "https://chromium.googlesource.com/angle/angle.git", + "deps_file": "DEPS", + "managed": False, + "custom_vars": {}, + }, + ] + target_os = ["${{ matrix.os }}"]' + gclient sync -Rf --no-history --with_branch_heads + - name: Build ANGLE + run: | + gn gen out/${{ matrix.os }}-${{ matrix.arch }} + autoninja -C out/${{ matrix.os }}-${{ matrix.arch }} + - name: Setup tmate session if failed + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + - name: Upload builds + uses: actions/upload-artifact@v4 + with: + name: ANGLE-${{ matrix.os }}-${{ matrix.arch }} + path: out/${{ matrix.os }}-${{ matrix.arch }} + - name: Upload shared library + uses: actions/upload-artifact@v4 + with: + name: ANGLE-${{ matrix.os }}-${{ matrix.arch }}.so + path: | + out/${{ matrix.os }}-${{ matrix.arch }}/lib*.so + !out/${{ matrix.os }}-${{ matrix.arch }}/*.so.TOC diff --git a/out/android-arm/args.gn b/out/android-arm/args.gn new file mode 100644 index 00000000000..4b6e32a4c4b --- /dev/null +++ b/out/android-arm/args.gn @@ -0,0 +1,35 @@ +# Build arguments go here. +# See "gn args --list" for available build arguments. +# Standard boilerplate for our usage +target_os = "android" +target_cpu = "arm" + +is_component_build = false # Dynamically links dependencies, rather than static +is_debug = false # Sets as "release" build +angle_expose_non_conformant_extensions_and_versions = true # Enables ES3.2 +angle_build_tests = false # This is a big portion of the build time that is just never used because this goes into CI, so keep it off + +# Stops libs.uncompressed from being built, which is only when symbol_level != 0 +symbol_level = 0 + +# Stops ANGLE APKs from being built (we are never using those) +angle_standalone = false + +# Disable all unneeded backends +angle_enable_gl = false +angle_enable_d3d9 = false +angle_enable_d3d11 = false +angle_enable_null = false +angle_enable_metal = false +angle_enable_wgpu = false +angle_enable_swiftshader = false + +angle_enable_vulkan = true +angle_enable_essl = true +angle_enable_glsl = true + +# Other stuff +angle_has_frame_capture = false # Turns off frame capture (we don't use it, why would you?! Also turns off rapidJSON) +build_angle_deqp_tests = false # This was somehow being set to true, am forcing it false +angle_build_all = false # Why would we need all of it? (yes this is redundant) +# libcxx_abi_unstable = false # Apparently breaks std::string, doesn't seem to anymore. Comments mention this option causing slowdowns. diff --git a/out/android-arm64/args.gn b/out/android-arm64/args.gn new file mode 100644 index 00000000000..685c480df30 --- /dev/null +++ b/out/android-arm64/args.gn @@ -0,0 +1,35 @@ +# Build arguments go here. +# See "gn args --list" for available build arguments. +# Standard boilerplate for our usage +target_os = "android" +target_cpu = "arm64" + +is_component_build = false # Dynamically links dependencies, rather than static +is_debug = false # Sets as "release" build +angle_expose_non_conformant_extensions_and_versions = true # Enables ES3.2 +angle_build_tests = false # This is a big portion of the build time that is just never used because this goes into CI, so keep it off + +# Stops libs.uncompressed from being built, which is only when symbol_level != 0 +symbol_level = 0 + +# Stops ANGLE APKs from being built (we are never using those) +angle_standalone = false + +# Disable all unneeded backends +angle_enable_gl = false +angle_enable_d3d9 = false +angle_enable_d3d11 = false +angle_enable_null = false +angle_enable_metal = false +angle_enable_wgpu = false +angle_enable_swiftshader = false + +angle_enable_vulkan = true +angle_enable_essl = true +angle_enable_glsl = true + +# Other stuff +angle_has_frame_capture = false # Turns off frame capture (we don't use it, why would you?! Also turns off rapidJSON) +build_angle_deqp_tests = false # This was somehow being set to true, am forcing it false +angle_build_all = false # Why would we need all of it? (yes this is redundant) +# libcxx_abi_unstable = false # Apparently breaks std::string, doesn't seem to anymore. Comments mention this option causing slowdowns. diff --git a/out/android-x64/args.gn b/out/android-x64/args.gn new file mode 100644 index 00000000000..451fff1c972 --- /dev/null +++ b/out/android-x64/args.gn @@ -0,0 +1,35 @@ +# Build arguments go here. +# See "gn args --list" for available build arguments. +# Standard boilerplate for our usage +target_os = "android" +target_cpu = "x64" + +is_component_build = false # Dynamically links dependencies, rather than static +is_debug = false # Sets as "release" build +angle_expose_non_conformant_extensions_and_versions = true # Enables ES3.2 +angle_build_tests = false # This is a big portion of the build time that is just never used because this goes into CI, so keep it off + +# Stops libs.uncompressed from being built, which is only when symbol_level != 0 +symbol_level = 0 + +# Stops ANGLE APKs from being built (we are never using those) +angle_standalone = false + +# Disable all unneeded backends +angle_enable_gl = false +angle_enable_d3d9 = false +angle_enable_d3d11 = false +angle_enable_null = false +angle_enable_metal = false +angle_enable_wgpu = false +angle_enable_swiftshader = false + +angle_enable_vulkan = true +angle_enable_essl = true +angle_enable_glsl = true + +# Other stuff +angle_has_frame_capture = false # Turns off frame capture (we don't use it, why would you?! Also turns off rapidJSON) +build_angle_deqp_tests = false # This was somehow being set to true, am forcing it false +angle_build_all = false # Why would we need all of it? (yes this is redundant) +# libcxx_abi_unstable = false # Apparently breaks std::string, doesn't seem to anymore. Comments mention this option causing slowdowns. diff --git a/out/android-x86/args.gn b/out/android-x86/args.gn new file mode 100644 index 00000000000..a32e5e2603c --- /dev/null +++ b/out/android-x86/args.gn @@ -0,0 +1,35 @@ +# Build arguments go here. +# See "gn args --list" for available build arguments. +# Standard boilerplate for our usage +target_os = "android" +target_cpu = "x86" + +is_component_build = false # Dynamically links dependencies, rather than static +is_debug = false # Sets as "release" build +angle_expose_non_conformant_extensions_and_versions = true # Enables ES3.2 +angle_build_tests = false # This is a big portion of the build time that is just never used because this goes into CI, so keep it off + +# Stops libs.uncompressed from being built, which is only when symbol_level != 0 +symbol_level = 0 + +# Stops ANGLE APKs from being built (we are never using those) +angle_standalone = false + +# Disable all unneeded backends +angle_enable_gl = false +angle_enable_d3d9 = false +angle_enable_d3d11 = false +angle_enable_null = false +angle_enable_metal = false +angle_enable_wgpu = false +angle_enable_swiftshader = false + +angle_enable_vulkan = true +angle_enable_essl = true +angle_enable_glsl = true + +# Other stuff +angle_has_frame_capture = false # Turns off frame capture (we don't use it, why would you?! Also turns off rapidJSON) +build_angle_deqp_tests = false # This was somehow being set to true, am forcing it false +angle_build_all = false # Why would we need all of it? (yes this is redundant) +# libcxx_abi_unstable = false # Apparently breaks std::string, doesn't seem to anymore. Comments mention this option causing slowdowns. diff --git a/out/ios-arm64/args.gn b/out/ios-arm64/args.gn new file mode 100644 index 00000000000..f67f8b219cb --- /dev/null +++ b/out/ios-arm64/args.gn @@ -0,0 +1,37 @@ +# Build arguments go here. +# See "gn args --list" for available build arguments. +# Standard boilerplate for our usage +target_os = "ios" +target_cpu = "arm64" +target_environment = "device" +ios_enable_code_signing = false # The github workflow isn't configured for this + +is_component_build = false # Dynamically links dependencies, rather than static +is_debug = false # Sets as "release" build +angle_expose_non_conformant_extensions_and_versions = true # Enables ES3.2 +angle_build_tests = false # This is a big portion of the build time that is just never used because this goes into CI, so keep it off + +# Stops libs.uncompressed from being built, which is only when symbol_level != 0 +symbol_level = 0 + +# Stops ANGLE APKs from being built (we are never using those) +angle_standalone = false + +# Disable all unneeded backends +angle_enable_gl = false +angle_enable_d3d9 = false +angle_enable_d3d11 = false +angle_enable_null = false +angle_enable_vulkan = false +angle_enable_wgpu = false +angle_enable_swiftshader = false + +angle_enable_metal = true +angle_enable_essl = true +angle_enable_glsl = true + +# Other stuff +angle_has_frame_capture = false # Turns off frame capture (we don't use it, why would you?! Also turns off rapidJSON) +build_angle_deqp_tests = false # This was somehow being set to true, am forcing it false +angle_build_all = false # Why would we need all of it? (yes this is redundant) +# libcxx_abi_unstable = false # Apparently breaks std::string, doesn't seem to anymore. Comments mention this option causing slowdowns.