-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathactions_diff.txt
More file actions
199 lines (193 loc) · 9.11 KB
/
actions_diff.txt
File metadata and controls
199 lines (193 loc) · 9.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
diff '--color=auto' -r -u real_dotgithub/actions/build/action.yaml dotgithub/actions/build/action.yaml
--- real_dotgithub/actions/build/action.yaml 2025-12-11 23:04:19.991798214 +0000
+++ dotgithub/actions/build/action.yaml 2025-12-13 08:58:50.312695975 +0000
@@ -1,125 +1,22 @@
-name: Build Cobalt
-description: Builds Cobalt targets
+name: 'Build Cobalt'
+description: 'Mocks the Cobalt build by providing static test targets.'
inputs:
- targets:
- description: "JSON list of ninja targets for Cobalt build."
- required: true
- test_root_target:
- description: "The root target from which to deduce what tests to run."
- required: true
- test_targets_json_file:
- description: "The path to the file the test targets are written to."
+ config:
+ description: 'The config to build.'
+ required: false
+ default: 'devel'
+ platform:
+ description: 'The platform to build.'
required: true
+
runs:
using: "composite"
steps:
- - name: Clean out dir from previous runner
- run: |
- rm -rf cobalt/src/out
- shell: bash
- - name: GN gen
- run: |
- cd cobalt/src
- cobalt/build/gn.py -p ${{ matrix.platform }} -C ${{ matrix.config }}
- shell: bash
- - name: List GN args
- run: |
- cd cobalt/src
- gn args --list --short --overrides-only out/${{ matrix.platform }}_${{ matrix.config }}
- shell: bash
- - name: Get list of changed files
- if: github.event_name == 'pull_request'
- id: changed-files
- env:
- CHANGED_FILES_LIST: changed_files.txt
- run: |
- set -x
- cd cobalt/src
- # GitHub's actions/checkout action, by default, checks out the merge commit when
- # a pull request event triggers a workflow. This merge commit represents the state
- # of the code as if the pull request had been merged into the base branch.
- # Setting fetch-depth to 2 effectively gets a merge commit (i.e. HEAD) and the
- # HEAD commit from the base branch (i.e. HEAD~1).
- git diff --name-only HEAD~1 HEAD > ${CHANGED_FILES_LIST}
- cat ${CHANGED_FILES_LIST}
- shell: bash
- - name: Calculate test targets
- # TODO(b/382508397): Ignore test_root_target until test target listing is dynamic.
- if: matrix.config == 'devel' # && inputs.test_root_target != 'null'
- id: calculate-test-targets
- env:
- CHANGED_FILES_LIST: changed_files.txt
- ROOT_TARGET: ${{ inputs.test_root_target }}
- STATIC_TEST_TARGETS_JSON_FILE: cobalt/build/testing/targets/${{ matrix.platform }}/test_targets.json
- # TODO(b/382508397): Replace hardcoded list with dynamically generated one.
- DYN_TEST_TARGETS_JSON_FILE: out/${{ matrix.platform }}_${{ matrix.config }}/dyn_targets.json
- run: |
- set -x
- cd cobalt/src
-
- if [[ ! -f "${STATIC_TEST_TARGETS_JSON_FILE}" ]]; then
- echo "Static test targets file not found at ${STATIC_TEST_TARGETS_JSON_FILE}. Skipping step."
- echo "test_targets_count=0" >> $GITHUB_OUTPUT
- exit 0
- fi
-
- # TODO: b/382508397 - Currently, override with static test targets
- cp -av "${STATIC_TEST_TARGETS_JSON_FILE}" "${{ inputs.test_targets_json_file }}"
-
- # gn desc out/${{ matrix.platform }}_${{ matrix.config }}/ "*" --format=json > gn_desc.json
- # # Trim any warning gn printed before the json (all lines above the first curly brace).
- # sed -n '/^{/,$p' -i gn_desc.json
-
- # changed_files_arg=""
-
- # TODO(oxv): If this list is too it will blow out the command line. Pass list in a file to the script instead.
- # Since the output of the script below isn't currently used the arg is disabled.
- # if [[ -s "${CHANGED_FILES_LIST}" ]]; then
- # changed_files_arg="--sources $(cat ${CHANGED_FILES_LIST} | jq -cr '. | join(",")')"
- # fi
-
- # vpython3 cobalt/build/test_targets.py \
- # --root-target "${ROOT_TARGET}" \
- # ${changed_files_arg} \
- # --gn-json gn_desc.json \
- # --json-output > "${DYN_TEST_TARGETS_JSON_FILE}"
-
-
- test_targets_json=$(cat ${{ inputs.test_targets_json_file }} | jq -cr '.test_targets')
- echo "test_targets_json=${test_targets_json}" >> $GITHUB_OUTPUT
-
- test_targets_count=$(echo ${test_targets_json} | jq -cr 'length')
- echo "test_targets_count=${test_targets_count}" >> $GITHUB_OUTPUT
- shell: bash
- - name: Archive test target JSON
- uses: actions/upload-artifact@v4
- with:
- name: ${{ matrix.platform }}_test_targets_json
- path: cobalt/src/out/${{ matrix.platform }}_${{ matrix.config }}/test_targets.json
- - name: Ninja build test targets
- if: ${{ matrix.config == 'devel' && fromJSON(steps.calculate-test-targets.outputs.test_targets_count || 0) > 0 }}
- id: build-test-targets
- run: |
- set -ex
- cd cobalt/src
- test_targets=$(echo '${{ steps.calculate-test-targets.outputs.test_targets_json }}' | jq -cr 'join(" ")')
- time autoninja -C out/${{ matrix.platform }}_${{ matrix.config }} ${test_targets}
- shell: bash
- - name: Ninja build
- env:
- TARGETS_JSON: ${{ inputs.targets }}
- run: |
- set -ex
- cd cobalt/src
- TARGETS=$(echo "${TARGETS_JSON}" | jq -cr '. | join(" ")')
- time autoninja -C out/${{ matrix.platform }}_${{ matrix.config }} ${TARGETS}
- shell: bash
- - name: Archive Android APKs
- if: startsWith(matrix.platform, 'android') && matrix.config == 'qa'
- uses: actions/upload-artifact@v4
- with:
- name: ${{ matrix.platform }} APKs
- path: |
- cobalt/src/out/${{ matrix.platform }}_qa/apks/*.apk
- cobalt/src/out/${{ matrix.platform }}_qa/*_apk/*.apk
- cobalt/src/out/${{ matrix.platform }}_qa/gen/build_info.json
+ - name: Copy Test Targets
+ shell: bash
+ run: |
+ echo "Mocking build for ${{ inputs.platform }} ${{ inputs.config }}"
+ mkdir -p out/${{ inputs.platform }}_${{ inputs.config }}
+ # Copy the pre-seeded file from dotgithub/resources
+ # Note: We assume the checkout root is available.
+ cp dotgithub/resources/test_targets.json out/${{ inputs.platform }}_${{ inputs.config }}/test_targets.json
diff '--color=auto' -r -u real_dotgithub/actions/depot_tools/action.yaml dotgithub/actions/depot_tools/action.yaml
--- real_dotgithub/actions/depot_tools/action.yaml 2025-12-11 23:04:18.449343262 +0000
+++ dotgithub/actions/depot_tools/action.yaml 2025-12-09 19:21:03.962228881 +0000
@@ -19,7 +19,6 @@
run: |
rm -rf /runner-cache/depot_tools /runner-cache/cobalt/.cipd_cache
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /runner-cache/depot_tools
- git -C /runner-cache/cobalt/src clean -ffdx
shell: bash
- name: Reset Cached Depot Tools
@@ -69,7 +68,6 @@
--no-history \
--nohooks \
--force \
- --delete_unversioned_trees \
--revision ${{ github.sha }}
shell: bash
diff '--color=auto' -r -u real_dotgithub/actions/docker/action.yaml dotgithub/actions/docker/action.yaml
--- real_dotgithub/actions/docker/action.yaml 2025-12-10 19:17:09.350587415 +0000
+++ dotgithub/actions/docker/action.yaml 2025-12-09 20:42:32.831550237 +0000
@@ -42,18 +42,23 @@
shell: bash
- name: Login to GAR
+ continue-on-error: true
run: |
# Login to GAR
TOKEN_ENDPOINT="http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token"
- ACCESS_TOKEN=$(curl -H 'Metadata-Flavor: Google' ${TOKEN_ENDPOINT} | jq -r .access_token)
+ if curl -s --connect-timeout 2 ${TOKEN_ENDPOINT} > /dev/null; then
+ ACCESS_TOKEN=$(curl -H 'Metadata-Flavor: Google' ${TOKEN_ENDPOINT} | jq -r .access_token)
- # Login to GAR to be able to push images created by fork based PR workflows.
- if [[ "${{ inputs.is_pr }}" == "true" ]]; then
- printf ${ACCESS_TOKEN} | docker login -u oauth2accesstoken --password-stdin https://us-central1-docker.pkg.dev
- fi
+ # Login to GAR to be able to push images created by fork based PR workflows.
+ if [[ "${{ inputs.is_pr }}" == "true" ]]; then
+ printf ${ACCESS_TOKEN} | docker login -u oauth2accesstoken --password-stdin https://us-central1-docker.pkg.dev
+ fi
- # Login to Marketplace GAR to be able to pull base images.
- printf ${ACCESS_TOKEN} | docker login -u oauth2accesstoken --password-stdin https://marketplace.gcr.io
+ # Login to Marketplace GAR to be able to pull base images.
+ printf ${ACCESS_TOKEN} | docker login -u oauth2accesstoken --password-stdin https://marketplace.gcr.io
+ else
+ echo "Skipping GAR login as metadata endpoint is not reachable."
+ fi
shell: bash
- name: Login to GitHub Docker Registry