Skip to content

Commit 96ef120

Browse files
feat: cherrypick .github/actions/depot_tools/action.yaml and .github/workflows/main.yaml from experiment-with-cache
1 parent 66f6a74 commit 96ef120

File tree

5 files changed

+50
-70
lines changed

5 files changed

+50
-70
lines changed

.github/actions/build/action.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ runs:
2727
steps:
2828
- name: GN gen
2929
run: |
30-
cd src
30+
cd cobalt/src
3131
cobalt/build/gn.py -p ${{ matrix.platform }} -C ${{ matrix.config }}
3232
shell: bash
3333
- name: List GN args
3434
run: |
35-
cd src
35+
cd cobalt/src
3636
gn args --list --short --overrides-only out/${{ matrix.platform }}_${{ matrix.config }}
3737
shell: bash
3838
- name: Get list of changed files
@@ -42,7 +42,7 @@ runs:
4242
CHANGED_FILES_LIST: changed_files.txt
4343
run: |
4444
set -x
45-
cd src
45+
cd cobalt/src
4646
# GitHub's actions/checkout action, by default, checks out the merge commit when
4747
# a pull request event triggers a workflow. This merge commit represents the state
4848
# of the code as if the pull request had been merged into the base branch.
@@ -63,7 +63,7 @@ runs:
6363
DYN_TEST_TARGETS_JSON_FILE: out/${{ matrix.platform }}_${{ matrix.config }}/dyn_targets.json
6464
run: |
6565
set -x
66-
cd src
66+
cd cobalt/src
6767
6868
# TODO: b/382508397 - Currently, override with static test targets
6969
cp -av "${STATIC_TEST_TARGETS_JSON_FILE}" "${{ inputs.test_targets_json_file }}"
@@ -105,7 +105,7 @@ runs:
105105
id: build-test-targets
106106
run: |
107107
set -ex
108-
cd src
108+
cd cobalt/src
109109
test_targets=$(echo '${{ steps.calculate-test-targets.outputs.test_targets_json }}' | jq -cr 'join(" ")')
110110
time autoninja -C out/${{ matrix.platform }}_${{ matrix.config }} ${test_targets}
111111
shell: bash
@@ -114,10 +114,13 @@ runs:
114114
TARGETS_JSON: ${{ inputs.targets }}
115115
run: |
116116
set -ex
117-
cd src
117+
cd cobalt/src
118118
TARGETS=$(echo "${TARGETS_JSON}" | jq -cr '. | join(" ")')
119119
time autoninja -C out/${{ matrix.platform }}_${{ matrix.config }} ${TARGETS}
120120
shell: bash
121+
- name: Check disk size
122+
run: df -h
123+
shell: bash
121124
- name: Archive Android APKs
122125
if: startsWith(matrix.platform, 'android') && matrix.config == 'qa'
123126
uses: actions/upload-artifact@v4
@@ -146,7 +149,7 @@ runs:
146149
BUILD_PLATFORM="android"
147150
else
148151
BUILD_PLATFORM="linux"
149-
cd src/
152+
cd cobalt/src/
150153
cobalt/build/gn.py -p linux-x64x11-no-starboard -c $MATRIX_CONFIG
151154
autoninja -C out/linux-x64x11-no-starboard_$MATRIX_CONFIG chrome/test/chromedriver
152155
cp out/linux-x64x11-no-starboard_$MATRIX_CONFIG/chromedriver out/${{ matrix.platform }}_${{ matrix.config }}

.github/actions/depot_tools/action.yaml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,25 @@ runs:
88
using: "composite"
99
steps:
1010
- name: Get depot tools
11-
run: git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
11+
run: |
12+
if [ -d "/gclient-sync-cache/depot_tools" ]; then
13+
echo "depot_tools directory found. Resetting repository..."
14+
git -C /gclient-sync-cache/depot_tools reset --hard origin/main
15+
else
16+
echo "depot_tools directory not found. Cloning repository..."
17+
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /gclient-sync-cache/depot_tools
18+
fi
1219
shell: bash
1320
- name: Bootstrap bundled python3
1421
run: |
1522
# Must be run manually as $DEPOT_TOOLS_UPDATE is 0 in CI, skipping the bootstrap.
16-
source depot_tools/bootstrap_python3 && bootstrap_python3
23+
source /gclient-sync-cache/depot_tools/bootstrap_python3 && bootstrap_python3
1724
shell: bash
1825
- name: Add depot tools to PATH
19-
run: echo "$GITHUB_WORKSPACE/depot_tools" >> $GITHUB_PATH
26+
run: echo "/gclient-sync-cache/depot_tools" >> $GITHUB_PATH
2027
shell: bash
2128
- name: Generate gclient file
22-
run: gclient config --name=src --custom-var=download_remoteexec_cfg=True --custom-var='rbe_instance="projects/cobalt-actions-prod/instances/default_instance"' https://github.com/${{ github.repository }}
29+
run: cd cobalt && gclient config --name=src --custom-var=download_remoteexec_cfg=True --custom-var='rbe_instance="projects/cobalt-actions-prod/instances/default_instance"' https://github.com/${{ github.repository }}
2330
shell: bash
2431
- name: Set target OS for Android
2532
if: ${{ contains(matrix.platform, 'android') }}
@@ -29,7 +36,13 @@ runs:
2936
shell: bash
3037
- name: gclient sync
3138
if: inputs.run_sync == 'true'
32-
run: gclient sync -v --shallow --no-history -r ${{ github.sha }}
39+
run: cd cobalt && gclient sync -v --shallow --no-history --nohooks -r ${{ github.sha }}
40+
shell: bash
41+
- name: gclient runhook
42+
if: inputs.run_sync == 'true'
43+
run: cd cobalt && gclient runhooks --verbose
44+
env:
45+
CIPD_CACHE_DIR: "/gclient-sync-cache/cobalt/.cipd_cache"
3346
shell: bash
3447
- name: Disable Chromium client side build telemetry
3548
run: build_telemetry opt-out

.github/config/android-arm.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
{
2525
"target": "web/living_room/kabuki/testing/end2end/browse:infra_smoke_test_custom_coat_boreal_non_shared",
2626
"test_attempts": "6"
27-
},
28-
{
29-
"target": "web/living_room/kabuki/testing/end2end/browse:infra_smoke_test_custom_coat_bravia",
30-
"test_attempts": "6"
3127
}
3228
],
3329
"test_dimensions": {

.github/workflows/evergreen.yaml

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
default: false
2323

2424
jobs:
25-
# evergreen-x64 is Evergreen on linux.
25+
# This is evergreen on linux
2626
evergreen-x64:
2727
uses: ./.github/workflows/main.yaml
2828
permissions:
@@ -34,43 +34,3 @@ jobs:
3434
run_api_leak_detector: true
3535
secrets:
3636
datadog_api_key: ${{ secrets.DD_API_KEY }}
37-
evergreen-arm-hardfp-raspi:
38-
uses: ./.github/workflows/main.yaml
39-
permissions:
40-
packages: write
41-
pull-requests: write
42-
with:
43-
platform: evergreen-arm-hardfp-raspi
44-
nightly: ${{ github.event.inputs.nightly }}
45-
secrets:
46-
datadog_api_key: ${{ secrets.DD_API_KEY }}
47-
evergreen-arm-hardfp-rdk:
48-
uses: ./.github/workflows/main.yaml
49-
permissions:
50-
packages: write
51-
pull-requests: write
52-
with:
53-
platform: evergreen-arm-hardfp-rdk
54-
nightly: ${{ github.event.inputs.nightly }}
55-
secrets:
56-
datadog_api_key: ${{ secrets.DD_API_KEY }}
57-
evergreen-arm-softfp:
58-
uses: ./.github/workflows/main.yaml
59-
permissions:
60-
packages: write
61-
pull-requests: write
62-
with:
63-
platform: evergreen-arm-softfp
64-
nightly: ${{ github.event.inputs.nightly }}
65-
secrets:
66-
datadog_api_key: ${{ secrets.DD_API_KEY }}
67-
evergreen-arm64:
68-
uses: ./.github/workflows/main.yaml
69-
permissions:
70-
packages: write
71-
pull-requests: write
72-
with:
73-
platform: evergreen-arm64
74-
nightly: ${{ github.event.inputs.nightly }}
75-
secrets:
76-
datadog_api_key: ${{ secrets.DD_API_KEY }}

.github/workflows/main.yaml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ jobs:
226226
# Builds, tags, and pushes Cobalt docker build images to ghr.
227227
docker-build-image:
228228
needs: [initialize]
229-
runs-on: [self-hosted, chrobalt-linux-runner]
229+
runs-on: [self-hosted, chrobalt-linux-runner-with-cache]
230230
steps:
231231
- name: Restore CI Essentials
232232
uses: actions/download-artifact@v4
@@ -247,7 +247,7 @@ jobs:
247247
docker-unittest-image:
248248
if: needs.initialize.outputs.test_on_host == 'true'
249249
needs: [initialize]
250-
runs-on: [self-hosted, chrobalt-linux-runner]
250+
runs-on: [self-hosted, chrobalt-linux-runner-with-cache]
251251
steps:
252252
- name: Restore CI Essentials
253253
uses: actions/download-artifact@v4
@@ -268,7 +268,7 @@ jobs:
268268
docker-webtest-image:
269269
if: needs.initialize.outputs.web_tests == 'true'
270270
needs: [initialize]
271-
runs-on: [self-hosted, chrobalt-linux-runner]
271+
runs-on: [self-hosted, chrobalt-linux-runner-with-cache]
272272
steps:
273273
- name: Restore CI Essentials
274274
uses: actions/download-artifact@v4
@@ -288,15 +288,18 @@ jobs:
288288
build:
289289
needs: [initialize, docker-build-image]
290290
permissions: {}
291-
runs-on: [self-hosted, chrobalt-linux-runner]
291+
runs-on: [self-hosted, chrobalt-linux-runner-with-cache]
292292
name: ${{ matrix.name }}_${{ matrix.config }}
293293
strategy:
294294
fail-fast: false
295295
matrix:
296296
platform: ${{ fromJson(needs.initialize.outputs.platforms) }}
297297
include: ${{ fromJson(needs.initialize.outputs.includes) }}
298298
config: ${{ fromJson(needs.initialize.outputs.build_configs) }}
299-
container: ${{ needs.docker-build-image.outputs.docker_tag }}
299+
container:
300+
image: ${{ needs.docker-build-image.outputs.docker_tag }}
301+
volumes:
302+
- /gclient-sync-cache:/gclient-sync-cache
300303
env:
301304
TEST_ARTIFACTS_KEY: ${{ matrix.platform }}_${{ matrix.name }}_test_artifacts
302305
DEPOT_TOOLS_UPDATE: 0
@@ -309,21 +312,26 @@ jobs:
309312
# filesystem, whereas /__w which contains Cobalt source code is on tmpfs.
310313
TMPDIR: /__w/_temp
311314
steps:
315+
- name: Prepare gclient cache directory
316+
run: |
317+
mkdir -p /gclient-sync-cache/cobalt/src
318+
ln -s /gclient-sync-cache/cobalt ${GITHUB_WORKSPACE}/cobalt
312319
- name: Checkout
313320
uses: actions/checkout@v4
314321
# TODO(bug?): android debug builds are broken.
315322
if: ${{ ! (contains(matrix.platform, 'android') && matrix.config == 'debug') }}
316323
with:
317-
path: src
324+
path: cobalt/src
318325
# Set fetch-depth to 2 to make checkout faster for pull requests and cobalt_sandbox repo.
319326
# Set fetch-dept to 0 for non pull request workflows in production repo which is needed
320327
# to properly calculate build id.
321328
fetch-depth: ${{ ( github.event_name == 'pull_request' || github.repository == 'youtube/cobalt_sandbox' ) && 2 || 0 }}
329+
clean: false
322330
- name: Set Up Depot Tools
323-
uses: ./src/.github/actions/depot_tools
331+
uses: ./cobalt/src/.github/actions/depot_tools
324332
- name: Build Cobalt
325333
id: build
326-
uses: ./src/.github/actions/build
334+
uses: ./cobalt/src/.github/actions/build
327335
# TODO(bug?): android debug builds are broken.
328336
if: ${{ ! (contains(matrix.platform, 'android') && matrix.config == 'debug') }}
329337
with:
@@ -335,7 +343,7 @@ jobs:
335343
upload_on_device_test_artifacts: ${{ matrix.config == 'devel' && ( needs.initialize.outputs.test_on_device == 'true' || needs.initialize.outputs.test_e2e == 'true' ) }}
336344
upload_web_test_artifacts: ${{ matrix.config == 'devel' && needs.initialize.outputs.web_tests == 'true' }}
337345
- name: Run API Leak Detector
338-
uses: ./src/.github/actions/api_leak_detector
346+
uses: ./cobalt/src/.github/actions/api_leak_detector
339347
if: inputs.run_api_leak_detector
340348

341349
on-device-test:
@@ -413,7 +421,7 @@ jobs:
413421
needs: [initialize, docker-unittest-image, build]
414422
if: needs.initialize.outputs.test_on_host == 'true'
415423
permissions: {}
416-
runs-on: [self-hosted, chrobalt-linux-runner]
424+
runs-on: [self-hosted, chrobalt-linux-runner-with-cache]
417425
name: ${{ matrix.name }}_on_host_tests_${{ matrix.shard }}
418426
strategy:
419427
fail-fast: false
@@ -449,7 +457,7 @@ jobs:
449457
needs: [initialize, docker-webtest-image, build]
450458
if: needs.initialize.outputs.web_tests == 'true'
451459
permissions: {}
452-
runs-on: [self-hosted, chrobalt-linux-runner]
460+
runs-on: [self-hosted, chrobalt-linux-runner-with-cache]
453461
name: ${{ matrix.name }}_web_tests
454462
strategy:
455463
fail-fast: false
@@ -467,11 +475,11 @@ jobs:
467475
with:
468476
path: src
469477
- name: Set Up Depot Tools
470-
uses: ./src/.github/actions/depot_tools
478+
uses: ./cobalt/src/.github/actions/depot_tools
471479
with:
472480
run_sync: false
473481
- name: Run Web Tests
474-
uses: ./src/.github/actions/web_tests
482+
uses: ./cobalt/src/.github/actions/web_tests
475483
with:
476484
test_artifacts_key: ${{ env.TEST_ARTIFACTS_KEY }}
477485
test_results_key: Blink Web Test Results ${{ github.workflow }}

0 commit comments

Comments
 (0)