Repository navigation
252 lines (245 loc) · 10.7 KB
/
Copy pathandroid-update-qa.yml
File metadata and controls
252 lines (245 loc) · 10.7 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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
name: Android App Update QA Fixture
on:
# Reused by android-update-e2e.yml, which builds A/B here and then drives the
# real in-app update on a GitHub-hosted emulator.
workflow_call:
inputs:
source_sha:
required: true
type: string
fixture_generation:
required: true
type: string
version_major:
required: true
type: string
baseline_build:
required: true
type: string
target_build:
required: true
type: string
outputs:
baseline_artifact_name:
value: ${{ jobs.baseline.outputs.artifact_name }}
baseline_version_code:
value: ${{ jobs.baseline.outputs.version_code }}
baseline_version_name:
value: ${{ jobs.baseline.outputs.version_name }}
target_artifact_name:
value: ${{ jobs.target.outputs.artifact_name }}
target_version_code:
value: ${{ jobs.target.outputs.version_code }}
target_version_name:
value: ${{ jobs.target.outputs.version_name }}
target_apk_sha256:
value: ${{ jobs.target.outputs.apk_sha256 }}
workflow_dispatch:
inputs:
source_sha:
description: "Reviewed immutable 40-character commit SHA"
required: true
type: string
fixture_generation:
description: "Owner/run monotonic fixture generation"
required: true
type: string
version_major:
description: "Reserved QA major version (200-209); keep final versionCode below 2147483647"
required: true
type: string
# 2000 would give versionCode 20_000_000_000+, which the validate step rejects.
default: "200"
baseline_build:
description: "A build component"
required: true
type: string
default: "1"
target_build:
description: "B build component; must be greater than A"
required: true
type: string
default: "2"
permissions:
contents: read
actions: read
# Reusable-workflow permissions can only be maintained or reduced. The
# called Android release lane needs this to resolve the Kuikly package.
packages: read
jobs:
validate:
runs-on: ubuntu-latest
outputs:
source_sha: ${{ steps.inputs.outputs.source_sha }}
fixture_generation: ${{ steps.inputs.outputs.fixture_generation }}
version_major: ${{ steps.inputs.outputs.version_major }}
baseline_build: ${{ steps.inputs.outputs.baseline_build }}
target_build: ${{ steps.inputs.outputs.target_build }}
steps:
- name: Checkout version formula
uses: actions/checkout@v7
with:
sparse-checkout: scripts/ci
sparse-checkout-cone-mode: false
- id: inputs
shell: bash
run: |
set -euo pipefail
SOURCE="${{ inputs.source_sha }}"
GENERATION="${{ inputs.fixture_generation }}"
MAJOR="${{ inputs.version_major }}"
A="${{ inputs.baseline_build }}"
B="${{ inputs.target_build }}"
[[ "${SOURCE}" =~ ^[0-9a-f]{40}$ ]] || { echo "source_sha must be a full lowercase commit SHA" >&2; exit 1; }
[[ "${GENERATION}" =~ ^[1-9][0-9]*$ ]] || { echo "fixture_generation must be a positive integer" >&2; exit 1; }
[[ "${MAJOR}" =~ ^[1-9][0-9]*$ ]] || { echo "version_major must be a positive integer" >&2; exit 1; }
[[ "${A}" =~ ^[0-9]+$ && "${B}" =~ ^[0-9]+$ ]] || { echo "build components must be non-negative integers" >&2; exit 1; }
[ "${B}" -gt "${A}" ] || { echo "target_build must be greater than baseline_build" >&2; exit 1; }
A_CODE="$(scripts/ci/version_code.sh "${MAJOR}" 0 0 "${A}")"
B_CODE="$(scripts/ci/version_code.sh "${MAJOR}" 0 0 "${B}")"
[ "${B_CODE}" -lt 2147483647 ] || { echo "target versionCode exceeds Android maximum" >&2; exit 1; }
{
echo "source_sha=${SOURCE}"
echo "fixture_generation=${GENERATION}"
echo "version_major=${MAJOR}"
echo "baseline_build=${A}"
echo "target_build=${B}"
} >> "$GITHUB_OUTPUT"
baseline:
needs: validate
uses: ./.github/workflows/android-release.yml
secrets: inherit
with:
source_sha: ${{ needs.validate.outputs.source_sha }}
artifact_name: android-update-qa-a-apk
version_major: ${{ needs.validate.outputs.version_major }}
version_minor: "0"
version_patch: "0"
version_build: ${{ needs.validate.outputs.baseline_build }}
version_suffix: update-qa-a
hands_channel: debug
android_variant: release
release_mode: draft
create_hands_draft: false
create_share_page: false
target:
needs: validate
uses: ./.github/workflows/android-release.yml
secrets: inherit
with:
source_sha: ${{ needs.validate.outputs.source_sha }}
artifact_name: android-update-qa-b-apk
version_major: ${{ needs.validate.outputs.version_major }}
version_minor: "0"
version_patch: "0"
version_build: ${{ needs.validate.outputs.target_build }}
version_suffix: update-qa-b
hands_channel: debug
android_variant: release
release_mode: draft
create_hands_draft: false
create_share_page: false
manifest:
needs: [validate, baseline, target]
runs-on: ubuntu-latest
steps:
- name: Create immutable build-pair manifest
env:
SOURCE_SHA: ${{ needs.validate.outputs.source_sha }}
FIXTURE_GENERATION: ${{ needs.validate.outputs.fixture_generation }}
A_ARTIFACT_NAME: ${{ needs.baseline.outputs.artifact_name }}
A_ARTIFACT_ID: ${{ needs.baseline.outputs.artifact_id }}
A_MEMBER: ${{ needs.baseline.outputs.apk_member }}
A_SHA256: ${{ needs.baseline.outputs.apk_sha256 }}
A_SIZE: ${{ needs.baseline.outputs.apk_size }}
A_VERSION_NAME: ${{ needs.baseline.outputs.version_name }}
A_VERSION_CODE: ${{ needs.baseline.outputs.version_code }}
A_PACKAGE_ID: ${{ needs.baseline.outputs.package_id }}
A_MIN_SDK: ${{ needs.baseline.outputs.min_sdk }}
A_TARGET_SDK: ${{ needs.baseline.outputs.target_sdk }}
A_SIGNERS_JSON: ${{ needs.baseline.outputs.signer_cert_sha256_json }}
A_VERIFIED_V2: ${{ needs.baseline.outputs.verified_v2 }}
A_VERIFIED_V3: ${{ needs.baseline.outputs.verified_v3 }}
A_VERIFIED_V31: ${{ needs.baseline.outputs.verified_v31 }}
B_ARTIFACT_NAME: ${{ needs.target.outputs.artifact_name }}
B_ARTIFACT_ID: ${{ needs.target.outputs.artifact_id }}
B_MEMBER: ${{ needs.target.outputs.apk_member }}
B_SHA256: ${{ needs.target.outputs.apk_sha256 }}
B_SIZE: ${{ needs.target.outputs.apk_size }}
B_VERSION_NAME: ${{ needs.target.outputs.version_name }}
B_VERSION_CODE: ${{ needs.target.outputs.version_code }}
B_PACKAGE_ID: ${{ needs.target.outputs.package_id }}
B_MIN_SDK: ${{ needs.target.outputs.min_sdk }}
B_TARGET_SDK: ${{ needs.target.outputs.target_sdk }}
B_SIGNERS_JSON: ${{ needs.target.outputs.signer_cert_sha256_json }}
B_VERIFIED_V2: ${{ needs.target.outputs.verified_v2 }}
B_VERIFIED_V3: ${{ needs.target.outputs.verified_v3 }}
B_VERIFIED_V31: ${{ needs.target.outputs.verified_v31 }}
shell: bash
run: |
set -euo pipefail
[ "${{ needs.baseline.outputs.source_sha }}" = "${SOURCE_SHA}" ]
[ "${{ needs.target.outputs.source_sha }}" = "${SOURCE_SHA}" ]
[ "${B_VERSION_CODE}" -gt "${A_VERSION_CODE}" ]
[ "${A_PACKAGE_ID}" = "build.raft.app" ]
[ "${B_PACKAGE_ID}" = "${A_PACKAGE_ID}" ]
[ "${B_MIN_SDK}" = "${A_MIN_SDK}" ]
[ "${B_TARGET_SDK}" = "${A_TARGET_SDK}" ]
[ "${A_SIGNERS_JSON}" = "${B_SIGNERS_JSON}" ]
[ "${A_VERIFIED_V2}" = "true" ]
[ "${A_VERIFIED_V3}" = "true" ]
[ "${A_VERIFIED_V31}" = "true" ]
[ "${B_VERIFIED_V2}" = "true" ]
[ "${B_VERIFIED_V3}" = "true" ]
[ "${B_VERIFIED_V31}" = "true" ]
jq -n \
--arg source "${SOURCE_SHA}" \
--arg run "${GITHUB_RUN_ID}" \
--arg generation "${FIXTURE_GENERATION}" \
--arg aArtifact "${A_ARTIFACT_NAME}" \
--arg aArtifactId "${A_ARTIFACT_ID}" \
--arg aMember "${A_MEMBER}" \
--arg aSha "${A_SHA256}" \
--argjson aSize "${A_SIZE}" \
--arg aName "${A_VERSION_NAME}" \
--argjson aCode "${A_VERSION_CODE}" \
--argjson aSigners "${A_SIGNERS_JSON}" \
--argjson minSdk "${A_MIN_SDK}" \
--argjson targetSdk "${A_TARGET_SDK}" \
--arg bArtifact "${B_ARTIFACT_NAME}" \
--arg bArtifactId "${B_ARTIFACT_ID}" \
--arg bMember "${B_MEMBER}" \
--arg bSha "${B_SHA256}" \
--argjson bSize "${B_SIZE}" \
--arg bName "${B_VERSION_NAME}" \
--argjson bCode "${B_VERSION_CODE}" \
--argjson bSigners "${B_SIGNERS_JSON}" \
'{
schema_version: 1,
kind: "android-app-update-build-pair",
fixture_generation: ($generation | tonumber),
source_commit: $source,
github_run_id: $run,
package_id: "build.raft.app",
min_sdk: $minSdk,
target_sdk: $targetSdk,
build_variant: "release",
hands_app_slug: "raft-android",
hands_channel_slug: "debug",
hands_delta_update_enabled: false,
external_writes: false,
baseline: {role: "A", artifact_id: $aArtifactId, artifact_name: $aArtifact, member: $aMember, apk_sha256: $aSha, size_bytes: $aSize, version_name: $aName, version_code: $aCode, signer_lineage_sha256: $aSigners, verified_v2: true, verified_v3: true, verified_v31: true},
target: {role: "B", artifact_id: $bArtifactId, artifact_name: $bArtifact, member: $bMember, apk_sha256: $bSha, size_bytes: $bSize, version_name: $bName, version_code: $bCode, signer_lineage_sha256: $bSigners, verified_v2: true, verified_v3: true, verified_v31: true},
distribution: null
}' > android-app-update-build-pair.json
jq empty android-app-update-build-pair.json
sha256sum android-app-update-build-pair.json > android-app-update-build-pair.json.sha256
- name: Upload build-pair manifest
uses: actions/upload-artifact@v7
with:
name: android-update-qa-fixture
path: |
android-app-update-build-pair.json
android-app-update-build-pair.json.sha256
if-no-files-found: error
retention-days: 14