Skip to content

chore: add standalone toolchain build scripts #2400

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NathanFlurry
Copy link
Member

Changes

Copy link
Member Author

NathanFlurry commented Apr 26, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@NathanFlurry NathanFlurry force-pushed the 04-26-chore_add_standalone_toolchain_build_scripts branch from d341e1a to e987134 Compare April 26, 2025 08:44
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Added comprehensive cross-platform build system for the Rivet CLI, enabling static binary compilation for Linux, macOS (x86_64/ARM64), and Windows platforms using Docker-based toolchains.

  • Added /docker/toolchain/linux.Dockerfile with musl-based static linking and OpenSSL 1.1.1w configuration for portable Linux builds
  • Added /docker/toolchain/macos.Dockerfile with osxcross toolchain setup for both x86_64 and ARM64 macOS builds
  • Added /docker/toolchain/windows.Dockerfile with MinGW-w64 cross-compilation support for Windows builds
  • Added /docker/toolchain/build.sh with unified build orchestration supporting platform-specific compilation flags
  • Simplified Sentry integration in /packages/toolchain/cli/Cargo.toml by reducing feature flags to core functionality

7 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +47 to +49
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/build/target \
Copy link

Choose a reason for hiding this comment

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

syntax: Inconsistent indentation between lines (tab vs spaces)

Comment on lines +85 to +88
RUN for platform in ${PLATFORMS}; do \
echo "Building for $platform..." && \
cargo build --bin rivet --release --target $platform; \
done
Copy link

Choose a reason for hiding this comment

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

logic: Build process should check for and handle build failures for individual platforms instead of continuing silently

Suggested change
RUN for platform in ${PLATFORMS}; do \
echo "Building for $platform..." && \
cargo build --bin rivet --release --target $platform; \
done
RUN for platform in ${PLATFORMS}; do \
echo "Building for $platform..." && \
cargo build --bin rivet --release --target $platform || exit 1; \
done

BINARY="rivet-x86-linux"
;;
macos)
if [ "$ARCH" == "arm64" ] || [ "$ARCH" == "aarch64" ]; then
Copy link

Choose a reason for hiding this comment

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

style: Use single equals for string comparison in shell scripts for better POSIX compatibility

Suggested change
if [ "$ARCH" == "arm64" ] || [ "$ARCH" == "aarch64" ]; then
if [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then

Comment on lines +62 to +67
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/build/target \
Copy link

Choose a reason for hiding this comment

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

logic: Cache mounts should be unique per architecture to prevent potential conflicts between x86_64 and ARM64 builds

Comment on lines +26 to +27
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
echo 'export PATH="/root/osxcross/target/bin:$PATH"' >> ~/.bashrc
Copy link

Choose a reason for hiding this comment

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

logic: PATH modification in .bashrc won't take effect in non-interactive shells. Consider exporting PATH directly in the script.

Suggested change
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
echo 'export PATH="/root/osxcross/target/bin:$PATH"' >> ~/.bashrc
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
export PATH="/root/osxcross/target/bin:$PATH"

Comment on lines +23 to +26
ENV CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc \
RUSTFLAGS="--cfg tokio_unstable" \
CARGO_INCREMENTAL=0 \
CARGO_NET_GIT_FETCH_WITH_CLI=true
Copy link

Choose a reason for hiding this comment

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

style: Consider adding CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS to ensure Windows-specific flags are properly isolated from other targets

Copy link

cloudflare-workers-and-pages bot commented Apr 26, 2025

Deploying rivet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 332e7ff
Status: ✅  Deploy successful!
Preview URL: https://5607c8f0.rivet.pages.dev
Branch Preview URL: https://04-26-chore-add-standalone-t.rivet.pages.dev

View logs

@NathanFlurry NathanFlurry force-pushed the 04-26-chore_add_standalone_toolchain_build_scripts branch 2 times, most recently from c0718f7 to 90ca82c Compare April 26, 2025 09:18
@NathanFlurry NathanFlurry changed the base branch from 04-26-chore_update_release_please to graphite-base/2400 April 26, 2025 10:39
Copy link
Member Author

Dockerfiles don't work identical to GitHub Actions, unsure why

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

The PR updates the release workflow to integrate the new standalone toolchain build system, focusing on Docker-based builds and artifact management.

  • Modified .github/workflows/release.yaml to use new Docker-based toolchain scripts instead of direct dependency installation
  • Added R2 storage integration for binary artifacts with AWS CLI configuration in release workflow
  • Added platform-specific build matrix configuration with ARM64 support for macOS builds
  • Streamlined Docker image tagging and pushing with consistent naming conventions across architectures

8 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/build/target \
cargo build --bin rivet --release --target x86_64-unknown-linux-musl -v && \
Copy link

Choose a reason for hiding this comment

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

style: Add --locked flag to cargo build to ensure reproducible builds

Suggested change
cargo build --bin rivet --release --target x86_64-unknown-linux-musl -v && \
cargo build --bin rivet --release --target x86_64-unknown-linux-musl --locked -v && \

@NathanFlurry NathanFlurry force-pushed the 04-26-chore_add_standalone_toolchain_build_scripts branch from 90ca82c to 78080b4 Compare April 26, 2025 11:54
@NathanFlurry NathanFlurry changed the base branch from graphite-base/2400 to main April 26, 2025 11:55
Copy link

cloudflare-workers-and-pages bot commented Apr 26, 2025

Deploying rivet-hub with  Cloudflare Pages  Cloudflare Pages

Latest commit: 78080b4
Status:🚫  Build failed.

View logs

@NathanFlurry NathanFlurry changed the base branch from main to graphite-base/2400 April 26, 2025 12:12
@NathanFlurry NathanFlurry force-pushed the 04-26-chore_add_standalone_toolchain_build_scripts branch from 78080b4 to 37a6983 Compare April 26, 2025 12:12
@NathanFlurry NathanFlurry changed the base branch from graphite-base/2400 to 04-26-chore_temporarily_disable_sentry April 26, 2025 12:12
Copy link

Deploying rivet-studio with  Cloudflare Pages  Cloudflare Pages

Latest commit: 78080b4
Status: ✅  Deploy successful!
Preview URL: https://266444e1.rivet-studio.pages.dev
Branch Preview URL: https://graphite-base-2406.rivet-studio.pages.dev

View logs

@graphite-app graphite-app bot changed the base branch from 04-26-chore_temporarily_disable_sentry to graphite-base/2400 April 26, 2025 12:16
@graphite-app graphite-app bot force-pushed the graphite-base/2400 branch from e029e29 to 0a94837 Compare April 26, 2025 12:16
@graphite-app graphite-app bot force-pushed the 04-26-chore_add_standalone_toolchain_build_scripts branch from 37a6983 to e0734e0 Compare April 26, 2025 12:16
@graphite-app graphite-app bot changed the base branch from graphite-base/2400 to main April 26, 2025 12:17
@graphite-app graphite-app bot force-pushed the 04-26-chore_add_standalone_toolchain_build_scripts branch from e0734e0 to 332e7ff Compare April 26, 2025 12:17
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