name: Build
on: [push, pull_request]
env:
  BUILD_TYPE: Release
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true

      - name: Apt update
        run: sudo apt-get update

      - name: Install dependencies
        run: sudo apt-get install doxygen libsnmp-dev

      - name: Configure
        shell: bash
        run: |
          cmake -E make_directory ${{github.workspace}}/build
          cmake -B ${{github.workspace}}/build -S ${{github.workspace}} \
             -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
             -DPNET_OPTION_SNMP=ON

      - name: Build
        shell: bash
        run: |
          cmake --build ${{github.workspace}}/build --target all docs install -j4

      - name: Test
        shell: bash
        run: |
          cmake --build ${{github.workspace}}/build --target check
