stellar-rpc-client 26.0.0

Stellar RPC client for rust
Documentation
---
name: Rust

on:
  push:
    branches: [main, release/**]
  pull_request:

defaults:
  run:
    shell: bash

jobs:

  complete:
    if: always()
    needs: [fmt, build-and-test, publish-dry-run]
    runs-on: ubuntu-latest
    steps:
      - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
        run: exit 1

  semver-checks:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - run: rustup update
      - uses: stellar/binaries@v55
        with:
          name: cargo-semver-checks
          version: 0.46.0
      - run: >
          cargo semver-checks
  fmt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - run: rustup update
      - run: cargo fmt --all --check

  build-and-test:
    strategy:
      fail-fast: false
      matrix:
        rust: [msrv, latest]
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
          - os: macos-latest
            target: x86_64-apple-darwin
          - os: macos-latest
            target: aarch64-apple-darwin
          - os: windows-latest-8-cores
            target: x86_64-pc-windows-msvc
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v6
      - uses: stellar/actions/rust-cache@main
      - name: Use the minimum supported Rust version
        if: matrix.rust == 'msrv'
        run: |
          msrv="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages | map(.rust_version) | map(values) | min')"
          rustup override set $msrv
          rustup component add clippy --toolchain $msrv
      - name: Error on warnings and clippy checks
        # Only error on warnings and checks for the msrv, because new versions of
        # Rust will frequently add new warnings and checks.
        if: matrix.rust == 'msrv'
        run: echo RUSTFLAGS='-Dwarnings -Dclippy::all -Dclippy::pedantic' >> $GITHUB_ENV
      - run: rustup update
      - run: cargo version
      - run: rustup target add ${{ matrix.target }}
      - if: matrix.target == 'aarch64-unknown-linux-gnu'
        run: sudo apt-get update && sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
      - run: make build
      - run: make test

  publish-dry-run:
    if: github.event_name == 'push' || startsWith(github.head_ref, 'release/')
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            cargo-hack-feature-options: --feature-powerset
          - os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
            cargo-hack-feature-options: --feature-powerset
          - os: macos-latest
            target: x86_64-apple-darwin
            cargo-hack-feature-options: --feature-powerset
          - os: macos-latest
            target: aarch64-apple-darwin
            cargo-hack-feature-options: --feature-powerset
          # Windows builds notes:
          #
          # The different features that need testing are split over unique
          # isolated builds for Windows, because there's a bug in Cargo [1] that
          # causes builds of wasm-opt [2] to fail when run one after the other and
          # attempting to clean up artifacts in between. The bug has been fixed,
          # but will not make it into a stable release of Cargo until ~August
          # 2023.
          #
          # [1]: https://github.com/rust-lang/cargo/pull/11442
          # [2]: https://github.com/brson/wasm-opt-rs/issues/116
          - os: windows-latest-8-cores
            target: x86_64-pc-windows-msvc
            cargo-hack-feature-options: ''
          - os: windows-latest-8-cores
            target: x86_64-pc-windows-msvc
            cargo-hack-feature-options: --features opt --ignore-unknown-features
    uses: stellar/actions/.github/workflows/rust-publish-dry-run-v2.yml@main
    with:
      crates: stellar-rpc-client
      runs-on: ${{ matrix.os }}
      target: ${{ matrix.target }}
      cargo-hack-feature-options: ${{ matrix.cargo-hack-feature-options }}