ci.yml 2.75 KiB
Newer Older
name: Continuous integration

  push:
    branches:
      - master
  pull_request:
    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

      - name: Check rustdoc links
        run: RUSTDOCFLAGS="--deny broken_intra_doc_links" cargo doc --verbose --workspace --no-deps --document-private-items

  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 all targets
        uses: actions-rs/cargo@v1
        with:
          command: check
      - name: Cargo check HTTP client with tokio02
        uses: actions-rs/cargo@v1
        with:
          command: check
          args: --manifest-path http-client/Cargo.toml --no-default-features --features tokio02

  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