ci.yml 2.56 KiB
Newer Older
name: Continuous integration

on:
  pull_request:
  push:
    branches:
      - master

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

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

      - name: Cache Dependencies & Build Outputs
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

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

      - name: Cargo clippy
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: -- -A clippy::mutable_key_type

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

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

      - name: Cache Dependencies & Build Outputs
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Cargo check no-default-features
        uses: actions-rs/cargo@v1
        with:
          command: check
          args: --benches --tests

        uses: actions-rs/cargo@v1
        with:
          command: check
          args: --benches --tests --all-features

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

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

      - name: Cache Dependencies & Build Outputs
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Cargo build
        uses: actions-rs/cargo@v1
        with:
          command: build
          args: --workspace

      - name: Cargo test
        uses: actions-rs/cargo@v1
        with:
          command: test