name: BACNet/SC macos/bsd tests

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - '*'

jobs:
  job_bsc_tests_macos:
    runs-on: macOS-latest
    steps:
    - uses: actions/checkout@v5
    - name: Create Build Environment
      run: |
        brew install openssl
        brew install libwebsockets
    - name: Build and run bsc_event test
      run: |
        cd ./test/ports/bsd/bsc_event
        mkdir build
        cd build
        cmake ..
        make
        ./test_bsc_event
    - name: Build and run bvlc-sc test
      run: |
        cd ./test/bacnet/datalink/bvlc-sc
        mkdir build
        cd build
        cmake ..
        make
        ./test_bvlc-sc
    - name: Build and run websockets test
      run: |
        cd ./test/bacnet/datalink/websockets
        mkdir build
        cd build
        cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3.0
        make
        ./test_websockets
    - name: Build and run bsc-socket test
      run: |
        cd ./test/bacnet/datalink/bsc-socket
        mkdir build
        cd build
        cmake ..
        make
        ./test_bsc-socket
    - name: Build and run hub-sc test
      run: |
        cd ./test/bacnet/datalink/hub-sc
        mkdir build
        cd build
        cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3.0
        make
        ./test_hub-sc
    - name: Build and run bsc-node test
      run: |
        cd ./test/bacnet/datalink/bsc-node
        mkdir build
        cd build
        cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3.0
        make
        ./test_bsc-node
    - name: Build and run bsc-datalink test
      run: |
        cd ./test/bacnet/datalink/bsc-datalink
        mkdir build
        cd build
        cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3.0
        make
        ./test_bsc-datalink
