name: cbindgen

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  rustfmt:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

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

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

  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

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

    - name: Build
      run: |
        cargo build --verbose

    - name: Build no-default-features
      run: |
        cargo build --verbose --no-default-features

    - name: Test
      env:
        CBINDGEN_TEST_VERIFY: 1
      run: |
        cargo test --verbose

    - name: Cargo update minimal-versions
      run: |
        cargo update -Zminimal-versions

    - name: Test minimal-versions
      run: |
        cargo test

name: cbindgen

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  rustfmt:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

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

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

    - name: Install minimum supported Rust version
      uses: actions-rs/toolchain@v1
      with:
        profile: minimal
        toolchain: 1.40.0

    - name: Build with minimum supported Rust version
      run: |
        cargo +1.40.0 build --verbose

  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

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

    - name: Build
      run: |
        cargo build --verbose

    - name: Build no-default-features
      run: |
        cargo build --verbose --no-default-features

    - name: Test
      env:
        CBINDGEN_TEST_VERIFY: 1
      run: |
        cargo test --verbose

    - name: Cargo update minimal-versions
      run: |
        cargo update -Zminimal-versions

    - name: Test minimal-versions
      run: |
        cargo test

Add a minimum version check
CI: Add a minimum version check
