Skip to content

ci: fix goreleaser v2 mainnet-beta build by removing CARGO_TARGET_DIR#3258

Merged
nikw9944 merged 9 commits intomainfrom
nikw9944/doublezero-3239
Mar 13, 2026
Merged

ci: fix goreleaser v2 mainnet-beta build by removing CARGO_TARGET_DIR#3258
nikw9944 merged 9 commits intomainfrom
nikw9944/doublezero-3239

Conversation

@nikw9944
Copy link
Contributor

@nikw9944 nikw9944 commented Mar 13, 2026

Summary

  • Fixes GoReleaser v2 build failure for mainnet-beta client by removing the CARGO_TARGET_DIR environment variable

Context

PR #3243 added CARGO_TARGET_DIR=target/mainnet-beta to prevent the mainnet-beta build from overwriting the testnet build. However, this causes failures with GoReleaser v2 because:

  1. GoReleaser v2's Rust builder is hardcoded to look for binaries at target/x86_64-unknown-linux-gnu/release/
  2. With CARGO_TARGET_DIR=target/mainnet-beta, the binary is built at target/mainnet-beta/x86_64-unknown-linux-gnu/release/
  3. GoReleaser fails with "no such file or directory" when trying to copy the binary to dist

Solution

Remove CARGO_TARGET_DIR entirely. GoReleaser v2 handles multiple Rust builds correctly by:

  1. Building each binary sequentially
  2. Immediately copying each binary to its own dist folder after building
  3. This happens before the next build overwrites the target directory

Testing Verification

  • Built locally with goreleaser release --snapshot - both binaries build successfully
  • Verified the testnet and mainnet-beta packages contain different binaries (different SHA256 checksums)
  • Testnet package: contains testnet binary (SHA: 84b09ea4..., size: 15358696)
  • Mainnet-beta package: contains mainnet-beta binary (SHA: 8d9482de..., size: 15358472)
  • CI validation workflow passes

…-beta build

GoReleaser v2 doesn't support the 'path' field in rust builds. Using CARGO_TARGET_DIR
environment variable instead to specify the custom target directory for mainnet-beta builds.
After PR #3243 set CARGO_TARGET_DIR=target/mainnet-beta, the built binary
is placed in target/mainnet-beta/x86_64-unknown-linux-gnu/release/ instead
of the standard target/x86_64-unknown-linux-gnu/release/ location.

GoReleaser v2 expects binaries at the standard location. This commit adds
a post-build step to copy the binary from the custom target directory to
where GoReleaser expects to find it.
@nikw9944 nikw9944 force-pushed the nikw9944/doublezero-3239 branch from 8805552 to 0c000d3 Compare March 13, 2026 13:47
@nikw9944 nikw9944 changed the title ci: fix mainnet-beta binary location for goreleaser v2 ci: fix mainnet-beta binary location for goreleaser Mar 13, 2026
GoReleaser v2 handles sequential Rust builds correctly by copying each
binary to dist/ immediately after building, before the next build overwrites
the target directory. The custom CARGO_TARGET_DIR was causing issues because
GoReleaser couldn't find the binary in the expected location.
@nikw9944 nikw9944 changed the title ci: fix mainnet-beta binary location for goreleaser ci: fix goreleaser v2 mainnet-beta build by removing CARGO_TARGET_DIR Mar 13, 2026
@nikw9944 nikw9944 merged commit a61092b into main Mar 13, 2026
32 checks passed
@nikw9944 nikw9944 deleted the nikw9944/doublezero-3239 branch March 13, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

client: mainnet-beta cloudsmith package is not configured for mainnet-beta by default

2 participants