udev 0.9.3

libudev bindings for Rust
Documentation
name: Build
on:
  push:
    branches:
      - master
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+'
  pull_request:

jobs:
  format:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Setup Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          components: rustfmt
          default: true
          override: true
      - name: Cargo cache
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
          key: ${{ runner.os }}-cargo-rust_stable-${{ hashFiles('**/Cargo.toml') }}
      - name: Format
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --all -- --check

  doc:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Setup Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          components: rust-docs
          default: true
          override: true
      - name: Install libudev
        run:  sudo apt-get install -y libudev-dev
      - name: Cargo cache
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
          key: ${{ runner.os }}-cargo-rust_stable-${{ hashFiles('**/Cargo.toml') }}
      - name: Documentation
        uses: actions-rs/cargo@v1
        env:
          DOCS_RS: 1
        with:
          command: doc
          args: --features hwdb

  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
        with:
          submodules: true
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          components: clippy
          default: true
          override: true
      - name: Install libudev
        run:  sudo apt-get install -y libudev-dev
      - name: Cargo cache
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
          key: ${{ runner.os }}-cargo-rust_stable-${{ hashFiles('**/Cargo.toml') }}
      - name: Build cache
        uses: actions/cache@v2
        with:
          path: target
          key: ${{ runner.os }}-build-rust_stable-check-${{ hashFiles('**/Cargo.toml') }}
      - uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --all --features hwdb

  check-minimal:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
        with:
          submodules: true
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          profile: minimal
          default: true
          override: true
      - name: Install libudev
        run:  sudo apt-get install -y libudev-dev
      - name: Cargo cache
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
          key: ${{ runner.os }}-cargo-rust_nightly-${{ hashFiles('**/Cargo.toml') }}
      - name: Build cache
        uses: actions/cache@v2
        with:
          path: target
          key: ${{ runner.os }}-build-rust_nightly-check-minimal-${{ hashFiles('**/Cargo.toml') }}
      - uses: actions-rs/cargo@v1
        with:
          command: check
          args: --all --features hwdb -Z minimal-versions

  test:
    needs:
      - format
      - doc
      - check
      - check-minimal
    strategy:
      fail-fast: ${{ startsWith(github.ref, 'refs/tags/') }}
      matrix:
        rust: [stable, beta, nightly]
        features:
          - --no-default-features
          - --no-default-features --features "mio06"
          - --no-default-features --features "mio07"
          - --no-default-features --features "mio08"
          - --no-default-features --features "mio10"
          - --no-default-features --features "hwdb"
          - '' # default
        include:
          - rust: stable
          - rust: beta
          - rust: nightly
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          profile: minimal
          default: true
          override: true
      - name: Install libudev
        run:  sudo apt-get install -y libudev-dev
      - name: Cargo cache
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
          key: ${{ runner.os }}-cargo-rust_stable-${{ hashFiles('**/Cargo.toml') }}
      - name: Build cache
        uses: actions/cache@v2
        with:
          path: target
          key: ${{ runner.os }}-build-rust_stable-check-${{ hashFiles('**/Cargo.toml') }}
      - name: Update deps
        uses: actions-rs/cargo@v1
        with:
          command: update
      - name: Test
        uses: actions-rs/cargo@v1
        env:
          RUST_BACKTRACE: full
        with:
          command: test
          args: --all ${{ matrix.features }}

  publish:
    if: github.repository == 'Smithay/udev-rs' && startsWith(github.ref, 'refs/tags/')
    needs:
      - format
      - doc
      - check
      - check-minimal
      - test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Setup Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
      - name: Install libudev
        run:  sudo apt-get install -y libudev-dev
      - name: Publish crates
        uses: katyo/publish-crates@v1
        with:
          registry-token: ${{ secrets.CRATES_TOKEN }}