Skip to content

Commit

Permalink
chore: add Rust setup action and integrate it into workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
itsyaasir committed Nov 25, 2024
1 parent ef61d01 commit 3e9a299
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 33 deletions.
1 change: 0 additions & 1 deletion .github/actions/iota-private-network/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ runs:
run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- -t 60 http://127.0.0.1:9000 -- echo "IOTA full node is up"
env:
WAIT_FOR_VERSION: 4df3f9262d84cab0039c07bf861045fbb3c20ab7 # v2.2.3

19 changes: 19 additions & 0 deletions .github/actions/rust/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Setup Rust"
description: "Setup Rust toolchain"
runs:
using: "composite"
steps:
- name: Install Rust
shell: bash
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
rustup update
rustup component add clippy
- name: Toolchain info
shell: bash
run: |
cargo --version --verbose
rustc --version
cargo clippy --version
14 changes: 4 additions & 10 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main

Expand All @@ -14,15 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update local toolchain
run: |
rustup update
rustup component add clippy
- name: Toolchain info
run: |
cargo --version --verbose
rustc --version
cargo clippy --version
- name: Rust setup
uses: ./.github/actions/rust/setup

- name: Check formatting
run: cargo fmt -- --check
- name: Run clippy
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ on:
jobs:
run-tests:
runs-on: ubuntu-latest
container:
image: debian:bookworm-slim

steps:
- uses: actions/checkout@v3
- name: Update local toolchain
run: |
rustup update
rustup component add clippy
- name: Toolchain info
run: |
cargo --version --verbose
rustc --version
cargo clippy --version

- name: Setup Rust
uses: "./.github/actions/rust/setup"

- name: Start iota sandbox
uses: './.github/actions/iota-private-network/setup'
uses: "./.github/actions/iota-private-network/setup"

- name: Run tests
run: cargo test --release
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ path = "src/main.rs"
name = "uni-resolver-driver-iota"

[dependencies]
tokio = { version = "1", features = ["net"] }
anyhow = "1.0.93"
axum = { version = "0.7.9", features = ["tracing"] }
identity_iota = { git = "https://github.com/iotaledger/identity.rs", branch = "feat/identity-rebased", package = "identity_iota" }
identity_iota_core = { git = "https://github.com/iotaledger/identity.rs", branch = "feat/identity-rebased", package = "identity_iota_core" }
iota-sdk = { git = "https://github.com/iotaledger/iota.git", package = "iota-sdk", tag = "v0.7.0-alpha" }
anyhow = "1.0.93"
axum = { version = "0.7.9", features = ["tracing"] }
serde = "1.0"
serde_json = "1.0"
tokio = { version = "1", features = ["net"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

[dev-dependencies]
async-trait = "0.1.76"
dotenvy = "0.15.7"
fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "5f2c63266a065996d53f98156f0412782b468597", package = "fastcrypto" }
identity_storage = { git = "https://github.com/iotaledger/identity.rs", branch = "feat/identity-rebased", package = "identity_storage" }
iota-keys = { git = "https://github.com/iotaledger/iota.git", package = "iota-keys", tag = "v0.7.0-alpha" }
rand = "0.8.5"
reqwest = { version = "0.12.9", features = ["json", "rustls-tls"] }
secret-storage = { git = "https://github.com/iotaledger/secret-storage", tag = "v0.1.0" }
fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "5f2c63266a065996d53f98156f0412782b468597", package = "fastcrypto" }
iota-keys = { git = "https://github.com/iotaledger/iota.git", package = "iota-keys", tag = "v0.7.0-alpha" }
async-trait = "0.1.76"
identity_storage = { git = "https://github.com/iotaledger/identity.rs", branch = "feat/identity-rebased", package = "identity_storage" }
dotenvy = "0.15.7"
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WORKDIR /app
RUN apt update && apt install lld clang -y

FROM chef as planner
COPY . .
COPY . .
# Compute lock file for project
RUN cargo chef prepare --recipe-path recipe.json

Expand All @@ -12,7 +12,7 @@ COPY --from=planner /app/recipe.json recipe.json
# Build project's dependencies
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
# Build project
# Build project
RUN cargo build --release --bin uni-resolver-driver-iota

FROM debian:bookworm-slim AS runtime
Expand All @@ -25,6 +25,10 @@ RUN apt-get update -y \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/uni-resolver-driver-iota uni-resolver-driver-iota
EXPOSE 8080
ENV IOTA_CUSTOM_NETWORK_NAME=rms
ENV IOTA_CUSTOM_NODE_ENDPOINT=https://api.testnet.shimmer.network
ENV IOTA_CUSTOM_NODE_ENDPOINT=
ENV IOTA_CUSTOM_IDENTITY_PKG_ID=

ENV IOTA_MAINNET_IDENTITY_PKG_ID=
ENV IOTA_MAINNET_NODE_ENDPOINT=

ENTRYPOINT [ "./uni-resolver-driver-iota" ]

0 comments on commit 3e9a299

Please sign in to comment.