name: Build with OpenSSL
on:
  push:
    branches:
    - master
  pull_request:
jobs:
  build-linux:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: install packages
      run: sudo apt update && sudo apt install libssl-dev libsrtp2-dev
    - name: submodules
      run: git submodule update --init --recursive --depth 1
    - name: cmake
      run: cmake -B build -DUSE_GNUTLS=0 -DUSE_SYSTEM_SRTP=1 -DWARNINGS_AS_ERRORS=1
    - name: make
      run: (cd build; make -j2)
    - name: test
      run: ./build/tests
  build-macos:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - name: install packages
      run: HOMEBREW_NO_INSTALL_CLEANUP=1 brew reinstall openssl@3
    - name: submodules
      run: git submodule update --init --recursive --depth 1
    - name: cmake
      run: cmake -B build -DUSE_GNUTLS=0 -WARNINGS_AS_ERRORS=1 -DENABLE_LOCAL_ADDRESS_TRANSLATION=1
      env:
        OPENSSL_ROOT_DIR: /usr/local/opt/openssl@1.1
    - name: make
      run: (cd build; make -j2)
    - name: test
      run: ./build/tests
  build-windows:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2
    - uses: ilammy/msvc-dev-cmd@v1
    - name: install packages
      run: choco install openssl --version=3.1.1
    - name: submodules
      run: git submodule update --init --recursive --depth 1
    - name: cmake
      run: cmake -B build -G "NMake Makefiles" -DUSE_GNUTLS=0 -DWARNINGS_AS_ERRORS=1
    - name: nmake
      run: |
        cd build
        set CL=/MP
        nmake
    - name: test
      run: |
        cd build
        ./tests

