Skip to content

Commit 2bb9d20

Browse files
authored
feat(ci): separate sozo releases from dojo (#3381)
Isolate sozo from the dojo release process.
1 parent 965c92a commit 2bb9d20

File tree

7 files changed

+65
-95
lines changed

7 files changed

+65
-95
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG RUST_VERSION=1.89.0
1+
ARG RUST_VERSION=1.90.0
22
FROM ubuntu:24.04
33
ARG RUST_VERSION
44

@@ -51,8 +51,6 @@ RUN rustup target add x86_64-pc-windows-msvc && \
5151

5252
RUN cargo install cargo-nextest cargo-llvm-cov cargo-release cargo-get
5353

54-
RUN curl -L https://install.dojoengine.org | bash
55-
5654
# Platform specific tooling (hurl, llvm-tools)
5755
ARG TARGETPLATFORM
5856

.github/workflows/devcontainer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
file: .devcontainer/Dockerfile
6464
tags: ghcr.io/${{ github.repository }}-dev:latest,ghcr.io/${{ github.repository }}-dev:${{ env.DOCKER_TAG }}
6565
build-args: |
66-
RUST_VERSION=1.88.0
66+
RUST_VERSION=1.90.0
6767
DOJO_VERSION=${{ env.DOCKER_TAG }}
6868
platforms: linux/amd64,linux/arm64
6969
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-dev:latest

.github/workflows/release-dispatch-sozo.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,55 @@ jobs:
2727
- uses: actions/checkout@v4
2828
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
2929
- name: Install cargo-release
30-
run: cargo install cargo-release
30+
run: cargo install cargo-release --version 0.25.20 --locked
3131
- name: Normalize version and update files
3232
id: version
3333
working-directory: ./bin/sozo
3434
run: |
3535
INPUT_VERSION="${{ inputs.version }}"
3636
37-
if [[ -z "$INPUT_VERSION" ]]; then
37+
if [ -z "$INPUT_VERSION" ]; then
3838
echo "Error: Version input is empty"
3939
exit 1
4040
fi
4141
4242
CLEAN_VERSION=${INPUT_VERSION#v}
4343
DISPLAY_VERSION="v${CLEAN_VERSION}"
4444
45+
# Manually update the version in the Cargo.toml files, until we have a proper
46+
# rework of the Dojo crates and Sozo isolation.
47+
48+
set -e
49+
50+
SOZO_MANIFESTS="./Cargo.toml ../../crates/sozo/mcp/Cargo.toml ../../crates/sozo/ops/Cargo.toml ../../crates/sozo/signers/Cargo.toml ../../crates/sozo/ui/Cargo.toml ../../crates/sozo/walnut/Cargo.toml"
51+
52+
for manifest in $SOZO_MANIFESTS; do
53+
tmp="$(mktemp)"
54+
if ! awk -v ver="$CLEAN_VERSION" '
55+
BEGIN { updated = 0 }
56+
!updated && /^[[:space:]]*version[[:space:]]*=/ {
57+
sub(/=.*/, "= \"" ver "\"")
58+
updated = 1
59+
}
60+
{ print }
61+
END {
62+
if (!updated) exit 1
63+
}
64+
' "$manifest" > "$tmp"; then
65+
echo "Failed to update version in $manifest"
66+
exit 1
67+
fi
68+
69+
mv "$tmp" "$manifest"
70+
done
71+
4572
cargo release version ${CLEAN_VERSION} --execute --no-confirm
4673
cargo release replace --execute --no-confirm
4774
4875
echo "display_version=${DISPLAY_VERSION}" >> $GITHUB_OUTPUT
4976
5077
- uses: peter-evans/create-pull-request@v7
5178
with:
52-
# We have to use a PAT in order to trigger ci
5379
token: ${{ secrets.CREATE_PR_TOKEN }}
5480
title: "release-sozo(prepare): ${{ steps.version.outputs.display_version }}"
5581
commit-message: "Prepare Sozo release: ${{ steps.version.outputs.display_version }}"

.github/workflows/release-sozo.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ jobs:
2828
- uses: actions/checkout@v4
2929
- name: Get version
3030
id: release_info
31+
working-directory: ./bin/sozo
3132
run: |
3233
cargo install cargo-get
33-
VERSION="v$(cargo get workspace.package.version)"
34+
VERSION="v$(cargo get package.version)"
3435
echo "version=${VERSION}" >> $GITHUB_OUTPUT
3536
echo "tag_name=sozo/${VERSION}" >> $GITHUB_OUTPUT
3637

.github/workflows/release.yml

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -37,92 +37,6 @@ jobs:
3737
cargo install cargo-get
3838
echo "tag_name=v$(cargo get workspace.package.version)" >> $GITHUB_OUTPUT
3939
40-
release:
41-
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
42-
needs: prepare
43-
runs-on: ${{ matrix.job.os }}
44-
env:
45-
PLATFORM_NAME: ${{ matrix.job.platform }}
46-
TARGET: ${{ matrix.job.target }}
47-
ARCH: ${{ matrix.job.arch }}
48-
strategy:
49-
matrix:
50-
job:
51-
# The OS is used for the runner
52-
# The platform is a generic platform name
53-
# The target is used by Cargo
54-
# The arch is either 386, arm64 or amd64
55-
# The svm target platform to use for the binary https://github.com/roynalnaruto/svm-rs/blob/84cbe0ac705becabdc13168bae28a45ad2299749/svm-builds/build.rs#L4-L24
56-
- os: ubuntu-latest-8-cores
57-
platform: linux
58-
target: x86_64-unknown-linux-gnu
59-
arch: amd64
60-
- os: ubuntu-latest-8-cores-arm64
61-
platform: linux
62-
target: aarch64-unknown-linux-gnu
63-
arch: arm64
64-
svm_target_platform: linux-aarch64
65-
- os: macos-latest-xlarge
66-
platform: darwin
67-
target: x86_64-apple-darwin
68-
arch: amd64
69-
- os: macos-latest
70-
platform: darwin
71-
target: aarch64-apple-darwin
72-
arch: arm64
73-
- os: windows-latest
74-
platform: win32
75-
target: x86_64-pc-windows-msvc
76-
arch: amd64
77-
78-
steps:
79-
- uses: actions/checkout@v4
80-
81-
- uses: dtolnay/rust-toolchain@master
82-
name: Rust Toolchain Setup
83-
with:
84-
targets: ${{ matrix.job.target }}
85-
toolchain: ${{ env.RUST_VERSION }}
86-
87-
- uses: Swatinem/rust-cache@v1
88-
with:
89-
cache-on-failure: true
90-
91-
- uses: software-mansion/setup-scarb@v1
92-
with:
93-
scarb-version: "2.13.1"
94-
95-
- name: Build binaries
96-
run: cargo build --release --locked --bin sozo --target ${{ matrix.job.target }}
97-
98-
- name: Archive binaries
99-
id: artifacts
100-
env:
101-
VERSION_NAME: ${{ needs.prepare.outputs.tag_name }}
102-
run: |
103-
if [ "$PLATFORM_NAME" == "linux" ]; then
104-
tar -czvf "dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release sozo
105-
echo "file_name=dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT
106-
elif [ "$PLATFORM_NAME" == "darwin" ]; then
107-
# We need to use gtar here otherwise the archive is corrupt.
108-
# See: https://github.com/actions/virtual-environments/issues/2619
109-
gtar -czvf "dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release sozo
110-
echo "file_name=dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT
111-
else
112-
cd ./target/${TARGET}/release
113-
7z a -tzip "dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" sozo.exe
114-
mv "dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" ../../../
115-
echo "file_name=dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" >> $GITHUB_OUTPUT
116-
fi
117-
shell: bash
118-
119-
- name: Upload release artifacts
120-
uses: actions/upload-artifact@v4
121-
with:
122-
name: artifacts-${{ matrix.job.target }}
123-
path: ${{ steps.artifacts.outputs.file_name }}
124-
retention-days: 1
125-
12640
publish-scarb-packages:
12741

12842
runs-on: ubuntu-latest

bin/sozo/.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
scarb 2.13.1
2+
starknet-foundry 0.51.0

bin/sozo/Dockerfile

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ARG SOZO_VERSION
44
ARG TARGETARCH
55

66
RUN apt-get update \
7-
&& apt-get install -y --no-install-recommends ca-certificates \
7+
&& apt-get install -y --no-install-recommends git curl wget ca-certificates \
88
&& rm -rf /var/lib/apt/lists/*
99

1010
# Archive is provided by the release workflow (linux/amd64 and linux/arm64 variants).
@@ -14,4 +14,33 @@ RUN tar -xzf /tmp/sozo.tar.gz -C /usr/local/bin sozo \
1414
&& rm /tmp/sozo.tar.gz \
1515
&& chmod +x /usr/local/bin/sozo
1616

17+
# Define the ASDF related variables.
18+
# Note that the data dir is also invovled.
19+
ENV ASDF_VERSION=v0.18.0
20+
ENV ASDF_DIR=/opt/asdf
21+
ENV ASDF_BIN_DIR=${ASDF_DIR}/bin
22+
ENV ASDF_DATA_DIR=${ASDF_DIR}/
23+
24+
# Add to the PATH + ensure the ASDF_DATA_DIR is also set,
25+
# to have next invocation of asdf working as expected.
26+
ENV PATH="${ASDF_BIN_DIR}:${ASDF_DATA_DIR}/shims:$PATH"
27+
ENV ASDF_DATA_DIR=${ASDF_DATA_DIR}
28+
29+
# Install ASDF from pre-built binaries github release (easiest way IMHO).
30+
RUN wget -q https://github.com/asdf-vm/asdf/releases/download/${ASDF_VERSION}/asdf-${ASDF_VERSION}-linux-${TARGETARCH}.tar.gz -O /tmp/asdf.tar.gz && \
31+
mkdir -p $ASDF_BIN_DIR && \
32+
tar -xzf /tmp/asdf.tar.gz -C $ASDF_BIN_DIR && \
33+
rm /tmp/asdf.tar.gz && \
34+
ls -laR ${ASDF_DIR}
35+
36+
RUN chmod +x $ASDF_BIN_DIR/asdf && ls -alR $ASDF_DIR/
37+
RUN asdf --version
38+
39+
COPY .tool-versions /root/.tool-versions
40+
41+
RUN asdf plugin add scarb https://github.com/software-mansion/asdf-scarb.git && \
42+
asdf plugin add starknet-foundry https://github.com/foundry-rs/asdf-starknet-foundry && \
43+
asdf install && \
44+
asdf reshim
45+
1746
ENTRYPOINT ["sozo"]

0 commit comments

Comments
 (0)