name: Linux
on: [push, pull_request]
env:
  BUILD_TYPE: Release
jobs:
  Build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        fips: [ON, OFF]
        system_ssl: [ON, OFF]
        exclude:
          - system_ssl: ON
            fips: ON
    steps:
      - name: Setup cmake
        uses: jwlawson/actions-setup-cmake@v1.13.1
      - name: Setup Ninja
        run: sudo apt-get install ninja-build
      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: true
      - name: Configure CMake
        run: |
          cmake -B ${{github.workspace}}/build \
          -DBUILD_TESTS=true \
          -DBUILD_JAVA=true \
          -DSYSTEM_OPENSSL=${{matrix.system_ssl}} \
          -DFIPS=${{matrix.fips}} \
          -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
          -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
      - name: Build
        working-directory: ${{github.workspace}}/build
        run: make
      - name: Test
        working-directory: ${{github.workspace}}/build
        run: NO_KDF="true" ctest --output-on-failure -C ${{env.BUILD_TYPE}}
      - name: Install
        working-directory: ${{github.workspace}}/build
        run: sudo make install
