70
70
npmAuthToken: "${{ secrets.NPM_TOKEN }}"
71
71
EOF
72
72
73
+ # TODO: CI yarn.lock differs from local for some reason & causes errors
73
74
# Install dependencies
74
- yarn install --immutable
75
+ # yarn install --immutable
76
+ yarn config set -H enableImmutableInstalls false
77
+ yarn install
75
78
76
79
if [ "${{ inputs.latest }}" = "true" ]; then
77
80
./scripts/release/main.ts --version "${{ github.event.inputs.version }}" --setupCi
@@ -86,142 +89,68 @@ jobs:
86
89
strategy :
87
90
matrix :
88
91
include :
89
- - platform : x86_64-unknown- linux-gnu
92
+ - platform : linux
90
93
runner : [self-hosted, Linux, X64]
91
- suffix : x86- linux
92
- # - platform: x86_64-pc- windows-gnu
94
+ target : x86_64-unknown- linux-musl
95
+ # - platform: windows
93
96
# runner: [self-hosted, Linux, X64]
94
- # suffix: x86- windows
95
- - platform : x86_64-apple-darwin
97
+ # target: x86_64-pc- windows-musl
98
+ - platform : macos
96
99
runner : [self-hosted, Linux, X64]
97
- suffix : x86-mac
98
- - platform : aarch64-apple-darwin
100
+ target : x86_64-apple-darwin
101
+ - platform : macos
99
102
runner : [self-hosted, Linux, ARM64]
100
- suffix : aarch64-mac
103
+ target : aarch64-apple-darwin
104
+ arch : arm64
101
105
runs-on : ${{ matrix.runner }}
102
- container :
103
- image : rust:1.82.0
104
106
steps :
105
107
- 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
115
108
with :
116
- node-version : 20
117
-
118
- - run : corepack enable
109
+ lfs : ' true'
119
110
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 }}
111
+ - name : Set up Docker Buildx
112
+ uses : docker/setup-buildx-action@v3
141
113
142
- # Pull via Git CLI to improve reliability in CI
143
- ENV CARGO_NET_GIT_FETCH_WITH_CLI : " true"
114
+ - name : Build using toolchain Dockerfile
144
115
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 }}
116
+ # Use Docker BuildKit
117
+ export DOCKER_BUILDKIT=1
118
+
119
+ # Build the binary using our Dockerfile
120
+ ARCH_ARG="${{ matrix.arch }}"
121
+ docker/toolchain/build.sh ${{ matrix.target }}
122
+
123
+ # Make sure dist directory exists and binary is there
124
+ ls -la dist/
203
125
204
126
- name : Upload artifacts
205
127
env :
206
128
AWS_ACCESS_KEY_ID : ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
207
129
AWS_SECRET_ACCESS_KEY : ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
208
130
run : |
131
+ # Install dependencies for AWS CLI
209
132
apt-get update
210
- apt-get install -y awscli
133
+ apt-get install -y unzip curl
211
134
212
- 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"
135
+ # Install AWS CLI - use ARM version if running on ARM architecture
136
+ if [ "${{ matrix.arch }}" = "arm64" ]; then
137
+ curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
138
+ else
139
+ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
218
140
fi
141
+ unzip awscliv2.zip
142
+ ./aws/install --update
143
+
144
+ COMMIT_SHA_SHORT="${GITHUB_SHA::7}"
145
+ BINARY_PATH="dist/rivet-${{ matrix.target }}"
219
146
147
+ # Must specify --checksum-algorithm for compatibility with R2
220
148
aws s3 cp \
221
149
"${BINARY_PATH}" \
222
- "s3://rivet/${COMMIT_SHA_SHORT}/${BINARY_NAME }" \
150
+ "s3://rivet/${COMMIT_SHA_SHORT}/rivet-${{ matrix.target } }" \
223
151
--region auto \
224
- --endpoint-url https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com/rivet-releases
152
+ --endpoint-url https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com/rivet-releases \
153
+ --checksum-algorithm CRC32
225
154
226
155
docker :
227
156
name : " Build & Push Docker Images"
@@ -253,12 +182,6 @@ jobs:
253
182
apt-get install git-lfs
254
183
git lfs pull
255
184
256
- - uses : actions/setup-node@v4
257
- with :
258
- node-version : 20
259
-
260
- - run : corepack enable
261
-
262
185
- name : Set outputs
263
186
id : vars
264
187
run : echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
@@ -394,4 +317,3 @@ jobs:
394
317
else
395
318
./scripts/release/main.ts --version "${{ github.event.inputs.version }}" --no-latest --completeCi
396
319
fi
397
-
0 commit comments