xref: /aosp_15_r20/external/perfetto/docs/contributing/sdk-releasing.md (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1# Making a new SDK release
2
3This guide shows how to make a new Perfetto SDK release.
4
5Before snapshotting a release, check that no [release-blockers](http://b/savedsearches/5776355) are
6open.
7
8Check out the code:
9
10```bash
11git clone https://android.googlesource.com/platform/external/perfetto
12cd perfetto
13```
14
15Next, decide the version number for the new release (vX.Y).
16The major version number (X) is incremented on every release (monthly).
17The minor version number is incremented only for minor changes / fixes on top of the monthly
18release (cherry-picks on the releases/vN.x branch).
19
20Continue with the appropriate section below.
21
22## a) Creating a new major version
23
24Make sure that the current main branch builds on
25[LUCI](https://luci-scheduler.appspot.com/jobs/perfetto) by triggering all the
26builds and waiting for their success. If any of the builds fail, fix the failure
27on main before proceeding.
28
29Create an entry in CHANGELOG with the new major version: this usually involves
30renaming the "Unreleased" entry to the version number you chose earlier
31([example](https://r.android.com/2417175)).
32
33Test that the perfetto build tools can parse the CHANGELOG: after building,
34running `perfetto --version` should show your new version number.
35
36Upload the CHANGELOG change and submit it on the main branch.
37
38Create a release branch for the new major version ("v16.x" here):
39
40```bash
41git fetch origin
42git push origin origin/main:refs/heads/releases/v16.x
43git fetch origin
44git checkout -b releases/v16.x -t origin/releases/v16.x
45```
46
47Continue with [building the release](#building-and-tagging-the-release).
48
49## b) Bumping the minor version
50
51Check out the existing release branch ("5.x" here) and merge in the desired
52revision for the new release, resolving any conflicts you may encounter.
53
54```bash
55git checkout -b releases/v16.x -t origin/releases/v16.x
56```
57
58If you only want to introduce one or two patches in the new release, consider
59cherry-picking them individually:
60
61```bash
62git cherry-pick <sha1>
63```
64
65Otherwise, you can do a full merge:
66
67```bash
68git merge <sha1>
69```
70
71Update the CHANGELOG with a dedicated entry for the new minor version.
72This is important because the
73[write_version_header.py](/tools/write_version_header.py) script, which is
74invoked by the build system, looks at the CHANGELOG to work out the latest
75v${maj}.${min} version.
76
77For an example see [r.android.com/1730332](https://r.android.com/1730332)
78
79```txt
80v16.1 - 2021-06-08:
81  Tracing service and probes:
82    * Cherry-pick of r.android.com/1716718 which missed the v16 branch ... .
83
84
85v16.0 - 2021-06-01:
86  ...
87```
88
89## Building and tagging the release
90
911. Generate and commit the amalgamated source files.
92
93```bash
94tools/gen_amalgamated --output sdk/perfetto
95git add sdk/perfetto.{cc,h}
96git commit -m "Amalgamated source for vX.Y"
97```
98
992. Check that the SDK example code works with the new release.
100
101```bash
102cd examples/sdk
103cmake -B build
104cmake --build build
105```
106
1073. Upload the new release for review.
108
109```bash
110git cl upload --no-squash --bypass-hooks -o banned-words~skip
111```
112
113If you get an error about a missing Change-Id field (`remote: ERROR: commit
114a7c7c4c: missing Change-Id in message footer`), install the commit-msg hook
115script and amend the change to make sure that field is present:
116
117```bash
118curl -Lo .git/hooks/commit-msg http://android-review.googlesource.com/tools/hooks/commit-msg
119chmod u+x .git/hooks/commit-msg
120git commit --amend
121```
122
1234. Once the release has been reviewed and landed, create and push the tag for
124   it ("vX.Y" being the new version).
125
126```bash
127# This brings the branch up to date with the CL landed in the step above.
128git pull
129
130git status
131# Should print: Your branch is up to date with 'origin/releases/v16.x'.
132# Do NOT proceed if your branch has diverged from origin/releases/vX.X
133
134git tag -a -m "Perfetto vX.Y" vX.Y
135git push origin vX.Y
136```
137
1385. Update the documentation to point to the latest release.
139
140   - [docs/instrumentation/tracing-sdk.md](/docs/instrumentation/tracing-sdk.md)
141   - [examples/sdk/README.md](/examples/sdk/README.md)
142
1436. Send an email with the CHANGELOG to perfetto-dev@ (internal) and to the
144   [public perfetto-dev](https://groups.google.com/forum/#!forum/perfetto-dev).
145
146## Creating a GitHub release with prebuilts
147
1487. Within few mins the LUCI scheduler will trigger builds of prebuilt binaries
149   on https://luci-scheduler.appspot.com/jobs/perfetto . Wait for all the bots
150   to have completed successfully and be back into the WAITING state.
151
1528. Run `tools/package-prebuilts-for-github-release vX.Y`. It will pull the
153   prebuilts under `/tmp/perfetto-prebuilts-vX.Y`.
154  - There must be 10 zips in total: linux-{arm,arm64,amd64},
155    android-{arm,arm64,x86,x64}, mac-{amd64,arm64}, win-amd64.
156  - If one or more are missing it means that one of the LUCI bots failed,
157    check the logs (follow the "Task URL: " link) from the invocation log.
158  - If this happens you'll need to respin a vX.(Y+1) release with the fix
159    (look at the history v20.1, where a Windows failure required a respin).
160
1619. Open https://github.com/google/perfetto/releases/new and
162  - Select "Choose Tag" -> vX.Y
163  - "Release title" -> "Perfetto vX.Y"
164  - "Describe release" -> Copy the CHANGELOG, wrapping it in triple backticks.
165  - "Attach binaries" -> Attach the ten .zip files from the previous step.
166
16710. Run `tools/roll-prebuilts vX.Y`. It will update the SHA256 into the various
168   scripts under `tools/`. Upload a CL with the changes.
169
17011. Phew, you're done!
171