Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,22 @@ jobs:
runner: [self-hosted, Linux, X64]
suffix: x86-linux
target: x86_64-unknown-linux-gnu
# - platform: windows
# runner: [self-hosted, Linux, X64]
# suffix: x86-windows.exe
# target: x86_64-pc-windows-gnu
- platform: macos
arch: x86
- platform: windows
runner: [self-hosted, Linux, X64]
suffix: x86-windows.exe
target: x86_64-pc-windows-gnu
arch: x86
- platform: mac
runner: [self-hosted, Linux, X64]
suffix: x86-mac
target: x86_64-apple-darwin
- platform: macos
arch: x86
- platform: mac
runner: [self-hosted, Linux, ARM64]
suffix: aarch64-mac
target: aarch64-apple-darwin
arch: arm64
arch: aarch64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
Expand All @@ -117,15 +120,8 @@ jobs:
# Use Docker BuildKit
export DOCKER_BUILDKIT=1

# Build the binary using our Dockerfile
ARCH_ARG="${{ matrix.arch }}"
if [ -n "$ARCH_ARG" ]; then
# For ARM64 macOS
docker/toolchain/build.sh ${{ matrix.platform }} $ARCH_ARG
else
# For other platforms
docker/toolchain/build.sh ${{ matrix.platform }}
fi
# Build the binary
scripts/toolchain/build-cross.sh ${{ matrix.platform }} ${{ matrix.arch }}

# Make sure dist directory exists and binary is there
ls -la dist/
Expand Down Expand Up @@ -323,4 +319,4 @@ jobs:
./scripts/release/main.ts --version "${{ github.event.inputs.version }}" --completeCi
else
./scripts/release/main.ts --version "${{ github.event.inputs.version }}" --no-latest --completeCi
fi
fi
52 changes: 0 additions & 52 deletions docker/toolchain/build.sh

This file was deleted.

58 changes: 58 additions & 0 deletions docker/toolchain/linux-aarch64.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# syntax=docker/dockerfile:1.4
FROM rust:1.82.0

# Install dependencies
RUN apt-get update && apt-get install -y \
musl-tools \
libssl-dev \
pkg-config \
protobuf-compiler \
ca-certificates \
git-lfs \
musl-dev \
gcc-aarch64-linux-gnu \
&& rm -rf /var/lib/apt/lists/*

# Install musl target for aarch64
RUN rustup target add aarch64-unknown-linux-musl

# Set up OpenSSL for musl target
ENV SSL_VER=1.1.1w
RUN wget https://www.openssl.org/source/openssl-$SSL_VER.tar.gz \
&& tar -xzf openssl-$SSL_VER.tar.gz \
&& cd openssl-$SSL_VER \
&& ./Configure no-shared no-async --prefix=/musl-aarch64 --openssldir=/musl-aarch64/ssl linux-aarch64 \
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 no-deprecated flag to OpenSSL Configure to reduce binary size and remove deprecated functions

&& make -j$(nproc) CC=aarch64-linux-gnu-gcc \
&& make install_sw \
&& cd .. \
&& rm -rf openssl-$SSL_VER*

# Configure OpenSSL env vars for the build
ENV OPENSSL_DIR=/musl-aarch64 \
OPENSSL_INCLUDE_DIR=/musl-aarch64/include \
OPENSSL_LIB_DIR=/musl-aarch64/lib \
PKG_CONFIG_ALLOW_CROSS=1 \
CC_aarch64_unknown_linux_musl=aarch64-linux-gnu-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc

# Set environment variables
ENV CARGO_INCREMENTAL=0 \
RUSTFLAGS="--cfg tokio_unstable" \
CARGO_NET_GIT_FETCH_WITH_CLI=true

# Set working directory
WORKDIR /build

# Build CLI instructions
COPY . .

# Build for Linux with musl (static binary)
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 aarch64-unknown-linux-musl -v && \
mkdir -p /artifacts && \
cp target/aarch64-unknown-linux-musl/release/rivet /artifacts/rivet-aarch64-linux

# Default command to show help
CMD ["ls", "-la", "/artifacts"]
55 changes: 55 additions & 0 deletions docker/toolchain/linux-x86.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# syntax=docker/dockerfile:1.4
FROM rust:1.82.0

# Install dependencies
RUN apt-get update && apt-get install -y \
musl-tools \
libssl-dev \
pkg-config \
protobuf-compiler \
ca-certificates \
git-lfs \
musl-dev \
&& rm -rf /var/lib/apt/lists/*

# Install musl target
RUN rustup target add x86_64-unknown-linux-musl

# Set up OpenSSL for musl target
ENV SSL_VER=1.1.1w
RUN wget https://www.openssl.org/source/openssl-$SSL_VER.tar.gz \
&& tar -xzf openssl-$SSL_VER.tar.gz \
&& cd openssl-$SSL_VER \
&& ./Configure no-shared no-async --prefix=/musl --openssldir=/musl/ssl linux-x86_64 \
&& make -j$(nproc) \
&& make install_sw \
&& cd .. \
&& rm -rf openssl-$SSL_VER*

# Configure OpenSSL env vars for the build
ENV OPENSSL_DIR=/musl \
OPENSSL_INCLUDE_DIR=/musl/include \
OPENSSL_LIB_DIR=/musl/lib \
PKG_CONFIG_ALLOW_CROSS=1

# Set environment variables
ENV CARGO_INCREMENTAL=0 \
RUSTFLAGS="--cfg tokio_unstable" \
CARGO_NET_GIT_FETCH_WITH_CLI=true

# Set working directory
WORKDIR /build

# Build CLI instructions
COPY . .

# Build for Linux with musl (static binary)
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 && \
mkdir -p /artifacts && \
cp target/x86_64-unknown-linux-musl/release/rivet /artifacts/rivet-x86-linux

# Default command to show help
CMD ["ls", "-la", "/artifacts"]
66 changes: 66 additions & 0 deletions docker/toolchain/macos-aarch64.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# syntax=docker/dockerfile:1.4
FROM rust:1.82.0

# Install dependencies
RUN apt-get update && apt-get install -y \
git-lfs \
protobuf-compiler \
clang \
cmake \
patch \
libxml2-dev \
wget \
xz-utils \
curl \
&& rm -rf /var/lib/apt/lists/*

# Install osxcross
RUN git config --global --add safe.directory '*' && \
git clone https://github.com/tpoechtrager/osxcross /root/osxcross && \
cd /root/osxcross && \
wget -nc https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz && \
mv MacOSX11.3.sdk.tar.xz tarballs/ && \
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh

# Add osxcross to PATH
ENV PATH="/root/osxcross/target/bin:$PATH"

# Install macOS target
RUN rustup target add aarch64-apple-darwin

# Configure Cargo for cross-compilation
RUN mkdir -p /root/.cargo && \
echo '\
[target.aarch64-apple-darwin]\n\
linker = "aarch64-apple-darwin20.4-clang"\n\
ar = "aarch64-apple-darwin20.4-ar"\n\
' > /root/.cargo/config.toml

# Set environment variables for cross-compilation
ENV CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=aarch64-apple-darwin20.4-clang \
CC_aarch64_apple_darwin=aarch64-apple-darwin20.4-clang \
CXX_aarch64_apple_darwin=aarch64-apple-darwin20.4-clang++ \
MACOSX_DEPLOYMENT_TARGET=10.7 \
# Skip aws-lc-rs with rustls certs config when building for macOS
RUSTFLAGS="--cfg tokio_unstable --cfg rustls_native_certs --cfg aws_lc_rs" \
CARGO_FEATURE_RUSTLS_NATIVE_CERTS=0 \
CARGO_RUSTLS_NATIVE_CERTS=0 \
CARGO_INCREMENTAL=0 \
CARGO_NET_GIT_FETCH_WITH_CLI=true

# Set working directory
WORKDIR /build

# Copy the source code
COPY . .

# Build for ARM64 macOS
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 aarch64-apple-darwin && \
mkdir -p /artifacts && \
cp target/aarch64-apple-darwin/release/rivet /artifacts/rivet-aarch64-mac

# Default command to show help
CMD ["ls", "-la", "/artifacts"]
66 changes: 66 additions & 0 deletions docker/toolchain/macos-x86.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# syntax=docker/dockerfile:1.4
FROM rust:1.82.0

# Install dependencies
RUN apt-get update && apt-get install -y \
git-lfs \
protobuf-compiler \
clang \
cmake \
patch \
libxml2-dev \
wget \
xz-utils \
curl \
&& rm -rf /var/lib/apt/lists/*

# Install osxcross
RUN git config --global --add safe.directory '*' && \
git clone https://github.com/tpoechtrager/osxcross /root/osxcross && \
cd /root/osxcross && \
wget -nc https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz && \
mv MacOSX11.3.sdk.tar.xz tarballs/ && \
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh

# Add osxcross to PATH
ENV PATH="/root/osxcross/target/bin:$PATH"

# Install macOS target
RUN rustup target add x86_64-apple-darwin

# Configure Cargo for cross-compilation
RUN mkdir -p /root/.cargo && \
echo '\
[target.x86_64-apple-darwin]\n\
linker = "x86_64-apple-darwin20.4-clang"\n\
ar = "x86_64-apple-darwin20.4-ar"\n\
' > /root/.cargo/config.toml

# Set environment variables for cross-compilation
ENV CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=x86_64-apple-darwin20.4-clang \
CC_x86_64_apple_darwin=x86_64-apple-darwin20.4-clang \
CXX_x86_64_apple_darwin=x86_64-apple-darwin20.4-clang++ \
MACOSX_DEPLOYMENT_TARGET=10.7 \
# Skip aws-lc-rs with rustls certs config when building for macOS
RUSTFLAGS="--cfg tokio_unstable --cfg rustls_native_certs --cfg aws_lc_rs" \
CARGO_FEATURE_RUSTLS_NATIVE_CERTS=0 \
Comment on lines +44 to +46
Copy link

Choose a reason for hiding this comment

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

logic: Setting both rustls_native_certs flag and CARGO_FEATURE_RUSTLS_NATIVE_CERTS=0 seems contradictory. Verify this configuration is intentional.

CARGO_RUSTLS_NATIVE_CERTS=0 \
CARGO_INCREMENTAL=0 \
CARGO_NET_GIT_FETCH_WITH_CLI=true

# Set working directory
WORKDIR /build

# Copy the source code
COPY . .

# Build for x86_64 macOS
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-apple-darwin && \
mkdir -p /artifacts && \
cp target/x86_64-apple-darwin/release/rivet /artifacts/rivet-x86-mac

# Default command to show help
CMD ["ls", "-la", "/artifacts"]
Loading
Loading