libscmp 0.2.0

A safe, sane Rust interface to libseccomp on Linux.
Documentation
name: CI
on: [push, pull_request]

defaults:
  run:
    shell: bash

jobs:
  build-ubuntu:
    name: Build

    strategy:
      fail-fast: false

      matrix:
        toolchain: [stable, beta, nightly]
        target:
          - x86_64-unknown-linux-gnu
        os: [ubuntu-latest]
        features:
          - ''
          - libseccomp-2-4

    # Allow nightly builds to fail
    continue-on-error: ${{ matrix.toolchain == 'nightly' }}

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

    steps:
      - name: Set up repo
        uses: actions/checkout@v2
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          target: ${{ matrix.target }}

      - run: sudo apt-get update && sudo apt-get -y install libseccomp-dev

      - name: Build
        uses: actions-rs/cargo@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          command: build
          args: --verbose --target ${{ matrix.target }} --features "${{ matrix.features }}"

      - name: Run tests
        uses: actions-rs/cargo@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          command: test
          args: --verbose --target ${{ matrix.target }} --features "${{ matrix.features }}"

  build-alpine:
    name: Build

    strategy:
      fail-fast: false

      matrix:
        toolchain: [stable, beta, nightly]
        target:
          - x86_64-unknown-linux-musl
        os: ['alpine:latest']
        features:
          - ''
          - libseccomp-2-4
          - libseccomp-2-5

    # Allow nightly builds to fail
    continue-on-error: ${{ matrix.toolchain == 'nightly' }}

    runs-on: ubuntu-latest
    container: ${{ matrix.os }}

    defaults:
      run:
        shell: sh

    steps:
      - name: Set up repo
        uses: actions/checkout@v2

      - run: apk add gcc libseccomp-dev libseccomp-static

      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          target: ${{ matrix.target }}

      - name: Export compilation flags
        run: 'echo "RUSTFLAGS=-L /usr/lib" >>$GITHUB_ENV'

      - name: Build
        uses: actions-rs/cargo@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          command: build
          args: --verbose --target ${{ matrix.target }} --features "${{ matrix.features }}"

      - name: Run tests
        uses: actions-rs/cargo@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          command: test
          args: --verbose --target ${{ matrix.target }} --features "${{ matrix.features }}"

  coverage-tarpaulin-ubuntu:
    name: Tarpaulin

    strategy:
      fail-fast: false

      matrix:
        toolchain: [stable]
        target:
          - x86_64-unknown-linux-gnu
        os: [ubuntu-latest]
        features:
          - ''
          - libseccomp-2-4

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

    steps:
      - uses: actions/checkout@v2
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          target: ${{ matrix.target }}

      - run: sudo apt-get update && sudo apt-get -y install libseccomp-dev

      - name: Install tarpaulin
        uses: actions-rs/install@v0.1
        with:
          crate: cargo-tarpaulin
          version: latest
          use-tool-cache: true

      - name: Run tarpaulin
        uses: actions-rs/cargo@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          command: tarpaulin
          args: --verbose --out Xml --target ${{ matrix.target }} --features "${{ matrix.features }}"

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v1.0.13
        with:
          name: ${{ matrix.toolchain }}-${{ matrix.target }}
          fail_ci_if_error: true
          env_vars: OS,TARGET,TOOLCHAIN,JOB
        env:
          JOB: ${{ github.job }}
          OS: ${{ matrix.os }}
          TARGET: ${{ matrix.target }}
          TOOLCHAIN: ${{ matrix.toolchain }}
          FEATURES: ${{ matrix.features }}

  coverage-tarpaulin-debian:
    name: Tarpaulin

    strategy:
      fail-fast: false

      matrix:
        toolchain: [stable]
        target:
          - x86_64-unknown-linux-gnu
        os: ['debian:testing']
        features:
          - ''
          - libseccomp-2-5

    runs-on: ubuntu-latest
    container:
      image: ${{ matrix.os }}
      options: '--security-opt seccomp=unconfined'

    steps:
      - uses: actions/checkout@v2

      - run: 'apt-get update && apt-get -y install curl gcc libssl-dev pkg-config libseccomp-dev'

      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          target: ${{ matrix.target }}

      - name: Install tarpaulin
        uses: actions-rs/cargo@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          command: install
          args: cargo-tarpaulin

      - name: Run tarpaulin
        uses: actions-rs/cargo@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          command: tarpaulin
          args: --verbose --out Xml --target ${{ matrix.target }} --features "${{ matrix.features }}"

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v1.0.13
        with:
          name: ${{ matrix.toolchain }}-${{ matrix.target }}
          fail_ci_if_error: true
          env_vars: OS,TARGET,TOOLCHAIN,JOB
        env:
          JOB: ${{ github.job }}
          OS: ${{ matrix.os }}
          TARGET: ${{ matrix.target }}
          TOOLCHAIN: ${{ matrix.toolchain }}
          FEATURES: ${{ matrix.features }}