dynarust 0.3.3

A DynamoDB odm library for rust
Documentation
name: Test/Lint/Release

permissions:
  contents: write

on:
  pull_request:
  push:
    branches:
      - main

jobs:
  clippy:
    if: ${{ !startsWith(github.event.head_commit.message, 'tag') }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

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

      - name: Cache
        uses: Swatinem/rust-cache@v2

      - name: Clippy
        run: cargo clippy --all

  test:
    if: ${{ !startsWith(github.event.head_commit.message, 'tag') }}
    runs-on: ubuntu-latest
    services:
      dynamo:
        image: amazon/dynamodb-local:1.22.0
        ports:
          - 8000:8000
    steps:
      - uses: actions/checkout@v3

      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
          components: llvm-tools-preview

      - name: Cache
        uses: Swatinem/rust-cache@v2

      - name: Install Grcov
        run: cargo install grcov

      - name: Run tests
        run: cargo test --all --no-fail-fast
        env:
          RUSTFLAGS: '-C instrument-coverage'
          LLVM_PROFILE_FILE: 'report-%p-%m.profraw'

      - name: Run grcov
        run: grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore 'target/**' --ignore '../**' --ignore '/*' -o coverage.lcov

      - name: Coveralls upload
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          path-to-lcov: coverage.lcov
  Release:
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    needs:
      - test
      - clippy
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: '0' # https://github.com/actions/checkout/issues/217

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

      - name: Cache
        uses: Swatinem/rust-cache@v2

      - name: Install bump tool
        run: cargo install cargo-workspaces

      - name: Tag and Release
        run: |
          SEM_VER=$(.github/semver.sh)
          cargo workspaces version $SEM_VER -y --no-git-commit
          
          version=`grep '^version = ' Cargo.toml | sed 's/version = //; s/\"//; s/\"//'`
          git config user.name github-actions
          git config user.email github-actions@github.com
          git add .
          git commit -m "tag: v$version" 
          git tag "v$version"
          git push
          git push --tags
          gh release create "v$version"
        env:
          GH_TOKEN: ${{ github.token }}
      - name: Publish
        run: cargo publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}