inline-c 0.1.8

Write and execute C code inside Rust
Documentation
name: Build and Test

on: [push]

jobs:
  # The `test` job.
  test:
    name: Test (stable)

    strategy:
      matrix:
        target: [
          ubuntu-latest,
          macos-latest,
          windows-latest
        ]
      fail-fast: false

    runs-on: ${{ matrix.target }}

    steps:
      - name: Check out code
        uses: actions/checkout@v2

      - name: Set up Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          default: true
          override: true

      - name: Cache Cargo registry
        uses: actions/cache@v1
        with:
          path: ~/.cargo/registry
          key: ${{ matrix.target }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache Cargo bin
        uses: actions/cache@v1
        with:
          path: ~/.cargo/bin
          key: ${{ matrix.target }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache Cargo build
        uses: actions/cache@v1
        with:
          path: target
          key: ${{ matrix.target }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

      - name: Run the tests
        shell: bash
        run: |
          cargo build --release
          cargo test --release -- --nocapture

      - name: Check leftover files
        shell: bash --noprofile --norc {0}
        run: test $(git ls-files --exclude-standard --others | tee /dev/stderr | wc -l) -eq 0

  # The `test-nightly` job.
  test-nightly:
    name: Test (nightly)

    strategy:
      matrix:
        target: [
          ubuntu-latest,
          macos-latest,
          windows-latest
        ]
      fail-fast: false

    runs-on: ${{ matrix.target }}

    steps:
      - name: Check out code
        uses: actions/checkout@v2

      - name: Set up Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          default: true
          override: true

      - name: Cache Cargo registry
        uses: actions/cache@v1
        with:
          path: ~/.cargo/registry
          key: ${{ matrix.target }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache Cargo bin
        uses: actions/cache@v1
        with:
          path: ~/.cargo/bin
          key: ${{ matrix.target }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache Cargo build
        uses: actions/cache@v1
        with:
          path: target
          key: ${{ matrix.target }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

      - name: Run the tests
        shell: bash
        run: |
          cargo build --release
          cargo test --release -- --nocapture

      - name: Check leftover files
        shell: bash --noprofile --norc {0}
        run: test $(git ls-files --exclude-standard --others | tee /dev/stderr | wc -l) -eq 0

  # The `clippy` job.
  clippy:
    name: Clippy

    runs-on: ubuntu-latest

    steps:
      - name: Check out code
        uses: actions/checkout@v2

      - name: Set up Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          components: clippy
          override: true

      - name: Run Clippy
        uses: actions-rs/clippy@master
        with:
          args: --all-features --all-targets --workspace