- 
                Notifications
    You must be signed in to change notification settings 
- Fork 130
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
chore: add standalone toolchain build scripts #2400
Conversation
| 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. 
 How to use the Graphite Merge QueueAdd 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. | 
d341e1a    to
    e987134      
    Compare
  
    There was a problem hiding this 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.Dockerfilewith musl-based static linking and OpenSSL 1.1.1w configuration for portable Linux builds
- Added /docker/toolchain/macos.Dockerfilewith osxcross toolchain setup for both x86_64 and ARM64 macOS builds
- Added /docker/toolchain/windows.Dockerfilewith MinGW-w64 cross-compilation support for Windows builds
- Added /docker/toolchain/build.shwith unified build orchestration supporting platform-specific compilation flags
- Simplified Sentry integration in /packages/toolchain/cli/Cargo.tomlby reducing feature flags to core functionality
7 file(s) reviewed, 6 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 \ | 
There was a problem hiding this comment.
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)
        
          
                docker/toolchain/Dockerfile
              
                Outdated
          
        
      | RUN for platform in ${PLATFORMS}; do \ | ||
| echo "Building for $platform..." && \ | ||
| cargo build --bin rivet --release --target $platform; \ | ||
| done | 
There was a problem hiding this comment.
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
| 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 | 
        
          
                docker/toolchain/build.sh
              
                Outdated
          
        
      | BINARY="rivet-x86-linux" | ||
| ;; | ||
| macos) | ||
| if [ "$ARCH" == "arm64" ] || [ "$ARCH" == "aarch64" ]; then | 
There was a problem hiding this comment.
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
| if [ "$ARCH" == "arm64" ] || [ "$ARCH" == "aarch64" ]; then | |
| if [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then | 
| RUN --mount=type=cache,target=/usr/local/cargo/registry \ | ||
| --mount=type=cache,target=/usr/local/cargo/git \ | ||
| --mount=type=cache,target=/build/target \ | 
There was a problem hiding this comment.
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
        
          
                docker/toolchain/setup.sh
              
                Outdated
          
        
      | UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh | ||
| echo 'export PATH="/root/osxcross/target/bin:$PATH"' >> ~/.bashrc | 
There was a problem hiding this comment.
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.
| 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" | 
| 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 | 
There was a problem hiding this comment.
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
| Deploying rivet with   | 
| Latest commit: | 2c043a5 | 
| Status: | ✅ Deploy successful! | 
| Preview URL: | https://96d03f02.rivet.pages.dev | 
| Branch Preview URL: | https://04-26-chore-add-standalone-t.rivet.pages.dev | 
c0718f7    to
    90ca82c      
    Compare
  
    | Dockerfiles don't work identical to GitHub Actions, unsure why | 
There was a problem hiding this 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.yamlto 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 && \ | 
There was a problem hiding this comment.
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
| 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 && \ | 
90ca82c    to
    78080b4      
    Compare
  
    4648476    to
    ff549fe      
    Compare
  
    | Deploying rivet-hub with   | 
| Latest commit: | 2c043a5 | 
| Status: | ✅ Deploy successful! | 
| Preview URL: | https://5c6a8006.rivet-hub-7jb.pages.dev | 
| Branch Preview URL: | https://04-26-chore-add-standalone-t.rivet-hub-7jb.pages.dev | 
78080b4    to
    37a6983      
    Compare
  
    | Deploying rivet-studio with   | 
| Latest commit: | 2c043a5 | 
| Status: | ✅ Deploy successful! | 
| Preview URL: | https://3b4725ba.rivet-studio.pages.dev | 
| Branch Preview URL: | https://04-26-chore-add-standalone-t.rivet-studio.pages.dev | 
e029e29    to
    0a94837      
    Compare
  
    37a6983    to
    e0734e0      
    Compare
  
    e0734e0    to
    332e7ff      
    Compare
  
    08ade41    to
    d7e0071      
    Compare
  
    

Changes