Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release automation #932

Merged
merged 5 commits into from
Jul 20, 2023
Merged

Release automation #932

merged 5 commits into from
Jul 20, 2023

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jul 20, 2023

This PR adds a release script to the project.

The script is inspired from what we have on Element Android, and adapted, now that we are using app bundles.

The CI (GutHub action) is still building the bundle, and this is the longest part of the process. For the rest, it's quite straight forward and took only a few minutes to run the script (when there is no error).

Note: I had to split the version computation in Versions.kt, for simplification. VersionCode and VersionName was not matching.

@bmarty bmarty requested a review from jmartinesp July 20, 2023 11:33
@bmarty bmarty requested a review from a team as a code owner July 20, 2023 11:33
print("❌ Error(s) occurred, please check the log")
exit(1)
else:
print("Done!")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link:

@bmarty
Copy link
Member Author

bmarty commented Jul 20, 2023

@jmartinesp if you want to test the script, you can run it, and ensure to answer no each time the script is asking to push the branch. At the end you can reset develop, main and delete the created tag, to cleanup your local env. Or just work on a fresh clone that you will delete at the end.

For the GH artifact, when it will be asked, you can use the one from this action run: https://github.com/vector-im/element-x-android/suites/14436763171/artifacts/814828102 since the GH action will not be triggered (since you will not push main).

Let me know if you have any question!

@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (19f6396) 56.59% compared to head (b98d57c) 56.59%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #932   +/-   ##
========================================
  Coverage    56.59%   56.59%           
========================================
  Files          968      968           
  Lines        24570    24570           
  Branches      4987     4987           
========================================
  Hits         13905    13905           
  Misses        8456     8456           
  Partials      2209     2209           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.


printf "\n================================================================================\n"
printf "Building the bundle locally first...\n"
./gradlew clean bundleRelease
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting OOM errors while building. Maybe we should bump the heap size, either globally or just for this command? Also, the result of this step is not checked before continuing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting OOM errors while building

I probably have a local config somewhere which avoid that. The idea of this line is to detect in advance if the CI will fail. I will see how to fix this issue, but since I do not encounter it, maybe you can propose a fix?

the result of this step is not checked before continuing

Any failure should break the script now (there is no set +e statement), so I think it's fine, but I can double check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you can propose a fix?

The CI is actually using 3GB of RAM (-Xmx3072m) while we're using 2GB locally (-Xmx2048m), so we could increase that. It would also be great if we could override this value locally, but I couldn't find an easy way to do it when I last checked.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried again and it built fine using just the default 2GB now. Then I decreased to 1GB to force an OOM error and the script continues after gradle fails:

* What went wrong:
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable
   > java.lang.OutOfMemoryError (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 37s
1868 actionable tasks: 552 executed, 1039 from cache, 277 up-to-date

================================================================================
Running towncrier...
Loading template...
Finding news fragments...
Rendering news fragments...
Writing to newsfile...
Staging newsfile...
Removing news fragments...
I want to remove the following files:
Is it okay if I remove those files? [Y/n]: Done!

================================================================================
Check the file CHANGES.md consistency. It's possible to reorder items (most important changes first) or change their section if relevant. Also an opportunity to fix some typo, or rewrite things. Do not commit your change. Press enter when it's done.

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works well overall, but I had to run it several times to get to the end of the process because there are a few minor issues.

…dalone) and do not use `-t` which does not seem to be standard.
Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I don't think the issue about the script continuing when gradle fails is a blocker at this point, since it's easy to spot and react.

@jmartinesp
Copy link
Member

Also, we might want to add some docs about using git-flow-avh instead of git-flow.

@bmarty
Copy link
Member Author

bmarty commented Jul 20, 2023

Since the repo is not maintained anymore, I am now using git-flow instead of git-flow-avh.

I have update the script consequently and it's working fine on my side.

@bmarty bmarty enabled auto-merge July 20, 2023 17:55
@sonarcloud
Copy link

sonarcloud bot commented Jul 20, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@bmarty bmarty merged commit 33788fb into develop Jul 20, 2023
@bmarty bmarty deleted the feature/bma/releaseAutomation2 branch July 20, 2023 18:15
@bmarty bmarty mentioned this pull request Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants