Skip to content

ci: speed up GitHub Actions builds (~14m → ~3-5m warm)#136

Merged
senamakel merged 20 commits into
tinyhumansai:mainfrom
senamakel:fix/improve-gh-builds
Mar 31, 2026
Merged

ci: speed up GitHub Actions builds (~14m → ~3-5m warm)#136
senamakel merged 20 commits into
tinyhumansai:mainfrom
senamakel:fix/improve-gh-builds

Conversation

@senamakel
Copy link
Copy Markdown
Member

Summary

  • Replace manual Cargo registry cache with Swatinem/rust-cache@v2 — caches target/ directories for both core and Tauri crates, giving near-instant Rust steps on cache hits
  • Add sccache (mozilla-actions/sccache-action) for cross-branch compilation unit caching
  • Install mold linker on Linux CI runners for faster linking (~5-10x vs default ld)
  • Use CI-optimized build profileopt-level=1, codegen-units=16, no LTO (trades runtime perf for compile speed in CI)
  • Skip bundle packaging in CI builds (--bundles none) since artifacts aren't used
  • Fix duplicate workflow runs — restrict push triggers to main only; PRs already trigger on pull_request, so feature branch pushes no longer run checks twice

Expected impact

Scenario Before After
Cold build (no cache) ~14 min ~8-9 min
Warm build (Rust source changed) ~14 min ~3-5 min
Frontend-only PR ~14 min ~1-2 min

Files changed

  • .github/workflows/build.yml — rust-cache, sccache, mold, ci profile, --bundles none
  • .github/workflows/test.yml — rust-cache, sccache, mold, ci profile for sidecar
  • .github/workflows/typecheck.yml — rust-cache, sccache for clippy job, fix triggers
  • Cargo.toml[profile.ci] section (already in prior commit)
  • app/src-tauri/Cargo.toml[profile.ci] section (already in prior commit)
  • .cargo/config.toml — mold linker for Linux (already in prior commit)
  • app/src-tauri/.cargo/config.toml — mold linker for Linux (already in prior commit)

Test plan

  • First CI run on this PR will be a cold build — expect ~8-9 min
  • Push a follow-up commit to verify warm cache — expect ~3-5 min
  • Verify sccache stats appear in job logs
  • Verify no duplicate workflow runs on the PR

🤖 Generated with Claude Code

senamakel and others added 20 commits March 31, 2026 12:19
- Introduced a new `[profile.ci]` section in both root and Tauri Cargo.toml files to optimize build settings for continuous integration.
- Adjusted compilation parameters to prioritize speed over runtime performance, including reduced optimization level and enabled code generation units.
- Modified the `build_agent_with` function calls in the agent tests to return a temporary directory alongside the agent instance, improving resource management during tests.
- Ensured consistency in test setup across multiple test functions.
- Added 'workflow' and '.fastembed_cache' to the .gitignore file to prevent unnecessary files from being tracked in the repository.
Updated the `dispatch_routes_memory_doc_ingest` test to use `AssertUnwindSafe` and `catch_unwind` for better handling of potential panics during execution. This ensures that the test verifies route existence even if the handler encounters a panic, improving robustness against shared state issues in concurrent tests.
…file

- Replace manual Cargo registry cache with Swatinem/rust-cache@v2 (caches
  target/ directories for both core and Tauri crates)
- Add mozilla-actions/sccache for cross-branch compilation caching
- Install mold linker on Linux for faster linking
- Use --profile ci for sidecar build (opt-level 1, codegen-units 16)
- Override release profile env vars for Tauri build with CI-tuned settings
- Add --bundles none to CI build (skip unused deb/appimage packaging)
- Restrict push triggers to main branch only (PRs already cover feature
  branches, preventing duplicate runs)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The sccache-action sets RUSTC_WRAPPER globally for the job. cargo fmt
invokes rustc through sccache which fails if the GHA cache service is
unavailable. Clear RUSTC_WRAPPER for fmt steps and remove redundant
per-step env overrides (the action already sets them job-wide).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Added Default implementations for ConnectionStatus, AgentBuilder, NativeRuntime, AutocompleteEngine, CliChannel, ActionTracker, SkillStatus, and ExtractionMode to streamline object initialization.
- Simplified condition checks in several places by replacing map_or with is_some_and and is_none_or for better readability and performance.
- Updated various instances of string handling in message sending to remove unnecessary conversions.

This refactor enhances code clarity and consistency across the codebase.
- Removed unnecessary blank lines in several files to enhance code readability.
- Simplified condition checks by consolidating method calls into single lines for better clarity.
- Improved formatting in various functions to maintain consistency across the codebase.
Tauri CLI on this version doesn't support 'none' as a bundle type.
Use 'deb' as the lightest single bundle to minimize packaging time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…cker images

- Introduced a Dockerfile to set up a CI environment with necessary dependencies for Tauri, Rust, Node.js, and sccache.
- Created a new workflow to build and push the CI Docker image to GitHub Container Registry on main branch pushes.
- Updated existing workflows to utilize the new Docker image for building and testing, enhancing consistency and efficiency in CI processes.
- Removed unnecessary permissions for packages in build, test, and typecheck workflows.
- Updated container image references to use a specific digest instead of the latest tag for improved stability and reproducibility in CI processes.
Previous digest was from arm64 build (Mac). Rebuilt with
--platform linux/amd64 for GitHub Actions runners.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GHCR doesn't support pulling OCI index manifests by digest reliably.
Use the rust-1.93.0 tag which is pinned to a specific Rust version
and resolves correctly on amd64 CI runners.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move from nested ghcr.io/tinyhumansai/openhuman/ci-runner to
ghcr.io/tinyhumansai/openhuman_ci to avoid GHCR nested package
manifest resolution issues.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
sccache can't access the GHA cache API from inside a Docker container
(missing ACTIONS_CACHE_URL/ACTIONS_RUNTIME_TOKEN). Swatinem/rust-cache
already caches target/ which provides the main build speedup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Added a trigger for the installer smoke workflow to run on pushes to the main branch, enhancing CI coverage for mainline changes.
- Updated the Sentry DSN retrieval process to include an additional fallback option using `option_env!`, ensuring that the DSN can be sourced from both environment variables and optional configuration, improving robustness in observability setup.
- Included the OPENHUMAN_SENTRY_DSN variable in the release workflow configuration to enhance observability setup.
- Updated the ci-secrets.example.json file to include a placeholder for OPENHUMAN_SENTRY_DSN, providing clarity for developers on required environment variables.
@senamakel senamakel merged commit c5e5ae1 into tinyhumansai:main Mar 31, 2026
7 checks passed
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.

1 participant