Skip to content

Commit facca46

Browse files
committed
Merge branch 'main' into processors-crate
2 parents 7e5fc94 + cc33cc4 commit facca46

83 files changed

Lines changed: 2470 additions & 2063 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/Dockerfile

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
# See here for image contents: https://hub.docker.com/layers/library/rust/1.81.0-slim/images/sha256-ba4ee661bb466ab49f6ceb8c6d9e9f9784bba7c6e45225187cd3c7fb1fbc12ce
2-
31
ARG RUST_VERSION=1.85.0
4-
FROM rust:${RUST_VERSION}-slim
2+
FROM ubuntu:24.04
53
ARG RUST_VERSION
64

75
# Install additional packages
86
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9-
&& apt-get -y install --no-install-recommends protobuf-compiler libprotobuf-dev libclang-dev libzstd-dev make pkg-config libssl-dev
7+
&& apt-get -y install --no-install-recommends protobuf-compiler libprotobuf-dev libclang-dev libzstd-dev make pkg-config libssl-dev gcc
108

119
RUN apt-get install -y gh libgmp3-dev software-properties-common curl git unzip
1210

11+
# Install rust.
12+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain ${RUST_VERSION}
13+
ENV PATH="/root/.cargo/bin:${PATH}"
14+
1315
# To allow independent workflow of the container, the rust-toolchain is explicitely given.
1416
RUN echo ${RUST_VERSION} > rust_toolchain_version
1517
# Make sure to sync the nightly version with the scripts in ./scripts
16-
RUN echo "nightly-2024-08-28" > nightly_rust_toolchain_version
18+
RUN echo "nightly-2025-02-20" > nightly_rust_toolchain_version
1719

1820
# Install cargo-binstall
1921
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
@@ -24,7 +26,7 @@ RUN rustup toolchain install $(cat rust_toolchain_version) && \
2426
rustup component add rustfmt
2527

2628
RUN rustup toolchain install $(cat nightly_rust_toolchain_version) && \
27-
rustup component add rustfmt clippy --toolchain $(cat nightly_rust_toolchain_version)
29+
rustup component add rustfmt clippy --toolchain $(cat nightly_rust_toolchain_version)
2830

2931
RUN rustup target add x86_64-pc-windows-msvc && \
3032
rustup target add wasm32-unknown-unknown
@@ -40,8 +42,7 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then \
4042
rm -r hurl-4.1.0-aarch64-unknown-linux-gnu && \
4143
rm hurl.tar.gz && \
4244
rustup component add llvm-tools-preview --toolchain $(cat rust_toolchain_version)-aarch64-unknown-linux-gnu; \
43-
curl -L https://go.dev/dl/go1.24.2.linux-arm64.tar.gz -o go.tar.gz; \
44-
curl -L https://github.com/dojoengine/dojo/releases/download/v1.4.1/dojo_v1.4.1_linux_arm64.tar.gz -o dojo.tar.gz; \
45+
curl -L https://github.com/asdf-vm/asdf/releases/download/v0.16.7/asdf-v0.16.7-linux-arm64.tar.gz -o asdf.tar.gz; \
4546
elif [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \
4647
curl -L https://github.com/Orange-OpenSource/hurl/releases/download/4.1.0/hurl-4.1.0-x86_64-unknown-linux-gnu.tar.gz -o hurl.tar.gz && \
4748
tar -xzf hurl.tar.gz && \
@@ -50,24 +51,13 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then \
5051
rm hurl.tar.gz && \
5152
rustup component add llvm-tools-preview --toolchain $(cat rust_toolchain_version)-x86_64-unknown-linux-gnu && \
5253
rustup target add x86_64-fortanix-unknown-sgx --toolchain $(cat nightly_rust_toolchain_version); \
53-
curl -L https://go.dev/dl/go1.24.2.linux-amd64.tar.gz -o go.tar.gz; \
54-
curl -L https://github.com/dojoengine/dojo/releases/download/v1.4.1/dojo_v1.4.1_linux_amd64.tar.gz -o dojo.tar.gz; \
54+
curl -L https://github.com/asdf-vm/asdf/releases/download/v0.16.7/asdf-v0.16.7-linux-amd64.tar.gz -o asdf.tar.gz; \
5555
fi
5656

57-
# Don't use asdf for dojo, since it's aarch64 for asdf, but dojo uses `arm64`.
58-
RUN tar -C /usr/local -xzf dojo.tar.gz
59-
ENV PATH="${PATH}:/usr/local"
60-
6157
# For asdf to be installed for the current platform automatically.
62-
RUN tar -C /usr/local -xzf go.tar.gz
63-
ENV PATH="${PATH}:/usr/local/go/bin"
58+
RUN tar -C /usr/local/bin -xzf asdf.tar.gz
6459

65-
RUN go install github.com/asdf-vm/asdf/cmd/asdf@v0.16.0
6660
ENV PATH="/root/.asdf/shims:$PATH"
67-
ENV PATH="${PATH}:/root/go/bin"
6861

6962
RUN asdf plugin add scarb
7063
RUN asdf install scarb 2.9.4
71-
72-
RUN chown -R root:root /usr/local/cargo
73-
RUN chmod -R 700 /usr/local/cargo

.github/workflows/devcontainer.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build and push devcontainer
1+
name: devcontainer
22

33
on:
44
workflow_dispatch:
@@ -17,6 +17,8 @@ on:
1717

1818
jobs:
1919
build-and-push:
20+
# The runner even if 24.04 doesn't have glibc 2.38+ as it should.
21+
# So using a lower glibc version for better compatibility.
2022
runs-on: ubuntu-latest-4-cores
2123

2224
env:

.github/workflows/release.yml

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ jobs:
4747
PLATFORM_NAME: ${{ matrix.job.platform }}
4848
TARGET: ${{ matrix.job.target }}
4949
ARCH: ${{ matrix.job.arch }}
50-
CARGO_PROFILE: performance
5150
strategy:
5251
matrix:
5352
job:
@@ -73,6 +72,10 @@ jobs:
7372
platform: darwin
7473
target: aarch64-apple-darwin
7574
arch: arm64
75+
- os: windows-latest
76+
platform: win32
77+
target: x86_64-pc-windows-msvc
78+
arch: amd64
7679

7780
steps:
7881
- uses: actions/checkout@v4
@@ -85,32 +88,10 @@ jobs:
8588
cache-on-failure: true
8689
cache-key: ${{ matrix.job.target }}
8790

88-
- uses: oven-sh/setup-bun@v2
91+
- uses: arduino/setup-protoc@v2
8992
with:
90-
bun-version: latest
91-
92-
- name: Install LLVM dependencies for Linux
93-
if: ${{ matrix.job.platform == 'linux' }}
94-
run: |
95-
wget https://apt.llvm.org/llvm.sh
96-
chmod +x llvm.sh
97-
sudo ./llvm.sh 19
98-
sudo apt-get update -y
99-
sudo apt-get install -y g++ llvm-19 llvm-19-dev llvm-19-runtime clang-19 clang-tools-19 lld-19 libpolly-19-dev libmlir-19-dev mlir-19-tools
100-
echo "MLIR_SYS_190_PREFIX=/usr/lib/llvm-19" >> $GITHUB_ENV
101-
echo "LLVM_SYS_191_PREFIX=/usr/lib/llvm-19" >> $GITHUB_ENV
102-
echo "TABLEGEN_190_PREFIX=/usr/lib/llvm-19" >> $GITHUB_ENV
103-
104-
- name: Install LLVM dependencies for macOS
105-
if: ${{ matrix.job.platform == 'darwin' }}
106-
run: |
107-
brew install llvm@19 --quiet
108-
brew install zstd
109-
echo "MLIR_SYS_190_PREFIX=$(brew --prefix llvm@19)" >> $GITHUB_ENV
110-
echo "LLVM_SYS_191_PREFIX=$(brew --prefix llvm@19)" >> $GITHUB_ENV
111-
echo "TABLEGEN_190_PREFIX=$(brew --prefix llvm@19)" >> $GITHUB_ENV
112-
echo "LIBRARY_PATH=$(brew --prefix zstd)/lib:$LIBRARY_PATH" >> $GITHUB_ENV
113-
echo "CPATH=$(brew --prefix zstd)/include:$CPATH" >> $GITHUB_ENV
93+
repo-token: ${{ secrets.GITHUB_TOKEN }}
94+
version: "25.x"
11495

11596
- name: Apple M1 setup
11697
if: ${{ matrix.job.target == 'aarch64-apple-darwin' }}
@@ -130,21 +111,26 @@ jobs:
130111
- name: Build binary
131112
run: |
132113
cargo --version
133-
cargo build -p torii --profile ${CARGO_PROFILE} --target ${{ matrix.job.target }}
114+
cargo build -p torii --release --target ${{ matrix.job.target }}
134115
135116
- name: Archive binaries
136117
id: artifacts
137118
env:
138119
VERSION_NAME: ${{ needs.prepare.outputs.tag_name }}
139120
run: |
140121
if [ "$PLATFORM_NAME" == "linux" ]; then
141-
tar -czvf "torii_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/${CARGO_PROFILE} torii
122+
tar -czvf "torii_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release torii
142123
echo "file_name=torii_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT
143124
elif [ "$PLATFORM_NAME" == "darwin" ]; then
144125
# We need to use gtar here otherwise the archive is corrupt.
145126
# See: https://github.com/actions/virtual-environments/issues/2619
146-
gtar -czvf "torii_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/${CARGO_PROFILE} torii
127+
gtar -czvf "torii_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release torii
147128
echo "file_name=torii_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT
129+
else
130+
cd ./target/${TARGET}/release
131+
7z a -tzip "torii_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" torii.exe
132+
mv "torii_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" ../../../
133+
echo "file_name=torii_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" >> $GITHUB_OUTPUT
148134
fi
149135
shell: bash
150136

@@ -153,7 +139,7 @@ jobs:
153139
if: ${{ env.PLATFORM_NAME == 'linux' }}
154140
run: |
155141
mkdir -p $PLATFORM_NAME/$ARCH
156-
mv target/${TARGET}/${CARGO_PROFILE}/torii $PLATFORM_NAME/$ARCH
142+
mv target/${TARGET}/release/torii $PLATFORM_NAME/$ARCH
157143
shell: bash
158144

159145
- name: Upload docker binaries
@@ -171,11 +157,12 @@ jobs:
171157
retention-days: 1
172158

173159
create-draft-release:
174-
runs-on: ubuntu-20.04-4-cores
160+
runs-on: ubuntu-latest-4-cores
175161
needs: [prepare, release]
176162
env:
177163
GITHUB_USER: ${{ github.repository_owner }}
178164
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165+
if: ${{ !contains(needs.prepare.outputs.tag_name, 'preview') }}
179166
steps:
180167
- uses: actions/checkout@v4
181168
- uses: actions/download-artifact@v4
@@ -189,15 +176,15 @@ jobs:
189176
echo "version=v$(cargo get workspace.package.version)" >> $GITHUB_OUTPUT
190177
- name: Display structure of downloaded files
191178
run: ls -R artifacts
192-
- run: gh release create ${{ steps.version_info.outputs.version }} ./artifacts/* --generate-notes --draft
179+
- run: gh release create ${{ steps.version_info.outputs.version }} ./artifacts/*.{gz,zip} --generate-notes --draft
193180

194181
docker-build-and-push:
195-
runs-on: ubuntu-20.04-4-cores
182+
runs-on: ubuntu-latest-4-cores
196183
needs: [prepare, release]
197184

198185
steps:
199186
- name: Checkout repository
200-
uses: actions/checkout@v2
187+
uses: actions/checkout@v4
201188

202189
- name: Download binaries
203190
uses: actions/download-artifact@v4

.github/workflows/test.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
container:
1717
image: ghcr.io/dojoengine/torii-dev:latest
1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
- uses: Swatinem/rust-cache@v2
2121
- run: scripts/rust_fmt.sh
2222

@@ -26,29 +26,29 @@ jobs:
2626
container:
2727
image: ghcr.io/dojoengine/torii-dev:latest
2828
steps:
29-
- uses: actions/checkout@v3
30-
with:
31-
submodules: recursive
32-
# Workaround for https://github.com/actions/runner-images/issues/6775
33-
- run: git config --global --add safe.directory "*"
34-
35-
- name: Run Clippy
36-
run: |
37-
./scripts/clippy.sh
29+
- uses: actions/checkout@v4
30+
- uses: Swatinem/rust-cache@v2
31+
- run: ./scripts/clippy.sh
3832

3933
test:
4034
needs: [fmt, clippy]
4135
runs-on: ubuntu-latest-32-cores
4236
container:
4337
image: ghcr.io/dojoengine/torii-dev:latest
4438
steps:
45-
- uses: actions/checkout@v3
39+
- uses: actions/checkout@v4
4640
- uses: Swatinem/rust-cache@v2
4741

48-
- name: Build Torii binary
42+
- name: Check env
43+
run: |
44+
strings /lib/x86_64-linux-gnu/libc.so.6 | grep GLIBC_
45+
ldd --version
46+
47+
# This puts Katana in the path for integration tests.
48+
- name: Download Katana for integration tests
4949
run: |
50-
cargo build --release --bin torii
51-
echo "$PWD/target/release" >> $GITHUB_PATH
50+
curl -L https://github.com/dojoengine/katana/releases/download/v1.5.0-alpha.2/katana_v1.5.0-alpha.2_linux_amd64.tar.gz -o katana.tar.gz;
51+
tar -C /usr/local/bin -xzf katana.tar.gz
5252
5353
- name: Run tests
5454
run: |

0 commit comments

Comments
 (0)