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).
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:
|test||command||disk utilization of native/android/app/.cxx|
|CI release||CI=true yarn react-native run-android --variant=release||1019 MiB|
|non-CI release||yarn react-native run-android --variant=release||2801 MiB|
|CI debug||CI=true yarn react-native run-android||1214 MiB|
|non-CI debug||yarn react-native run-android||5160 MiB|
|CI bundleRelease||CI=true ./gradlew bundleRelease||1069 MiB|
|non-CI bundleRelease||./gradlew bundleRelease||2802 MiB|
|CI other variant||CI=true yarn react-native run-android # with CMAKE_BUILD_TYPE forced to unsupported value||5159 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.