[SDK] Introduce a replacement Rust SDK for the entirety of the existi… #37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| format: | |
| name: Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: "1.90" | |
| components: rustfmt | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: "1.90" | |
| components: clippy | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Run Clippy (default features) | |
| run: cargo clippy -p aptos-rust-sdk-v2 --all-targets -- -D warnings | |
| - name: Run Clippy (all features) | |
| run: cargo clippy -p aptos-rust-sdk-v2 --all-targets --all-features -- -D warnings | |
| - name: Run Clippy (no default features) | |
| run: cargo clippy -p aptos-rust-sdk-v2 --no-default-features -- -D warnings | |
| test: | |
| name: Test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| rust: [stable] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust ${{ matrix.rust }} | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build | |
| run: cargo build -p aptos-rust-sdk-v2 --all-targets | |
| - name: Run tests | |
| run: cargo test -p aptos-rust-sdk-v2 --all-targets | |
| - name: Run tests (all features) | |
| run: cargo test -p aptos-rust-sdk-v2 --all-targets --all-features | |
| test-features: | |
| name: Test Feature Combinations | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: "1.90" | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Test with only ed25519 | |
| run: cargo test -p aptos-rust-sdk-v2 --no-default-features --features ed25519 | |
| - name: Test with only secp256k1 | |
| run: cargo test -p aptos-rust-sdk-v2 --no-default-features --features secp256k1 | |
| - name: Test with secp256r1 | |
| run: cargo test -p aptos-rust-sdk-v2 --features secp256r1 | |
| - name: Test with bls | |
| run: cargo test -p aptos-rust-sdk-v2 --features bls | |
| - name: Test with faucet | |
| run: cargo test -p aptos-rust-sdk-v2 --features faucet | |
| - name: Test with indexer | |
| run: cargo test -p aptos-rust-sdk-v2 --features indexer | |
| - name: Test with full features | |
| run: cargo test -p aptos-rust-sdk-v2 --features full | |
| # Spec tests (behavioral tests from specifications) | |
| # TODO: Re-enable once specification tests are stabilized | |
| # spec-tests: | |
| # name: Spec Tests | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v6 | |
| # | |
| # - name: Install Rust | |
| # uses: dtolnay/rust-toolchain@stable | |
| # | |
| # - name: Cache cargo | |
| # uses: Swatinem/rust-cache@v2 | |
| # | |
| # - name: Run spec tests | |
| # run: cargo test --test specs | |
| # working-directory: specifications/tests/rust | |
| docs: | |
| name: Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: "1.90" | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Check documentation | |
| env: | |
| RUSTDOCFLAGS: -D warnings | |
| run: cargo doc -p aptos-rust-sdk-v2 --no-deps --all-features | |
| - name: Check examples documentation | |
| env: | |
| RUSTDOCFLAGS: -D warnings | |
| run: cargo doc -p aptos-rust-sdk-v2 --all-features --document-private-items | |
| # Deploy docs to GitHub Pages on main branch | |
| deploy-docs: | |
| name: Deploy Documentation | |
| runs-on: ubuntu-latest | |
| needs: [docs, test, lint] | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: "1.90" | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build documentation | |
| env: | |
| RUSTDOCFLAGS: --cfg docsrs | |
| run: cargo doc -p aptos-rust-sdk-v2 --no-deps --all-features | |
| - name: Add redirect to main crate | |
| run: | | |
| echo '<meta http-equiv="refresh" content="0; url=aptos_rust_sdk_v2/index.html">' > target/doc/index.html | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: target/doc | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| msrv: | |
| name: Minimum Supported Rust Version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Rust 1.85 | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: "1.85" | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Check MSRV | |
| run: cargo check -p aptos-rust-sdk-v2 | |
| security-audit: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install cargo-audit | |
| run: cargo install cargo-audit | |
| - name: Run security audit | |
| run: cargo audit |