Skip to content
Merged
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
20 changes: 3 additions & 17 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@ jobs:
uses: dtolnay/rust-toolchain@stable

- name: Generate Rust docs
continue-on-error: true
run: cargo doc -p vault --no-deps

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: frontend/package-lock.json

- name: Install frontend dependencies
run: npm install
working-directory: frontend

- name: Generate frontend API docs
run: npm run docs:api
working-directory: frontend
run: |
cargo doc -p share-price-math --no-deps
cargo doc -p mock-strategy --no-deps
4 changes: 4 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: E2E Tests

on:
pull_request:
paths:
- 'frontend/**'
push:
branches:
- main
paths:
- 'frontend/**'

jobs:
e2e:
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,10 @@ jobs:
- name: Run cargo fmt check
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Run tests
run: cargo test --all-features --workspace --locked --quiet
- name: Run clippy (share-price math)
run: cargo clippy -p share-price-math --all-targets -- -D warnings
working-directory: contracts

- name: Add WASM target
run: rustup target add wasm32-unknown-unknown

- name: Build WASM artifacts
run: |
cd contracts
cargo build --all --target wasm32-unknown-unknown --release
- name: Run share-price math unit tests
run: cargo test -p share-price-math --locked --quiet
working-directory: contracts
16 changes: 14 additions & 2 deletions .github/workflows/rust-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ jobs:
npm audit --json > frontend/frontend-audit.json || true
node scripts/dependency-audit.js npm frontend frontend/frontend-audit.json

- name: Run cargo-clippy (linting)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run cargo-clippy (share-price math)
run: cargo clippy -p share-price-math --all-targets -- -D warnings
working-directory: contracts
continue-on-error: true

- name: Run cargo-deny (supply chain security)
Expand All @@ -85,3 +86,14 @@ jobs:
else
echo "✓ No unsafe code found in production code"
fi

- name: Set up Rust nightly (cargo-fuzz)
uses: dtolnay/rust-toolchain@nightly

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

- name: Run vault share-price fuzz (60s)
run: |
cd contracts/vault
cargo +nightly fuzz run share_price_math -- -max_total_time=60
46 changes: 37 additions & 9 deletions .github/workflows/rust-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,46 @@ jobs:
- name: Run cargo fmt check
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run clippy (share-price math)
run: cargo clippy -p share-price-math --all-targets -- -D warnings
working-directory: ./contracts

- name: Run tests
run: cargo test --all-features --workspace --locked --quiet
- name: Run share-price math unit tests
run: cargo test -p share-price-math --locked --quiet
working-directory: ./contracts
env:
PROPTEST_CASES: "10000"

vault-fuzz:
name: Vault share-price fuzz (60s)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Rust nightly (cargo-fuzz)
uses: dtolnay/rust-toolchain@nightly

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

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

- name: Run share_price_math fuzz target
run: |
cd contracts/vault
cargo +nightly fuzz run share_price_math -- -max_total_time=60

wasm-build:
name: Build WASM artifacts
runs-on: ubuntu-latest
needs: rust-test
needs: vault-fuzz
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -71,10 +98,11 @@ jobs:
- name: Add WASM target
run: rustup target add wasm32-unknown-unknown

- name: Build all contract crates to WASM
- name: Build contract crates to WASM
run: |
cd contracts
cargo build --all --target wasm32-unknown-unknown --release
cargo build -p mock-strategy --target wasm32-unknown-unknown --release
# vault wasm build is blocked upstream by DataKey contracttype limits (LengthExceedsMax)

- name: Collect built WASM
run: |
Expand Down
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver = "2"
members = [
"contracts/vault",
"contracts/mock-strategy",
"contracts/share-price-math",
]

[workspace.dependencies]
Expand Down
Loading
Loading