Skip to content

Implement Zero-Knowledge Proof Compliance System #53

Implement Zero-Knowledge Proof Compliance System

Implement Zero-Knowledge Proof Compliance System #53

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Add WASM target
run: rustup target add wasm32-unknown-unknown
- name: Install cargo-contract
run: cargo install cargo-contract --locked
- name: Check formatting
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
- name: Run PropertyRegistry unit tests
working-directory: contracts/lib
run: cargo test --lib
- name: Build contracts
run: |
cd contracts
for dir in */; do
if [ -f "$dir/Cargo.toml" ]; then
cd "$dir"
cargo contract build
cd ..
fi
done
- name: Run contract tests
run: |
cd contracts
for dir in */; do
if [ -f "$dir/Cargo.toml" ]; then
cd "$dir"
cargo contract test
cd ..
fi
done
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Run security audit
run: cargo audit
- name: Run cargo-deny
uses: EmbarkStudios/cargo-deny-action@v1
build:
name: Build Release
runs-on: ubuntu-latest
needs: [test, security]
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Add WASM target
run: rustup target add wasm32-unknown-unknown
- name: Install cargo-contract
run: cargo install cargo-contract --locked
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
- name: Build contracts in release mode
run: |
cd contracts
for dir in */; do
if [ -f "$dir/Cargo.toml" ]; then
cd "$dir"
cargo contract build --release
cd ..
fi
done
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: contracts
path: |
contracts/*/target/ink/*.contract
contracts/*/target/ink/*.wasm
deploy-testnet:
name: Deploy to Testnet
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
environment: testnet
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Add WASM target
run: rustup target add wasm32-unknown-unknown
- name: Install cargo-contract
run: cargo install cargo-contract --locked
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: contracts
path: artifacts/
- name: Deploy to Westend testnet
env:
SURI: ${{ secrets.WESTEND_SURI }}
run: |
./scripts/deploy.sh --network westend
continue-on-error: true
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Generate documentation
run: cargo doc --all-features --no-deps
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: target/doc