Page MenuHomePhabricator

Introduce Cargo workspace and update Dockerfiles
ClosedPublic

Authored by bartek on May 21 2024, 6:09 AM.
Tags
None
Referenced Files
F3514076: D12140.diff
Sun, Dec 22, 3:28 AM
Unknown Object (File)
Fri, Dec 20, 11:09 AM
Unknown Object (File)
Tue, Dec 17, 3:31 PM
Unknown Object (File)
Mon, Dec 16, 1:26 PM
Unknown Object (File)
Mon, Dec 16, 1:26 PM
Unknown Object (File)
Mon, Dec 16, 1:26 PM
Unknown Object (File)
Mon, Dec 16, 1:26 PM
Unknown Object (File)
Mon, Dec 16, 1:26 PM
Subscribers

Details

Summary

Introduced cargo workspace for services, shared and rust-node-addon.
Some context in this comment.

I put inline comments to explain it better.

This is the first and most important diff in the stack.

Test Plan
  • Locally: cargo commands inside packages work as before
    • When ran in repo root, e.g. cargo check runs wor the whole workspace
  • Docker build times and image sizes are comparable to non-workspace setup
  • Pre-commit hooks for Rust still work as before
  • CI: All Docker images are built successfully, including Keyserver
  • CI: All non-Docker jobs (e.g. Android, iOS) compile Rust successfully
  • Ran Services with Commtest locally
  • Commtest on CI runs - it requires all services' docker images + its own Docker

Diff Detail

Repository
rCOMM Comm
Branch
barthap/cargo-workspace
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

bartek held this revision as a draft.
bartek retitled this revision from [DRAFT] Try cargo workspace for CI to Introduce Cargo workspace and update Dockerfiles.May 21 2024, 1:28 PM
bartek edited the summary of this revision. (Show Details)
bartek edited the test plan for this revision. (Show Details)
bartek published this revision for review.May 21 2024, 10:41 PM
bartek edited the summary of this revision. (Show Details)
bartek edited the test plan for this revision. (Show Details)
bartek added inline comments.
keyserver/Dockerfile
145–147 ↗(On Diff #40514)

For keyserver, we don't copy any of services into Docker image, so cargo build would fail with Couldn't find 'services/*/Cargo.toml' - no such file or directory.
This sed removes that line from Cargo.toml

services/backup/Dockerfile
7 ↗(On Diff #40514)

Directory structure inside Docker image must follow structure from repo. Otherwise Cargo won't be able to find correct paths

19 ↗(On Diff #40514)

Similarly to keyserver scenario, this sed removes rust-node-addon from workspace members because it's not copied into Docker image and Cargo would be unable to find it.

It should work without the others now (they're now excluded), I'll check it and apply this change in the next revision

services/commtest/src/identity/mod.rs
2 ↗(On Diff #40514)

When I included CommTest into workspace, it downloaded a littne newer version of ed25519_dalek which replaced SignerMut with Signer

services/identity/Dockerfile
14–23 ↗(On Diff #40514)

This was to cache dependencies when only modifying sources. But from my experience, it wasn't saving much time.
On CI, everything is recompiled each time

This revision is now accepted and ready to land.May 24 2024, 10:13 AM