on:
  - push
  - pull_request

name: Cargo Build and Test

jobs:
  test:
    runs-on: ubuntu-latest
    steps:

      - name: Checkout libkcapi-sys and Submodules
        uses: actions/checkout@v2
        with:
          submodules: recursive

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

      - name: install autotools
        run: |
          sudo apt-get install -y autotools-dev autoconf llvm-dev
          export LLVM_CONFIG_PATH="/usr/bin/llvm-config"

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

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

      - 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: -- -D warnings