chekov 0.1.1

CQRS/ES Framework
on: [push, pull_request]

name: CI

jobs:
  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

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


      - run: docker-compose -f tests/docker-compose.yml run -d -p 5432:5432 postgres
      - run: sleep 10

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

  test:
    name: Test Suite
    runs-on: ubuntu-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

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

      - run: docker-compose -f tests/docker-compose.yml run -d -p 5432:5432 postgres
      - run: sleep 10

      - name: Run cargo test
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --all

  doc:
    name: Doc - build the documentation
    runs-on: ubuntu-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

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

      - run: docker-compose -f tests/docker-compose.yml run -d -p 5432:5432 postgres
      - run: sleep 10

      - run: cargo doc --no-deps --all --exclude bank
      - uses: actions/upload-artifact@v1
        with:
          name: doc
          path: target/doc

  publish:
    name: Publish
    needs: [doc, check, test]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Download doc
        uses: actions/download-artifact@v1
        with:
          name: doc

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./doc

  coverage:
    name: Coverage
    runs-on: ubuntu-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          override: true

      - run: docker-compose -f tests/docker-compose.yml run -d -p 5432:5432 postgres
      - run: sleep 10

      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: --all-features --no-fail-fast --all
        env:
          CARGO_INCREMENTAL: '0'
          RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests'
          RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests'

      - id: coverage
        uses: actions-rs/grcov@v0.1

      - name: Coveralls GitHub Action
        uses: coverallsapp/github-action@v1.1.1
        with:
          github-token: ${{ secrets.github_token }}
          path-to-lcov: ${{ steps.coverage.outputs.report }}