Skip to content

Commit

Permalink
Merge branch 'main' into print-enum
Browse files Browse the repository at this point in the history
  • Loading branch information
0xicosahedron committed Dec 22, 2023
2 parents f95e193 + e351f0f commit 91499e9
Show file tree
Hide file tree
Showing 397 changed files with 36,980 additions and 18,295 deletions.
72 changes: 46 additions & 26 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,57 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/rust/.devcontainer/base.Dockerfile

# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye
# [Choice] Debian OS version (use bookworm on local arm64/Apple Silicon): buster, bullseye, bookworm

ARG VARIANT
FROM mcr.microsoft.com/vscode/devcontainers/rust:0-${VARIANT}
FROM mcr.microsoft.com/vscode/devcontainers/rust:${VARIANT}

# Install additional packages
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends protobuf-compiler libprotobuf-dev libclang-dev

RUN apt install -y libgmp3-dev

RUN rustup toolchain install 1.70.0 && \
rustup default 1.70.0 && rustup component add clippy && rustup component add rustfmt

# Install Python
ARG PYTHON_PATH=/usr/local/python
ENV PIPX_HOME=/usr/local/py-utils \
PIPX_BIN_DIR=/usr/local/py-utils/bin
ENV PATH=${PYTHON_PATH}/bin:${PATH}:${PIPX_BIN_DIR}
COPY .devcontainer/library-scripts/python-debian.sh /tmp/library-scripts/
RUN apt-get update && bash /tmp/library-scripts/python-debian.sh "3.9.6" "${PYTHON_PATH}" "${PIPX_HOME}"

# Install nodejs
ENV NVM_DIR="/usr/local/share/nvm"
ENV NVM_SYMLINK_CURRENT=true \
PATH=${NVM_DIR}/current/bin:${PATH}
COPY .devcontainer/library-scripts/node-debian.sh /tmp/library-scripts/
RUN apt-get update && bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}"

RUN pip install starknet-devnet==v0.5.0a2
RUN apt install -y gh libgmp3-dev

COPY rust-toolchain.toml .

# Install cargo-binstall
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

RUN rustup toolchain install $(cat rust-toolchain.toml | grep channel | cut -d\" -f2) && \
rustup default $(cat rust-toolchain.toml | grep channel | cut -d\" -f2) && \
rustup component add clippy && \
rustup component add rustfmt

RUN rustup toolchain install nightly && \
rustup component add rustfmt --toolchain nightly

RUN rustup target add x86_64-pc-windows-msvc && \
rustup target add wasm32-unknown-unknown

RUN cargo binstall cargo-get cargo-nextest cargo-llvm-cov cargo-release --secure -y

# Platform specific tooling
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then \
curl -L https://github.com/Orange-OpenSource/hurl/releases/download/4.1.0/hurl-4.1.0-aarch64-unknown-linux-gnu.tar.gz -o hurl.tar.gz && \
tar -xzf hurl.tar.gz && \
mv hurl-4.1.0-aarch64-unknown-linux-gnu/hurl /usr/local/bin/ && \
rm -r hurl-4.1.0-aarch64-unknown-linux-gnu && \
rm hurl.tar.gz && \
rustup component add llvm-tools-preview --toolchain 1.70.0-aarch64-unknown-linux-gnu; \
elif [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \
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 && \
tar -xzf hurl.tar.gz && \
mv hurl-4.1.0-x86_64-unknown-linux-gnu/hurl /usr/local/bin/ && \
rm -r hurl-4.1.0-x86_64-unknown-linux-gnu && \
rm hurl.tar.gz && \
rustup component add llvm-tools-preview --toolchain 1.70.0-x86_64-unknown-linux-gnu && \
rustup target add x86_64-fortanix-unknown-sgx --toolchain nightly; \
fi

# Install dojoup for vscode user
USER vscode
RUN curl -L https://install.dojoengine.org | bash
RUN curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash
ENV PATH=${PATH}:/root/.dojo/bin
RUN dojoup

ENV PATH=${PATH}:/workspaces/dojo/target/release
RUN chown -R root:root /usr/local/cargo
RUN chmod -R 700 /usr/local/cargo
10 changes: 4 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/rust
{
"name": "Rust",
"image": "ghcr.io/dojoengine/dojo-dev:72f7bc2220f0438e435052f807e58c09b7b61cbe",
"image": "ghcr.io/dojoengine/dojo-dev:448ffda",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
Expand All @@ -27,18 +27,16 @@
"mutantdino.resourcemonitor",
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"serayuzgur.crates"
"serayuzgur.crates",
"starkware.cairo1"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "rustc --version",
// "postCreateCommand": ". scripts/startup.sh",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode",
"remoteEnv": {
"PATH": "${containerEnv:PATH}:/workspace/dojo/target/release"
"PATH": "${containerEnv:PATH}:/workspace/dojo/target/release:/home/vscode/.dojo/bin"
}
}
Binary file added .github/feature_matrix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 0 additions & 14 deletions .github/scripts/create-tag.js

This file was deleted.

15 changes: 0 additions & 15 deletions .github/scripts/move-tag.js

This file was deleted.

39 changes: 0 additions & 39 deletions .github/scripts/prune-prereleases.js

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/cargo-udeps.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Unused dependencies
name: cargo-udeps

on:
schedule:
Expand All @@ -22,6 +22,8 @@ jobs:
# cargo-udeps require nightly to run
toolchain: nightly

- uses: arduino/setup-protoc@v2

- name: Install cargo-udeps
run: cargo install --locked cargo-udeps

Expand Down
122 changes: 34 additions & 88 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,39 @@ env:

jobs:
test:
runs-on: ubuntu-latest-4-cores
runs-on: ubuntu-latest-16-cores
container:
image: ghcr.io/dojoengine/dojo-dev:448ffda
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- uses: arduino/setup-protoc@v1
- run: cargo llvm-cov nextest --all-features --lcov --output-path lcov.info
- uses: codecov/codecov-action@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install nextest test runner
uses: taiki-e/install-action@nextest
- run: |
cargo nextest run --all-features
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true

ensure-wasm:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:448ffda
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
- uses: Swatinem/rust-cache@v2
- run: cargo build -r --target wasm32-unknown-unknown -p torii-client

ensure-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
targets: wasm32-unknown-unknown
target: x86_64-pc-windows-msvc
- uses: Swatinem/rust-cache@v2
- uses: arduino/setup-protoc@v2
- name: "Ensure `torii-client` crate is WASM-able"
run: |
cargo build -r --target wasm32-unknown-unknown -p torii-client
- run: cargo build --target x86_64-pc-windows-msvc --bins

# cairofmt:
# runs-on: ubuntu-latest
Expand All @@ -55,121 +60,62 @@ jobs:

dojo-core-test:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:448ffda
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- uses: arduino/setup-protoc@v2
- run: cargo run --bin sozo -- --manifest-path crates/dojo-core/Scarb.toml test

dojo-erc-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- uses: arduino/setup-protoc@v2
- run: cargo run --bin sozo -- --manifest-path crates/dojo-erc/Scarb.toml test

dojo-defi-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- uses: arduino/setup-protoc@v2
- run: cargo run --bin sozo -- --manifest-path crates/dojo-defi/Scarb.toml test

dojo-primitive-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- uses: arduino/setup-protoc@v2
- run: cargo run --bin sozo -- --manifest-path crates/dojo-primitives/Scarb.toml test

dojo-spawn-and-move-example-test:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:448ffda
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- uses: arduino/setup-protoc@v2
- run: cargo run --bin sozo -- --manifest-path examples/spawn-and-move/Scarb.toml test

clippy:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:448ffda
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: wasm32-unknown-unknown
components: clippy
- uses: Swatinem/rust-cache@v2
- uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: scripts/clippy.sh

fmt:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:448ffda
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- uses: Swatinem/rust-cache@v2
- uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: scripts/rust_fmt.sh --check

docs:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:448ffda
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: >
scripts/docs.sh
test-hurl:
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- name: Install Hurl
run: |
- run: |
curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/3.0.0/hurl_3.0.0_amd64.deb
sudo apt update && sudo apt install ./hurl_3.0.0_amd64.deb
- name: Build and start Katana node
run: |
- run: |
cargo build --bin katana
nohup target/debug/katana --accounts 2 --disable-fee &
- name: Execute Hurl Scripts
run: hurl --test examples/rpc/**/*.hurl
- run: hurl --test examples/rpc/**/*.hurl
Loading

0 comments on commit 91499e9

Please sign in to comment.