Merge pull request #31 from openSVM/copilot/fix-30 #3
Workflow file for this run
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: Publish Rust SDK to crates.io | |
| on: | |
| release: | |
| types: [published] | |
| push: | |
| tags: | |
| - 'sdk/rust/v*' # Triggers on tags like sdk/rust/v0.1.0, sdk/rust/v1.0.0, etc. | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| publish: | |
| name: Publish to crates.io | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./rust | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| profile: minimal | |
| 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') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Check formatting | |
| run: cargo fmt -- --check | |
| - name: Build package | |
| run: cargo build --release --all-features | |
| - name: Run tests | |
| run: cargo test --all-features | |
| - name: Run tests without default features | |
| run: cargo test --no-default-features | |
| - name: Run tests with individual features | |
| run: | | |
| cargo test --features pyg | |
| cargo test --features prepay | |
| cargo test --features stream | |
| - name: Package crate | |
| run: cargo package | |
| - name: Publish to crates.io | |
| run: cargo publish --token ${{ secrets.CARGO_API_KEY }} | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_KEY }} |