Skip to content

Commit ea841e2

Browse files
committed
workflow: Simplify cacheing into one workflow
1 parent 60c043a commit ea841e2

2 files changed

Lines changed: 48 additions & 110 deletions

File tree

.github/workflows/build.yml

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,48 @@ on:
99
workflow_dispatch:
1010

1111
jobs:
12+
restore-build-environment:
13+
permissions:
14+
actions: write
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Restore environment from cache
18+
id: cached-environment-restore
19+
uses: actions/cache/restore@v4
20+
with:
21+
path: ./
22+
key: ios_and_android-build-environment
23+
- name: Verify cached environment is valid
24+
run: |
25+
if [ ! -d "depot_tools" ] ; then
26+
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
27+
fi
28+
export PATH="$PWD/depot_tools:$PATH"
29+
gclient config --spec 'solutions = [
30+
{
31+
"name": ".",
32+
"url": "https://chromium.googlesource.com/angle/angle.git",
33+
"deps_file": "DEPS",
34+
"managed": False,
35+
"custom_vars": {},
36+
},
37+
]
38+
target_os = ["ios", "android"]'
39+
gclient sync -Rf --no-history --with_branch_heads
40+
# Stupid workaround, see https://github.com/azu/github-actions-overwrite-cache-example and https://github.com/actions/cache/issues/342
41+
- name: Delete Previous Cache
42+
run: |
43+
gh cache delete "${{ steps.cached-environment-restore.outputs.cache-primary-key }}" --repo $GITHUB_REPOSITORY
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
- name: Save environment to cache
47+
uses: actions/cache/save@v4
48+
with:
49+
path: ./
50+
key: ios_and_android-build-environment
51+
1252
build:
53+
needs: restore-build-environment
1354
strategy:
1455
matrix:
1556
include:
@@ -32,51 +73,15 @@ jobs:
3273
steps:
3374
- name: Checkout
3475
uses: actions/checkout@v4
35-
- name: Cache third_party/llvm
36-
uses: actions/cache@v4
37-
with:
38-
path: third_party/llvm
39-
key: third_party-llvm
40-
- name: Cache third_party/VK-GL-CTS
41-
uses: actions/cache@v4
42-
with:
43-
path: third_party/VK-GL-CTS
44-
key: third_party-VK-GL-CTS
45-
- name: Cache third_party/SwiftShader
46-
uses: actions/cache@v4
47-
with:
48-
path: third_party/SwiftShader
49-
key: third_party-SwiftShader
50-
- name: Cache third_party/dawn
51-
uses: actions/cache@v4
52-
with:
53-
path: third_party/dawn
54-
key: third_party-dawn
55-
- name: Cache depot_tools
56-
uses: actions/cache@v4
76+
- name: Restore environment from cache
77+
id: cached-environment-restore
78+
uses: actions/cache/restore@v4
5779
with:
58-
path: depot_tools
59-
key: depot-tools
60-
# This should only be rarely ran so its here so the cache priority still is somewhat biggest to smallest
61-
- name: Install depot_tools
62-
run: |
63-
if [ ! -d "depot_tools" ] ; then
64-
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
65-
fi
66-
echo "$PWD/depot_tools" >> $GITHUB_PATH
67-
- name: Cache tools
68-
uses: actions/cache@v4
69-
with:
70-
path: tools
71-
key: tools
72-
- name: Cache build
73-
uses: actions/cache@v4
74-
with:
75-
path: build
76-
key: build
77-
78-
- name: Fetch ANGLE and dependencies
80+
path: ./
81+
key: ios_and_android-build-environment
82+
- name: Fetch and verify ANGLE dependencies
7983
run: |
84+
export PATH="$PWD/depot_tools:$PATH"
8085
gclient config --spec 'solutions = [
8186
{
8287
"name": ".",

.github/workflows/cache.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)