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

Reduce size of CI builds #1253

Merged
merged 12 commits into from
Feb 20, 2025
Merged

Conversation

mjoerussell
Copy link
Contributor

The goal of this PR is to reduce the size of our build artifacts in CI to avoid failures due to lack of disk space. This has been a sporadic issue for a while, but it's become unavoidable starting with #1225, which is constantly running out of space. That's because the new version of JCO that it's bringing in is too large. We can build the project in release mode in CI to compensate for this.

I've added some extra logic in infra_cli when running cargo commands to append a --release flag when running in CI (indicated with the environment variable CI). I also added a new flag to use in the infra script (scripts/bin/infra), SLANG_INFRA_RELEASE, which will cause the infra crates to be built in release mode too when set. With both of these changes we can get the project size down to ~13 Gb with either version of JCO. This keeps us under the 14 Gb threshold.


Built with JCO rev. d1b3344 (what main points to currently)

Command Total project size
infra ci 16 Gb
CI=true infra ci 14 Gb
CI=true SLANG_INFRA_RELEASE=true infra ci 13 Gb

Built with JCO rev b7818f3 (new rev that will come in once #1225 is complete)

Command Total project size
infra ci 17 Gb
CI=true infra ci 14 Gb
CI=true SLANG_INFRA_RELEASE=true infra ci 13 Gb

I've also moved the generation of public_api.txt out of the unit tests and in to a new step, infra lint public-api. I chose infra lint because this is where the rustdocs are currently generated. This makes the api docs generation a bit more visible and therefore easier to debug, and also helps with unit test execution times.

Generating these docs causes debug artifacts to be generated - 1.2 Gb worth, by my measurements. We might be able to reduce the overall project size further by building this in release mode too, however the crate we call which runs cargo to generate these does not provide an API to do so. I believe that we could remove this crate entirely and generate the rustdoc json file ourselves, but it didn't seem necessary here and is outside the pure scope of this change so I left it as-is for now.

github-actions added 3 commits February 14, 2025 16:01
…lease builds. The debug builds, especially for JCO, took >10 Gb total space.
…he unit tests. This should improve test run times and avoid sporadic failures due to slowness, and make the api generation easier to debug by making it more visible.
…riable `SLANG_INFA_RELEASE` is set. This can save about another GB of storage compared to building infra in debug mode.

infra crates will still be built in debug mode by default. There's no significant speedup when building in release mode since infra itself is not doing much.
@mjoerussell mjoerussell requested review from a team as code owners February 18, 2025 23:47
Copy link

changeset-bot bot commented Feb 18, 2025

⚠️ No Changeset found

Latest commit: 3c96a1a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@OmarTawfik OmarTawfik left a comment

Choose a reason for hiding this comment

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

Left a few suggestions/questions.

github-actions added 6 commits February 19, 2025 09:07
Move the public_api infra invocation from lint to check
…e `--release` flag as part of `add_rust_buildflags()`.
* Modify script so that CI flag existence doesn't need to be checked/validated before calling `set -u`
… if some debug artifacts are not present.

To achieve similar size savings, we'll run cargo clean and delete `target/wasm32-wasip1/debug` at the end of jco setup.
@mjoerussell mjoerussell added this pull request to the merge queue Feb 20, 2025
Merged via the queue into NomicFoundation:main with commit ed709b4 Feb 20, 2025
2 checks passed
@mjoerussell mjoerussell deleted the feature/small-ci branch February 20, 2025 15:54
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