@@ -86,140 +86,64 @@ jobs:
8686 strategy :
8787 matrix :
8888 include :
89- - platform : x86_64-unknown- linux-gnu
89+ - platform : linux
9090 runner : [self-hosted, Linux, X64]
9191 suffix : x86-linux
92- # - platform: x86_64-pc-windows-gnu
92+ target : x86_64-unknown-linux-musl
93+ # - platform: windows
9394 # runner: [self-hosted, Linux, X64]
94- # suffix: x86-windows
95- - platform : x86_64-apple-darwin
95+ # suffix: x86-windows.exe
96+ # target: x86_64-pc-windows-musl
97+ - platform : macos
9698 runner : [self-hosted, Linux, X64]
9799 suffix : x86-mac
98- - platform : aarch64-apple-darwin
100+ target : x86_64-apple-darwin
101+ - platform : macos
99102 runner : [self-hosted, Linux, ARM64]
100103 suffix : aarch64-mac
104+ target : aarch64-apple-darwin
105+ arch : arm64
101106 runs-on : ${{ matrix.runner }}
102- container :
103- image : rust:1.82.0
104107 steps :
105108 - uses : actions/checkout@v4
106-
107- # Required for running in Docker
108- - name : Git LFS Pull
109- run : |
110- apt-get update
111- apt-get install git-lfs
112- git lfs pull
113-
114- - uses : actions/setup-node@v4
115109 with :
116- node-version : 20
117-
118- - run : corepack enable
110+ lfs : ' true'
119111
120- - name : Build
121- env :
122- # Expose correct target since we're building cross-platform
123- OVERRIDE_TARGET : ${{ matrix.platform }}
124-
125- # Expose env
126- CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER : x86_64-linux-gnu-gcc
127- CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER : x86_64-apple-darwin20.4-clang
128- CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER : aarch64-apple-darwin20.4-clang
129- CC_x86_64_apple_darwin : x86_64-apple-darwin20.4-clang
130- CXX_x86_64_apple_darwin : x86_64-apple-darwin20.4-clang++
131- CC_aarch64_apple_darwin : aarch64-apple-darwin20.4-clang
132- CXX_aarch64_apple_darwin : aarch64-apple-darwin20.4-clang++
133- MACOSX_DEPLOYMENT_TARGET : " 10.7"
134- # Use RUSTFLAGS to skip building aws-lc-rs when targeting macOS
135- # CARGO_FEATURE_RUSTLS_NATIVE_CERTS: 0
136- # CARGO_RUSTLS_NATIVE_CERTS: 0
137- # RUSTFLAGS: "--cfg tokio_unstable ${{ contains(matrix.platform, 'apple-darwin') && '--cfg tokio_unstable --cfg rustls_native_certs --cfg aws_lc_rs' || '' }}"
138-
139- # Expose token for pulling GH artifacts
140- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
112+ - name : Set up Docker Buildx
113+ uses : docker/setup-buildx-action@v3
141114
142- # Pull via Git CLI to improve reliability in CI
143- ENV CARGO_NET_GIT_FETCH_WITH_CLI : " true"
115+ - name : Build using toolchain Dockerfile
144116 run : |
145- # Install required components for each platform
146- apt-get update
147- if [[ "${{ matrix.platform }}" == "x86_64-pc-windows-gnu" ]]; then
148- echo "Installing Windows components"
149-
150- apt-get install -y gcc-mingw-w64-x86-64
151- elif [[ "${{ matrix.platform }}" == "x86_64-unknown-linux-gnu" ]]; then
152- echo "Installing Linux components"
153-
154- apt-get install -y gcc-x86-64-linux-gnu libc6-dev-amd64-cross
155- elif [[ "${{ matrix.platform }}" == "x86_64-apple-darwin" || "${{ matrix.platform }}" == "aarch64-apple-darwin" ]]; then
156- echo "Installing macOS components"
157-
158- apt-get install -y clang cmake patch libxml2-dev wget xz-utils curl
159-
160- # Install osxcross
161- git config --global --add safe.directory '*'
162- git clone https://github.com/tpoechtrager/osxcross /root/osxcross
163- (
164- cd /root/osxcross
165- wget -nc https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz
166- mv MacOSX11.3.sdk.tar.xz tarballs/
167- UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
168- )
169-
170- # Add osxcross to PATH permanently
171- echo 'export PATH="/root/osxcross/target/bin:$PATH"' >> ~/.bashrc
172- export PATH="/root/osxcross/target/bin:$PATH"
173-
174- # Verify compiler installation
175- echo 'clang path:'
176- which x86_64-apple-darwin20.4-clang
177- echo 'clang version:'
178- x86_64-apple-darwin20.4-clang --version
179- fi
180-
181- # Install targets
182- rustup target add ${{ matrix.platform }}
183-
184- mkdir -p /root/.cargo && \
185- echo '\
186- [target.x86_64-unknown-linux-gnu]\n\
187- linker = "x86_64-linux-gnu-gcc"\n\
188- \n\
189- [target.x86_64-pc-windows-gnu]\n\
190- linker = "x86_64-w64-mingw32-gcc"\n\
191- \n\
192- [target.x86_64-apple-darwin]\n\
193- linker = "x86_64-apple-darwin20.4-clang"\n\
194- ar = "x86_64-apple-darwin20.4-ar"\n\
195- \n\
196- [target.aarch64-apple-darwin]\n\
197- linker = "aarch64-apple-darwin20.4-clang"\n\
198- ar = "aarch64-apple-darwin20.4-ar"\n\
199- ' > /root/.cargo/config.toml
200-
201- # Build
202- cargo build --bin rivet --release --target ${{ matrix.platform }}
117+ # Use Docker BuildKit
118+ export DOCKER_BUILDKIT=1
119+
120+ # Build the binary using our Dockerfile
121+ ARCH_ARG="${{ matrix.arch }}"
122+ docker/toolchain/build.sh ${{ matrix.target }}
123+
124+ # Make sure dist directory exists and binary is there
125+ ls -la dist/
203126
204127 - name : Upload artifacts
205128 env :
206129 AWS_ACCESS_KEY_ID : ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
207130 AWS_SECRET_ACCESS_KEY : ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
208131 run : |
132+ # Install dependencies for AWS CLI
209133 apt-get update
210- apt-get install -y awscli
134+ apt-get install -y unzip curl
135+
136+ # Install AWS CLI
137+ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
138+ unzip awscliv2.zip
139+ ./aws/install
211140
212141 COMMIT_SHA_SHORT="${GITHUB_SHA::7}"
213- BINARY_PATH="target/${{ matrix.platform }}/release/rivet"
214- BINARY_NAME="rivet-${{ matrix.suffix }}"
215- if [[ "${{ matrix.platform }}" == "x86_64-pc-windows-gnu" ]]; then
216- BINARY_PATH="${BINARY_PATH}.exe"
217- BINARY_NAME="${BINARY_NAME}.exe"
218- fi
142+ BINARY_PATH="dist/rivet-${{ matrix.suffix }}"
219143
220144 aws s3 cp \
221145 "${BINARY_PATH}" \
222- "s3://rivet/${COMMIT_SHA_SHORT}/${BINARY_NAME }" \
146+ "s3://rivet/${COMMIT_SHA_SHORT}/rivet-${{ matrix.suffix } }" \
223147 --region auto \
224148 --endpoint-url https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com/rivet-releases
225149
@@ -253,12 +177,6 @@ jobs:
253177 apt-get install git-lfs
254178 git lfs pull
255179
256- - uses : actions/setup-node@v4
257- with :
258- node-version : 20
259-
260- - run : corepack enable
261-
262180 - name : Set outputs
263181 id : vars
264182 run : echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
@@ -394,4 +312,3 @@ jobs:
394312 else
395313 ./scripts/release/main.ts --version "${{ github.event.inputs.version }}" --no-latest --completeCi
396314 fi
397-
0 commit comments