name: macOS

on: [push, pull_request]

permissions:
  contents: read

jobs:

#  xcode_11:
#    strategy:
#      fail-fast: false
#      matrix:
#        xcode: ['11','12','13']
#    runs-on: macos-11
#
#    steps:
#      - uses: actions/checkout@v6
#        with:
#          submodules: recursive
#      - uses: maxim-lobanov/setup-xcode@v1
#        with:
#          xcode-version: ${{ matrix.xcode }}
#      - name: cmake
#        run: cmake -S . -B build -DJSONCONS_SANITIZE=ON -DCMAKE_BUILD_TYPE=Debug -DJSONCONS_BUILD_TESTS=On 
#      - name: build
#        working-directory: build/
#        run: cmake --build . 
#      - name: test
#        working-directory: build/
#        run: ctest --output-on-failure


#  xcode_12:
#    strategy:
#      fail-fast: false
#      matrix:
#        xcode: ['13','14']
#    runs-on: macos-12
#
#    steps:
#      - uses: actions/checkout@v6
#        with:
#          submodules: recursive
#      - uses: maxim-lobanov/setup-xcode@v1
#        with:
#          xcode-version: ${{ matrix.xcode }}
#      - name: cmake
#        run: cmake -S . -B build -DJSONCONS_SANITIZE=ON -DCMAKE_BUILD_TYPE=Debug -DJSONCONS_BUILD_TESTS=On 
#      - name: build
#        working-directory: build/
#        run: cmake --build . 
#      - name: test
#        working-directory: build/
#        run: ctest --output-on-failure

  xcode_2:

    runs-on: macos-latest

    steps:
    - uses: actions/checkout@v6
    - name: cmake
      run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DJSONCONS_BUILD_TESTS=On -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=ON
    - name: build
      run: cmake --build build --parallel 10
    - name: test
      run: cd build ; ctest -j 10 --output-on-failure

  xcode_3:

    runs-on: macos-latest

    steps:
    - uses: actions/checkout@v6
    - name: cmake
      run: cmake -S . -B build -DJSONCONS_SANITIZE=ON -DCMAKE_BUILD_TYPE=Debug -DJSONCONS_BUILD_TESTS=On -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=ON
    - name: build
      run: cmake --build build --parallel 10
    - name: test
      run: cd build ; ctest -j 10 --output-on-failure


  xcode_26:
    strategy:
      fail-fast: false
      matrix:
        xcode: ['26']
        build_type: [Debug, Release]
    runs-on: macos-latest

    steps:
      - uses: actions/checkout@v6
        with:
          submodules: recursive
      - uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: ${{ matrix.xcode }}
      - name: cmake
        run: cmake -S . -B build -DJSONCONS_SANITIZE=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DJSONCONS_BUILD_TESTS=On 
      - name: build
        working-directory: build/
        run: cmake --build . 
      - name: test
        working-directory: build/
        run: ctest --output-on-failure
          
