actix-telepathy 0.7.0

Cluster extension for the actix actor framework
Documentation
name: Rust

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main, develop ]

env:
  CARGO_TERM_COLOR: always

jobs:
  clippy:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - uses: actions/cache@v3
        with:
          path: ~/.cargo/registry
          key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
      - uses: actions/cache@v3
        with:
          path: ~/.cargo/git
          key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
      - uses: actions/cache@v3
        with:
          path: target
          key: '${{ runner.os }}-cargo-build-target-${{ hashFiles(''**/Cargo.lock'') }}'
      - uses: actions-rs/cargo@v1
        with:
          command: clippy

  fmt:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - uses: actions/cache@v3
        with:
          path: ~/.cargo/registry
          key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
      - uses: actions/cache@v3
        with:
          path: ~/.cargo/git
          key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
      - uses: actions/cache@v3
        with:
          path: target
          key: '${{ runner.os }}-cargo-build-target-${{ hashFiles(''**/Cargo.lock'') }}'
      - uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: '--all --check'

  test:
    runs-on: ubuntu-latest
    needs: [clippy, fmt]

    steps:
      - uses: actions/checkout@v3
      - uses: actions/cache@v3
        with:
          path: ~/.cargo/registry
          key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
      - uses: actions/cache@v3
        with:
          path: ~/.cargo/git
          key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
      - uses: actions/cache@v3
        with:
          path: target
          key: '${{ runner.os }}-cargo-build-target-${{ hashFiles(''**/Cargo.lock'') }}'
      - uses: actions-rs/cargo@v1
        with:
          command: test

  deploy:
    runs-on: ubuntu-latest
    needs: test
    if: github.ref_name == 'main' && github.event_name == 'push'
    steps:
      - uses: actions/checkout@v3
      - uses: actions/cache@v3
        with:
          path: ~/.cargo/registry
          key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
      - uses: actions/cache@v3
        with:
          path: ~/.cargo/git
          key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
      - uses: actions/cache@v3
        with:
          path: target
          key: '${{ runner.os }}-cargo-build-target-${{ hashFiles(''**/Cargo.lock'') }}'
      - name: Publish actix_telepathy_derive (if not already published)
        run: |
          VERSION=$(cargo metadata --no-deps --manifest-path actix-telepathy-derive/Cargo.toml --format-version 1 | jq -r '.packages[0].version')
          if curl -sf "https://crates.io/api/v1/crates/actix_telepathy_derive/${VERSION}" > /dev/null; then
            echo "actix_telepathy_derive ${VERSION} already published, skipping"
          else
            cargo publish --token ${{ secrets.CRATES_TOKEN }} --manifest-path actix-telepathy-derive/Cargo.toml
            sleep 20 # wait for actix_telepathy_derive to propagate on crates.io
          fi
      - uses: actions-rs/cargo@v1
        with:
          command: publish
          args: --token ${{ secrets.CRATES_TOKEN }}