Skip to content

fix(rust): properly group binaries by platform #5866

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

Merged
merged 1 commit into from
Jul 1, 2025
Merged

fix(rust): properly group binaries by platform #5866

merged 1 commit into from
Jul 1, 2025

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Jul 1, 2025

The GroupByPlatform() method used in archives already considers the Abi extra field.
For some reason, in the Rust builder, it was being called environment instead.
Changed it to Abi so it works the same as Zig et al.
Also updated the tests.

With this patch, the reproducible works as expected:

# ...
  • building binaries
    • building                                       binary=dist/archive-bug-mre_x86_64-unknown-linux-gnu/archive-bug-mre
    • cargo zigbuild
      output=
      │    Compiling archive-bug-mre v0.1.0 (/private/tmp/archive-bug-mre)
      │     Finished `release` profile [optimized] target(s) in 1.52s
    • building                                       binary=dist/archive-bug-mre_x86_64-unknown-linux-musl/archive-bug-mre
    • cargo zigbuild
      output=
      │    Compiling archive-bug-mre v0.1.0 (/private/tmp/archive-bug-mre)
      │     Finished `release` profile [optimized] target(s) in 6.34s
    • took: 15s
  • archives
    • archiving                                      name=dist/archive-bug-mre_Linux_x86_64.tar.gz
    • archiving                                      name=dist/archive-bug-mre_Linux_x86_64_musl.tar.gz
  • calculating checksums
# ...

closes #5865

@caarlos0 caarlos0 requested a review from Copilot July 1, 2025 01:50
@caarlos0 caarlos0 self-assigned this Jul 1, 2025
@caarlos0 caarlos0 added the bug Something isn't working label Jul 1, 2025
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 1, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Align Rust builder behavior by grouping binaries using the Abi field instead of Environment, matching other languages (e.g., Zig).

  • Renamed Environment to Abi in targets.go and updated field mappings.
  • Updated Parse and Build logic to assign and include Abi.
  • Adjusted tests to reflect the new Abi field and simplified target selection.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/builders/rust/targets.go Renamed key and struct field from Environment to Abi.
internal/builders/rust/build.go Changed parse/build steps to set and include Abi instead of environment.
internal/builders/rust/build_test.go Updated tests for the new Abi field, removed dynamic helpers, and hardcoded a target.
Comments suppressed due to low confidence (2)

internal/builders/rust/build_test.go:84

  • [nitpick] Hardcoding the target triple makes this test non-portable. Consider deriving the target from test inputs or using the parsed options.Target to allow running tests on different host environments.
	target := "aarch64-unknown-linux-gnu"

internal/builders/rust/build_test.go:111

  • [nitpick] OS and architecture are hardcoded in the expected artifact; instead, pull these values from options.Target (e.g., options.Target.Os) to ensure the test adapts to different platforms.
		Goos:   "linux",

Copy link

codecov bot commented Jul 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.73%. Comparing base (9d0afc6) to head (fa7d89b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5866   +/-   ##
=======================================
  Coverage   82.73%   82.73%           
=======================================
  Files         164      164           
  Lines       16497    16498    +1     
=======================================
+ Hits        13649    13650    +1     
  Misses       2256     2256           
  Partials      592      592           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@caarlos0 caarlos0 merged commit d9614b3 into main Jul 1, 2025
16 of 17 checks passed
@caarlos0 caarlos0 deleted the 5865 branch July 1, 2025 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Combining MUSL/GNU rust targets in single builder on same platform causes archive step to fail in CI
1 participant