2121 R2_BUCKET : rivet-releases
2222 R2_ENDPOINT : https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com
2323 SIDECAR_PLATFORMS : " linux-x64-gnu linux-arm64-gnu darwin-x64 darwin-arm64"
24- PUBLISH_INCLUDE_REGISTRY_PACKAGES : " 1"
24+ RUST_TOOLCHAIN : " 1.91. 1"
2525 LINUX_GNU_LLVM_VERSION : " 22"
2626 LINUX_GNU_SYSROOT_TAG : " sysroot-20250207"
2727
6666 targets : wasm32-wasip1
6767 - uses : Swatinem/rust-cache@v2
6868 with :
69- workspaces : registry/native -> registry/native/target
69+ workspaces : registry/native -> target
70+ cache-workspace-crates : true
7071 key : wasm-commands-${{ hashFiles('registry/native/Cargo.lock') }}
7172 - run : pnpm install --frozen-lockfile --filter '@rivet-dev/agentos-runtime-core...'
7273 - run : make -C registry/native commands
7980
8081 build-sidecar :
8182 needs : [context]
82- name : " Build sidecars (${{ matrix.platform }})"
83+ name : " Build linux native artifacts (${{ matrix.platform }})"
8384 strategy :
8485 fail-fast : false
8586 matrix :
@@ -93,127 +94,75 @@ jobs:
9394 runs-on : ${{ matrix.runner }}
9495 steps :
9596 - uses : actions/checkout@v4
96- - uses : pnpm/action-setup@v4
97- - uses : actions/setup-node@v4
98- with :
99- node-version : 22
100- cache : pnpm
101- cache-dependency-path : pnpm-lock.yaml
102- - uses : dtolnay/rust-toolchain@stable
103- with :
104- targets : ${{ matrix.target }}
105- - uses : Swatinem/rust-cache@v2
106- with :
107- workspaces : . -> target
108- key : ${{ matrix.target }}-${{ env.LINUX_GNU_SYSROOT_TAG }}-llvm-${{ env.LINUX_GNU_LLVM_VERSION }}-${{ needs.context.outputs.trigger }}
109- - uses : actions/cache@v4
97+ - uses : docker/setup-buildx-action@v3
11098 with :
111- path : ~/.cargo/.rusty_v8
112- key : ${{ runner.os }}-${{ matrix.target }}-rusty-v8-${{ hashFiles('Cargo.lock') }}
113- restore-keys : |
114- ${{ runner.os }}-${{ matrix.target }}-rusty-v8-
115- - run : pnpm install --frozen-lockfile --filter='!@agentos/website'
116- - name : Set up Linux GNU sysroot
117- run : scripts/ci/setup-linux-gnu-sysroot.sh
118- - name : Build sidecar binaries
119- id : build
99+ keep-state : ${{ contains(matrix.runner, 'self-hosted') }}
100+ - name : Resolve build profile
101+ id : mode
120102 run : |
121103 set -euo pipefail
122- out="target/sidecar-artifacts/${{ matrix.platform }}"
123- mkdir -p "$out"
124104 if [ "${{ needs.context.outputs.trigger }}" = "release" ]; then
125- flag="--release"
126- profile="release"
105+ echo "profile=release" >> "$GITHUB_OUTPUT"
127106 else
128- flag=""
129- profile="debug"
107+ echo "profile=debug" >> "$GITHUB_OUTPUT"
130108 fi
131- cargo build $flag -p agentos-sidecar -p agentos-native-sidecar --target ${{ matrix.target }}
132- cp "target/${{ matrix.target }}/${profile}/agentos-sidecar" "$out/agentos-sidecar"
133- cp "target/${{ matrix.target }}/${profile}/agentos-native-sidecar" "$out/agentos-native-sidecar"
134- echo "dir=$out" >> "$GITHUB_OUTPUT"
109+ - name : Build linux artifacts
110+ uses : docker/build-push-action@v6
111+ with :
112+ context : .
113+ file : docker/build/linux-gnu.Dockerfile
114+ build-args : |
115+ TARGET=${{ matrix.target }}
116+ BUILD_PROFILE=${{ steps.mode.outputs.profile }}
117+ CACHE_PLATFORM=${{ matrix.platform }}
118+ RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
119+ LINUX_GNU_LLVM_VERSION=${{ env.LINUX_GNU_LLVM_VERSION }}
120+ LINUX_GNU_SYSROOT_TAG=${{ env.LINUX_GNU_SYSROOT_TAG }}
121+ tags : agentos-linux-${{ matrix.platform }}
122+ load : true
123+ cache-from : type=gha,scope=linux-${{ matrix.platform }}-${{ steps.mode.outputs.profile }}
124+ cache-to : type=gha,mode=max,scope=linux-${{ matrix.platform }}-${{ steps.mode.outputs.profile }}
125+ - name : Extract linux artifacts
126+ id : extract
127+ run : |
128+ set -euo pipefail
129+ sidecar_out="target/sidecar-artifacts/${{ matrix.platform }}"
130+ plugin_out="target/plugin-artifacts/${{ matrix.platform }}"
131+ mkdir -p "$sidecar_out" "$plugin_out"
132+ cid=$(docker create agentos-linux-${{ matrix.platform }})
133+ docker cp "$cid:/artifacts/agentos-sidecar" "$sidecar_out/agentos-sidecar"
134+ docker cp "$cid:/artifacts/agentos-native-sidecar" "$sidecar_out/agentos-native-sidecar"
135+ docker cp "$cid:/artifacts/libagentos_actor_plugin.so" "$plugin_out/libagentos_actor_plugin.so"
136+ docker rm "$cid"
137+ test -f "$sidecar_out/agentos-sidecar"
138+ test -f "$sidecar_out/agentos-native-sidecar"
139+ test -f "$plugin_out/libagentos_actor_plugin.so"
140+ echo "sidecar_dir=$sidecar_out" >> "$GITHUB_OUTPUT"
141+ echo "plugin_dir=$plugin_out" >> "$GITHUB_OUTPUT"
135142 - name : Check glibc floor
136143 run : |
137144 scripts/ci/check-linux-glibc-floor.sh \
138- "${{ steps.build.outputs.dir }}/agentos-sidecar" \
139- "${{ steps.build.outputs.dir }}/agentos-native-sidecar"
140- - name : Smoke-run in old Linux containers
145+ "${{ steps.extract.outputs.sidecar_dir }}/agentos-sidecar" \
146+ "${{ steps.extract.outputs.sidecar_dir }}/agentos-native-sidecar" \
147+ "${{ steps.extract.outputs.plugin_dir }}/libagentos_actor_plugin.so"
148+ - name : Smoke-run binaries in old Linux containers
141149 run : |
142150 scripts/ci/smoke-linux-artifacts.sh binary \
143- "${{ steps.build.outputs.dir }}/agentos-sidecar" \
144- "${{ steps.build.outputs.dir }}/agentos-native-sidecar"
151+ "${{ steps.extract.outputs.sidecar_dir }}/agentos-sidecar" \
152+ "${{ steps.extract.outputs.sidecar_dir }}/agentos-native-sidecar"
153+ - name : Smoke-run plugin in old Linux containers
154+ run : |
155+ scripts/ci/smoke-linux-artifacts.sh shared-library \
156+ "${{ steps.extract.outputs.plugin_dir }}/libagentos_actor_plugin.so"
145157 - uses : actions/upload-artifact@v4
146158 with :
147159 name : sidecar-${{ matrix.platform }}
148- path : ${{ steps.build .outputs.dir }}
160+ path : ${{ steps.extract .outputs.sidecar_dir }}
149161 if-no-files-found : error
150-
151- build-plugin :
152- needs : [context]
153- name : " Build plugin (${{ matrix.platform }})"
154- strategy :
155- fail-fast : false
156- matrix :
157- include :
158- - platform : linux-x64-gnu
159- runner : ubuntu-22.04
160- target : x86_64-unknown-linux-gnu
161- - platform : linux-arm64-gnu
162- runner : ubuntu-22.04-arm
163- target : aarch64-unknown-linux-gnu
164- runs-on : ${{ matrix.runner }}
165- steps :
166- - uses : actions/checkout@v4
167- - uses : pnpm/action-setup@v4
168- - uses : actions/setup-node@v4
169- with :
170- node-version : 22
171- cache : pnpm
172- cache-dependency-path : pnpm-lock.yaml
173- - uses : dtolnay/rust-toolchain@stable
174- with :
175- targets : ${{ matrix.target }}
176- - uses : Swatinem/rust-cache@v2
177- with :
178- workspaces : . -> target
179- key : plugin-${{ matrix.target }}-${{ env.LINUX_GNU_SYSROOT_TAG }}-llvm-${{ env.LINUX_GNU_LLVM_VERSION }}-${{ needs.context.outputs.trigger }}
180- - uses : actions/cache@v4
181- with :
182- path : ~/.cargo/.rusty_v8
183- key : ${{ runner.os }}-${{ matrix.target }}-rusty-v8-${{ hashFiles('Cargo.lock') }}
184- restore-keys : |
185- ${{ runner.os }}-${{ matrix.target }}-rusty-v8-
186- - run : pnpm install --frozen-lockfile --filter='!@agentos/website'
187- - name : Set up Linux GNU sysroot
188- run : scripts/ci/setup-linux-gnu-sysroot.sh
189- - name : Build plugin cdylib
190- id : build
191- run : |
192- set -euo pipefail
193- out="target/plugin-artifacts/${{ matrix.platform }}"
194- mkdir -p "$out"
195- if [ "${{ needs.context.outputs.trigger }}" = "release" ]; then
196- cargo build --release -p agentos-actor-plugin --target ${{ matrix.target }}
197- profile="release"
198- else
199- cargo build -p agentos-actor-plugin --target ${{ matrix.target }}
200- profile="debug"
201- fi
202- cp "target/${{ matrix.target }}/${profile}/libagentos_actor_plugin.so" \
203- "$out/libagentos_actor_plugin.so"
204- echo "dir=$out" >> "$GITHUB_OUTPUT"
205- - name : Check glibc floor
206- run : |
207- scripts/ci/check-linux-glibc-floor.sh \
208- "${{ steps.build.outputs.dir }}/libagentos_actor_plugin.so"
209- - name : Smoke-run in old Linux containers
210- run : |
211- scripts/ci/smoke-linux-artifacts.sh shared-library \
212- "${{ steps.build.outputs.dir }}/libagentos_actor_plugin.so"
213162 - uses : actions/upload-artifact@v4
214163 with :
215164 name : plugin-${{ matrix.platform }}
216- path : ${{ steps.build .outputs.dir }}
165+ path : ${{ steps.extract .outputs.plugin_dir }}
217166 if-no-files-found : error
218167
219168 build-sidecar-darwin :
@@ -232,19 +181,36 @@ jobs:
232181 runs-on : ubuntu-22.04
233182 steps :
234183 - uses : actions/checkout@v4
184+ - uses : docker/setup-buildx-action@v3
235185 - name : Log in to ghcr.io
236186 run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
187+ - name : Compute build profile
188+ id : mode
189+ run : |
190+ set -euo pipefail
191+ if [ "${{ needs.context.outputs.trigger }}" = "release" ]; then
192+ echo "profile=release" >> "$GITHUB_OUTPUT"
193+ else
194+ echo "profile=debug" >> "$GITHUB_OUTPUT"
195+ fi
237196 - name : Cross-compile via osxcross
197+ uses : docker/build-push-action@v6
198+ with :
199+ context : .
200+ file : docker/build/darwin.Dockerfile
201+ build-args : |
202+ TARGET=${{ matrix.target }}
203+ CLANG=${{ matrix.clang }}
204+ BUILD_PROFILE=${{ steps.mode.outputs.profile }}
205+ CACHE_PLATFORM=${{ matrix.platform }}
206+ RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
207+ tags : agentos-darwin-${{ matrix.platform }}
208+ load : true
209+ cache-from : type=gha,scope=darwin-${{ matrix.platform }}-${{ steps.mode.outputs.profile }}
210+ cache-to : type=gha,mode=max,scope=darwin-${{ matrix.platform }}-${{ steps.mode.outputs.profile }}
211+ - name : Extract darwin artifacts
238212 run : |
239213 set -euo pipefail
240- if [ "${{ needs.context.outputs.trigger }}" = "release" ]; then profile=release; else profile=debug; fi
241- DOCKER_BUILDKIT=1 docker build \
242- -f docker/build/darwin.Dockerfile \
243- --build-arg TARGET=${{ matrix.target }} \
244- --build-arg CLANG=${{ matrix.clang }} \
245- --build-arg BUILD_PROFILE="${profile}" \
246- -t agentos-darwin-${{ matrix.platform }} .
247-
248214 sidecar_out="target/sidecar-artifacts/${{ matrix.platform }}"
249215 plugin_out="target/plugin-artifacts/${{ matrix.platform }}"
250216 mkdir -p "$sidecar_out" "$plugin_out"
@@ -256,6 +222,14 @@ jobs:
256222 test -f "$sidecar_out/agentos-sidecar"
257223 test -f "$sidecar_out/agentos-native-sidecar"
258224 test -f "$plugin_out/libagentos_actor_plugin.dylib"
225+ case "${{ matrix.platform }}" in
226+ darwin-x64) expected_arch="x86_64" ;;
227+ darwin-arm64) expected_arch="arm64" ;;
228+ *) echo "unknown darwin platform: ${{ matrix.platform }}" >&2; exit 2 ;;
229+ esac
230+ file "$sidecar_out/agentos-sidecar" | grep -F "$expected_arch"
231+ file "$sidecar_out/agentos-native-sidecar" | grep -F "$expected_arch"
232+ file "$plugin_out/libagentos_actor_plugin.dylib" | grep -F "$expected_arch"
259233 - uses : actions/upload-artifact@v4
260234 with :
261235 name : sidecar-${{ matrix.platform }}
@@ -268,9 +242,9 @@ jobs:
268242 if-no-files-found : error
269243
270244 publish-npm :
271- needs : [context, wasm-commands, build-sidecar, build-plugin, build- sidecar-darwin]
245+ needs : [context, wasm-commands, build-sidecar, build-sidecar-darwin]
272246 name : Publish npm
273- if : ${{ !cancelled() && needs.wasm-commands.result == 'success' && needs.build-sidecar.result == 'success' && needs.build-plugin.result == 'success' && needs.build- sidecar-darwin.result == 'success' }}
247+ if : ${{ !cancelled() && needs.wasm-commands.result == 'success' && needs.build-sidecar.result == 'success' && needs.build-sidecar-darwin.result == 'success' }}
274248 runs-on : ubuntu-latest
275249 steps :
276250 - uses : actions/checkout@v4
@@ -330,14 +304,13 @@ jobs:
330304 pnpm --filter=publish exec tsx src/ci/bin.ts bump-versions \
331305 --version ${{ needs.context.outputs.version }} \
332306 --version-only
333- - name : Install wasm-pack
334- run : |
335- rustup target add wasm32-unknown-unknown
336- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
337307 - run : node packages/runtime-core/scripts/copy-wasm-commands.mjs --require
338308 - name : Build TypeScript packages
309+ env :
310+ AGENTOS_SKIP_NATIVE_META_BUILD : " 1"
339311 run : |
340312 npx turbo build \
313+ --filter='!@rivet-dev/agentos-plugin' \
341314 --filter='!@rivet-dev/agentos-playground' \
342315 --filter='!./examples/*' \
343316 --filter='!./examples/quickstart/*'
@@ -394,6 +367,7 @@ jobs:
394367 cp "artifacts/sidecar-${p}/agentos-sidecar" "release-assets/agentos-sidecar-${target}"
395368 cp "artifacts/sidecar-${p}/agentos-native-sidecar" "release-assets/agentos-native-sidecar-${target}"
396369 done
370+ chmod +x release-assets/agentos-sidecar-* release-assets/agentos-native-sidecar-*
397371 if [ -d crates/execution/assets/pyodide ]; then
398372 mkdir -p release-assets/pyodide
399373 cp -R crates/execution/assets/pyodide/. release-assets/pyodide/
0 commit comments