Page MenuHomePhabricator

[native] Clean up after each Android Rust build in CI

Authored by ashoat on Sep 13 2023, 2:11 PM.
Referenced Files
Unknown Object (File)
Sun, Jul 7, 7:48 PM
Unknown Object (File)
Sat, Jul 6, 7:38 PM
Unknown Object (File)
Wed, Jul 3, 12:32 PM
Unknown Object (File)
Tue, Jul 2, 2:47 PM
Unknown Object (File)
Sun, Jun 30, 5:09 PM
Unknown Object (File)
Tue, Jun 25, 8:27 AM
Unknown Object (File)
Tue, Jun 25, 8:27 AM
Unknown Object (File)
Tue, Jun 25, 8:27 AM



Our GitHub Android workflows are once again running out of disk space. This diff modifies the Android CMake build to clear out build artifacts immediately after each of the three Rust builds (one for each build variant).

Test Plan

I tested 7 different workflows in my local environment. All builds were successful. After each build, I measured the size of the native/android/app/.cxx folder, and then deleted that folder before running the next test. Here are the results:

testcommanddisk utilization of native/android/app/.cxx
CI releaseCI=true yarn react-native run-android --variant=release1019 MiB
non-CI releaseyarn react-native run-android --variant=release2801 MiB
CI debugCI=true yarn react-native run-android1214 MiB
non-CI debugyarn react-native run-android5160 MiB
CI bundleReleaseCI=true ./gradlew bundleRelease1069 MiB
non-CI bundleRelease./gradlew bundleRelease2802 MiB
CI other variantCI=true yarn react-native run-android # with CMAKE_BUILD_TYPE forced to unsupported value5159 MiB

Based on the above data, this diff should reduce disk usage by 3.85 GiB on the GitHub Android CI, and by 1.69 GiB on the GitHub Android release workflow.

It’s possible that the environmental variables propagate differently in the actual CI environment, but I’m expecting this to work. It’s also possible that this diff doesn’t reduce disk usage enough, but I’m hoping it will.

Diff Detail

rCOMM Comm
Lint Not Applicable
Tests Not Applicable