Skip to content

Commit

Permalink
merge dojo/main
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Dec 21, 2023
2 parents 4d8c089 + e351f0f commit a62754e
Show file tree
Hide file tree
Showing 98 changed files with 17,377 additions and 1,283 deletions.
29 changes: 21 additions & 8 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# 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 bookworm on local arm64/Apple Silicon): buster, bullseye, bookworm
ARG VARIANT
ARG TARGETPLATFORM

ARG 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 apt install -y gh libgmp3-dev

COPY rust-toolchain.toml .

Expand All @@ -22,17 +21,31 @@ RUN rustup toolchain install $(cat rust-toolchain.toml | grep channel | cut -d\"
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 rustup toolchain install nightly && \
rustup target add x86_64-fortanix-unknown-sgx --toolchain nightly
RUN cargo binstall cargo-get cargo-nextest cargo-llvm-cov cargo-release --secure -y

RUN cargo binstall cargo-nextest cargo-llvm-cov --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 \
rustup component add llvm-tools-preview --toolchain 1.70.0-x86_64-unknown-linux-gnu; \
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

RUN curl -L https://install.dojoengine.org | bash
Expand All @@ -41,4 +54,4 @@ ENV PATH=${PATH}:/root/.dojo/bin
RUN dojoup

RUN chown -R root:root /usr/local/cargo
RUN chmod -R 700 /usr/local/cargo
RUN chmod -R 700 /usr/local/cargo
8 changes: 2 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:54f0635",
"image": "ghcr.io/dojoengine/dojo-dev:448ffda",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
Expand Down Expand Up @@ -34,13 +34,9 @@
},
// 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:/home/vscode/.dojo/bin"
},
"postCreateCommand": "dojoup/dojoup && cargo install cargo-nextest"
}
}
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.

2 changes: 1 addition & 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 Down
64 changes: 20 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,27 @@ env:

jobs:
test:
runs-on: ubuntu-latest-4-cores
runs-on: ubuntu-latest-16-cores
container:
image: ghcr.io/dojoengine/dojo-dev:54f0635
image: ghcr.io/dojoengine/dojo-dev:448ffda
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2
- run: cargo nextest run --all-features
- run: cargo llvm-cov nextest --all-features --lcov --output-path lcov.info
- uses: codecov/codecov-action@v3
with:
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
with:
toolchain: ${{ env.RUST_VERSION }}
targets: wasm32-unknown-unknown
- 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 -r --target wasm32-unknown-unknown -p torii-client

ensure-windows:
runs-on: windows-latest
Expand All @@ -46,9 +44,7 @@ jobs:
target: x86_64-pc-windows-msvc
- uses: Swatinem/rust-cache@v2
- uses: arduino/setup-protoc@v2
- name: "Ensure buildable on windows"
run: |
cargo build --target x86_64-pc-windows-msvc --bins
- run: cargo build --target x86_64-pc-windows-msvc --bins

# cairofmt:
# runs-on: ubuntu-latest
Expand All @@ -64,54 +60,34 @@ jobs:

clippy:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:448ffda
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- 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

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
19 changes: 13 additions & 6 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,27 @@ jobs:
needs: build-and-push
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
pull-requests: write
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Update devcontainer.json
run: sed -i "s|ghcr.io/dojoengine/dojo-dev:[a-zA-Z0-9._-]*|ghcr.io/dojoengine/dojo-dev:${{ needs.build-and-push.outputs.tag_name }}|" .devcontainer/devcontainer.json

- name: Update ci devcontainers
run: sed -i "s|ghcr.io/dojoengine/dojo-dev:[a-zA-Z0-9._-]*|ghcr.io/dojoengine/dojo-dev:${{ needs.build-and-push.outputs.tag_name }}|" .github/workflows/ci.yml
- name: Update github action devcontainers
run: |
for file in .github/workflows/*.yml; do
if [[ $file != ".github/workflows/devcontainer.yml" ]]; then
sed -i "s|ghcr.io/dojoengine/dojo-dev:[a-zA-Z0-9._-]*|ghcr.io/dojoengine/dojo-dev:${{ needs.build-and-push.outputs.tag_name }}|" "$file"
fi
done
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
- uses: peter-evans/create-pull-request@v5
with:
# We have to use a PAT in order to trigger ci
token: ${{ secrets.CREATE_PR_TOKEN }}
title: "Update devcontainer image hash: ${{ needs.build-and-push.outputs.tag_name }}"
commit-message: "Update devcontainer image hash: ${{ needs.build-and-push.outputs.tag_name }}"
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/release-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: release-dispatch
on:
workflow_dispatch:
inputs:
version:
description: Version to release
required: true
type: string

jobs:
propose-release:
permissions:
pull-requests: write
contents: write
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:448ffda
steps:
# Workaround described here: https://github.com/actions/checkout/issues/760
- uses: actions/checkout@v3
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- run: cargo release version ${{ inputs.version }} --execute --no-confirm && cargo release replace --execute --no-confirm
- id: version_info
run: |
cargo install cargo-get
echo "version=$(cargo get workspace.package.version)" >> $GITHUB_OUTPUT
- uses: peter-evans/create-pull-request@v5
with:
# We have to use a PAT in order to trigger ci
token: ${{ secrets.CREATE_PR_TOKEN }}
title: "Prepare release: v${{ steps.version_info.outputs.version }}"
commit-message: "Prepare release: v${{ steps.version_info.outputs.version }}"
branch: prepare-release
base: main
delete-branch: true
Loading

0 comments on commit a62754e

Please sign in to comment.