Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ name: CI
on:
push:
branches: [main, dev]
paths:
- 'packages/contracts/**'
- '.github/workflows/ci.yml'
- 'Makefile'
pull_request:
branches: [main, dev]
paths:
- 'packages/contracts/**'
- '.github/workflows/ci.yml'
- 'Makefile'

jobs:
website:
Expand Down Expand Up @@ -95,3 +103,50 @@ jobs:

- name: Lint
run: npm run lint

soroban-contracts:
name: Soroban Contracts (Rust/WASM)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true

- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Format Check
run: make fmt-check

- name: Clippy
run: make clippy

- name: Build Contracts
run: make build

- name: Run Unit Tests
run: make test

- name: Run Integration Tests
run: make integration-test

- name: Upload WASM Artifacts
uses: actions/upload-artifact@v4
with:
name: soroban-wasm
path: |
target/wasm32-unknown-unknown/release/*.wasm
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.PHONY: fmt fmt-check clippy build test integration-test clean

CARGO := cargo
CONTRACTS_DIR := packages/contracts
WASM_TARGET := wasm32-unknown-unknown

fmt:
cd $(CONTRACTS_DIR) && $(CARGO) fmt --all

fmt-check:
cd $(CONTRACTS_DIR) && $(CARGO) fmt --all -- --check

clippy:
cd $(CONTRACTS_DIR) && $(CARGO) clippy --all-targets --all-features -- -D warnings

build:
cd $(CONTRACTS_DIR) && $(CARGO) build --target $(WASM_TARGET) --release

test:
cd $(CONTRACTS_DIR) && $(CARGO) test --all

integration-test:
cd $(CONTRACTS_DIR) && $(CARGO) test --test '*'

clean:
cd $(CONTRACTS_DIR) && $(CARGO) clean
15 changes: 15 additions & 0 deletions packages/contracts/contracts/hello_world/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "hello_world"
version = "0.0.0"
edition = "2021"
publish = false

[lib]
crate-type = ["cdylib"]
doctest = false

[dependencies]
soroban-sdk = { workspace = true }

[dev-dependencies]
soroban-sdk = { workspace = true, features = ["testutils"] }
10 changes: 3 additions & 7 deletions packages/contracts/contracts/hello_world/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@ impl NesterContract {
vec![&env, symbol_short!("Hello"), to]
}

pub fn initiate_swap(env: Env, swap_info: SwapInfo) -> Vec<Symbol> {}

pub
pub fn initiate_swap(env: Env, swap_info: SwapInfo) -> Vec<Symbol> {
vec![&env]
}
}

pub struct SwapInfo {
pub amount: u128,


}

/*
- deposit, initiate_swap,
*/

mod test;
Loading