Build ANGLE #41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build ANGLE | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [ opened, reopened ] | |
| workflow_dispatch: | |
| jobs: | |
| update-build-environment-cache: | |
| permissions: | |
| actions: write | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Check if cache is outdated | |
| run: | | |
| if (( $(date +%s) < $(( $(date -d "$(gh cache list -R AngelAuraMC/angle --json createdAt -q '.[0].createdAt')" +%s) + 604800 )) )); then | |
| echo "Not yet 1 week old, proceed" | |
| exit 78 | |
| else | |
| echo "Reverifying cache validity" | |
| fi | |
| - name: Restore environment from cache | |
| id: cached-environment-restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ./ | |
| key: ios_and_android-build-environment | |
| - name: Verify cached environment is valid | |
| 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 | |
| run: | | |
| rm -rf third_party/llvm_build # This only contains linux files if ran on a linux machine, has to be deleted so gclient can fetch it the files for macOS/iOS | |
| # Stupid workaround, see https://github.com/azu/github-actions-overwrite-cache-example and https://github.com/actions/cache/issues/342 | |
| - name: Delete Previous Cache | |
| run: | | |
| gh cache delete "${{ steps.cached-environment-restore.outputs.cache-primary-key }}" --repo $GITHUB_REPOSITORY | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Save environment to cache | |
| 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 |