lnbits_rust 0.2.1

A Rust library for the LNbits API
Documentation
name: CI

on:
  workflow_call:
  push:

env:
  RUST_BACKTRACE: 1
  WALLET_1_ID: "${{ secrets.WALLET_1_ID }}"
  WALLET_2_ID: "${{ secrets.WALLET_2_ID }}"
  WALLET_1_ADMIN_KEY: "${{ secrets.WALLET_1_ADMIN_KEY }}"
  WALLET_2_ADMIN_KEY: "${{ secrets.WALLET_2_ADMIN_KEY }}"
  WALLET_1_INVOICE_READ_KEY: "${{ secrets.WALLET_1_INVOICE_READ_KEY }}"
  WALLET_2_INVOICE_READ_KEY: "${{ secrets.WALLET_2_INVOICE_READ_KEY }}"
  LNBITS_URL: "http://${{ secrets.LNBITS_URL }}.onion"
  LNBITS_TOR_SOCKET: "socks5h://127.0.0.1:9050"

jobs:
  ci-pass:
    name: CI is green
    runs-on: ubuntu-latest
    needs:
      - style
      - test
      - docs
    steps:
      - run: exit 0

  style:
    name: Check Style

    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3
        if: github.event_name == 'pull_request_target'
        with:
          ref: ${{ github.ref }}
      - uses: actions/checkout@v3
        if: github.event_name != 'pull_request_target'

      - name: Install rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          components: rustfmt
          profile: minimal
          override: true

      - name: cargo fmt -- --check
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: -- --check

      - name: temporary workaround - fmt all files under src
        run: cargo fmt -- --check $(find . -name '*.rs' -print)

  test:
    name: ${{ matrix.name }}
    needs: [style]

    runs-on: ${{ matrix.os || 'ubuntu-latest' }}

    strategy:
      matrix:
        name:
          - linux / stable

        include:
          - name: linux / stable

    steps:
      - name: Checkout
        uses: actions/checkout@v1

      - uses: tor-actions/setup-tor@main
        with:
          daemon: true

      - name: Install rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust || 'stable' }}
          target: ${{ matrix.target }}
          profile: minimal
          override: true

      - name: Test
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: -- --test-threads=1

  docs:
    name: Docs
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          override: true

      - name: Check documentation
        env:
          RUSTDOCFLAGS: -D warnings
        uses: actions-rs/cargo@v1
        with:
          command: doc
          args: --no-deps --document-private-items --all-features