# This config file is generated by ./scripts/gen_gh_actions.py.
# Do not edit by hand.

name: macOS CI

on:
  push:
    branches: [ dev, ci_travis ]
  pull_request:
    branches: [ dev ]

jobs:
  test-macos:
    runs-on: macos-15-intel
    strategy:
      fail-fast: false
      matrix:
        include:
          - env:
              CC: gcc
              CXX: g++
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --enable-debug
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --disable-stats
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --disable-libdl
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --enable-opt-safety-checks
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --with-lg-page=16
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"

    steps:
    - uses: actions/checkout@v4

    - name: Show OS version
      run: |
        echo "=== macOS Version ==="
        sw_vers
        echo ""
        echo "=== Architecture ==="
        uname -m
        arch
        echo ""
        echo "=== CPU Info ==="
        sysctl -n machdep.cpu.brand_string
        sysctl -n hw.machine

    - name: Install dependencies
      run: |
        brew install autoconf

    - name: Build and test
      env:
        CC: ${{ matrix.env.CC || 'gcc' }}
        CXX: ${{ matrix.env.CXX || 'g++' }}
        COMPILER_FLAGS: ${{ matrix.env.COMPILER_FLAGS }}
        CONFIGURE_FLAGS: ${{ matrix.env.CONFIGURE_FLAGS }}
        EXTRA_CFLAGS: ${{ matrix.env.EXTRA_CFLAGS }}
      run: |
        # Run autoconf
        autoconf

        # Configure with flags
        if [ -n "$COMPILER_FLAGS" ]; then
          ./configure CC="${CC} ${COMPILER_FLAGS}" CXX="${CXX} ${COMPILER_FLAGS}" $CONFIGURE_FLAGS
        else
          ./configure $CONFIGURE_FLAGS
        fi

        # Build
        make -j3
        make -j3 tests

        # Run tests
        make check


  test-macos-arm64:
    runs-on: macos-15
    strategy:
      fail-fast: false
      matrix:
        include:
          - env:
              CC: gcc
              CXX: g++
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --enable-debug
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --disable-stats
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --disable-libdl
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --enable-opt-safety-checks
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --with-lg-page=16
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-lg-page=16 --with-lg-hugepage=29"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"

    steps:
    - uses: actions/checkout@v4

    - name: Show OS version
      run: |
        echo "=== macOS Version ==="
        sw_vers
        echo ""
        echo "=== Architecture ==="
        uname -m
        arch
        echo ""
        echo "=== CPU Info ==="
        sysctl -n machdep.cpu.brand_string
        sysctl -n hw.machine

    - name: Install dependencies
      run: |
        brew install autoconf

    - name: Build and test
      env:
        CC: ${{ matrix.env.CC || 'gcc' }}
        CXX: ${{ matrix.env.CXX || 'g++' }}
        COMPILER_FLAGS: ${{ matrix.env.COMPILER_FLAGS }}
        CONFIGURE_FLAGS: ${{ matrix.env.CONFIGURE_FLAGS }}
        EXTRA_CFLAGS: ${{ matrix.env.EXTRA_CFLAGS }}
      run: |
        # Run autoconf
        autoconf

        # Configure with flags
        if [ -n "$COMPILER_FLAGS" ]; then
          ./configure CC="${CC} ${COMPILER_FLAGS}" CXX="${CXX} ${COMPILER_FLAGS}" $CONFIGURE_FLAGS
        else
          ./configure $CONFIGURE_FLAGS
        fi

        # Build
        make -j3
        make -j3 tests

        # Run tests
        make check



