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

name: Linux CI

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

jobs:
  test-linux:
    runs-on: ubuntu-24.04
    strategy:
      fail-fast: false
      matrix:
        include:
          - env:
              CC: gcc
              CXX: g++
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: clang
              CXX: clang++
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --enable-debug
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --enable-prof
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --disable-stats
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --disable-libdl
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --enable-opt-safety-checks
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --with-lg-page=16
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --enable-prof-frameptr"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: clang
              CXX: clang++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: clang
              CXX: clang++
              CONFIGURE_FLAGS: --enable-debug
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: clang
              CXX: clang++
              CONFIGURE_FLAGS: --enable-prof
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: clang
              CXX: clang++
              CONFIGURE_FLAGS: --disable-stats
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: clang
              CXX: clang++
              CONFIGURE_FLAGS: --disable-libdl
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: clang
              CXX: clang++
              CONFIGURE_FLAGS: --enable-opt-safety-checks
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: clang
              CXX: clang++
              CONFIGURE_FLAGS: --with-lg-page=16
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: clang
              CXX: clang++
              CONFIGURE_FLAGS: "--enable-prof --enable-prof-frameptr"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: clang
              CXX: clang++
              CONFIGURE_FLAGS: "--with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: clang
              CXX: clang++
              CONFIGURE_FLAGS: "--with-malloc-conf=dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: clang
              CXX: clang++
              CONFIGURE_FLAGS: "--with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: clang
              CXX: clang++
              CONFIGURE_FLAGS: "--with-malloc-conf=background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              CONFIGURE_FLAGS: --enable-debug
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              CONFIGURE_FLAGS: --enable-prof
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              CONFIGURE_FLAGS: --disable-stats
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              CONFIGURE_FLAGS: --disable-libdl
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              CONFIGURE_FLAGS: --enable-opt-safety-checks
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              CONFIGURE_FLAGS: --with-lg-page=16
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              CONFIGURE_FLAGS: "--enable-prof --enable-prof-frameptr"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              CONFIGURE_FLAGS: "--with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              CONFIGURE_FLAGS: "--with-malloc-conf=dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              CONFIGURE_FLAGS: "--with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CROSS_COMPILE_32BIT: yes
              COMPILER_FLAGS: -m32
              CONFIGURE_FLAGS: "--with-malloc-conf=background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --enable-prof"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --disable-stats"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --disable-libdl"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --enable-opt-safety-checks"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --with-lg-page=16"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --enable-prof --enable-prof-frameptr"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --with-malloc-conf=dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --with-malloc-conf=background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --disable-stats"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --disable-libdl"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --enable-opt-safety-checks"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --with-lg-page=16"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --enable-prof --enable-prof-frameptr"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --with-malloc-conf=dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --with-malloc-conf=background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-stats --disable-libdl"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-stats --enable-opt-safety-checks"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-stats --with-lg-page=16"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-stats --enable-prof --enable-prof-frameptr"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-stats --with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-stats --with-malloc-conf=dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-stats --with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-stats --with-malloc-conf=background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-libdl --enable-opt-safety-checks"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-libdl --with-lg-page=16"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-libdl --enable-prof --enable-prof-frameptr"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-libdl --with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-libdl --with-malloc-conf=dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-libdl --with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--disable-libdl --with-malloc-conf=background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-opt-safety-checks --with-lg-page=16"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-opt-safety-checks --enable-prof --enable-prof-frameptr"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-opt-safety-checks --with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-opt-safety-checks --with-malloc-conf=dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-opt-safety-checks --with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-opt-safety-checks --with-malloc-conf=background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-lg-page=16 --enable-prof --enable-prof-frameptr"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-lg-page=16 --with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-lg-page=16 --with-malloc-conf=dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-lg-page=16 --with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-lg-page=16 --with-malloc-conf=background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --enable-prof-frameptr --with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --enable-prof-frameptr --with-malloc-conf=dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --enable-prof-frameptr --with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --enable-prof-frameptr --with-malloc-conf=background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=tcache:false,dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=tcache:false,percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=tcache:false,background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=dss:primary,percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=dss:primary,background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=percpu_arena:percpu,background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --disable-cache-oblivious --enable-stats --enable-log --enable-prof"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-debug --enable-experimental-smallocx --enable-stats --enable-prof"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"

    steps:
    - uses: actions/checkout@v4

    - name: Show OS version
      run: |
        echo "=== System Information ==="
        uname -a
        echo ""
        echo "=== Architecture ==="
        uname -m
        arch
        echo ""
        echo "=== OS Release ==="
        cat /etc/os-release || true
        echo ""
        echo "=== CPU Info ==="
        lscpu | grep -E "Architecture|CPU op-mode|Byte Order|CPU\(s\):" || true

    - name: Install dependencies (32-bit)
      if: matrix.env.CROSS_COMPILE_32BIT == 'yes'
      run: |
        sudo dpkg --add-architecture i386
        sudo apt-get update
        sudo apt-get install -y gcc-multilib g++-multilib libc6-dev-i386

    - name: Build and test
      env:
        CC: ${{ matrix.env.CC }}
        CXX: ${{ matrix.env.CXX }}
        COMPILER_FLAGS: ${{ matrix.env.COMPILER_FLAGS }}
        CONFIGURE_FLAGS: ${{ matrix.env.CONFIGURE_FLAGS }}
        EXTRA_CFLAGS: ${{ matrix.env.EXTRA_CFLAGS }}
      run: |
        # Verify the script generates the same output
        ./scripts/gen_gh_actions.py > gh_actions_script.yml

        # 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-linux-arm64:
    runs-on: ubuntu-24.04-arm
    strategy:
      fail-fast: false
      matrix:
        include:
          - env:
              CC: gcc
              CXX: g++
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: clang
              CXX: clang++
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --enable-debug
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --enable-prof
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --disable-stats
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --disable-libdl
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --enable-opt-safety-checks
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: --with-lg-page=16
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-lg-page=16 --with-lg-hugepage=29"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--enable-prof --enable-prof-frameptr"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=tcache:false"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=dss:primary"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=percpu_arena:percpu"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"
          - env:
              CC: gcc
              CXX: g++
              CONFIGURE_FLAGS: "--with-malloc-conf=background_thread:true"
              EXTRA_CFLAGS: "-Werror -Wno-array-bounds"

    steps:
    - uses: actions/checkout@v4

    - name: Show OS version
      run: |
        echo "=== System Information ==="
        uname -a
        echo ""
        echo "=== Architecture ==="
        uname -m
        arch
        echo ""
        echo "=== OS Release ==="
        cat /etc/os-release || true
        echo ""
        echo "=== CPU Info ==="
        lscpu | grep -E "Architecture|CPU op-mode|Byte Order|CPU\(s\):" || true

    - name: Install dependencies (32-bit)
      if: matrix.env.CROSS_COMPILE_32BIT == 'yes'
      run: |
        sudo dpkg --add-architecture i386
        sudo apt-get update
        sudo apt-get install -y gcc-multilib g++-multilib libc6-dev-i386

    - name: Build and test
      env:
        CC: ${{ matrix.env.CC }}
        CXX: ${{ matrix.env.CXX }}
        COMPILER_FLAGS: ${{ matrix.env.COMPILER_FLAGS }}
        CONFIGURE_FLAGS: ${{ matrix.env.CONFIGURE_FLAGS }}
        EXTRA_CFLAGS: ${{ matrix.env.EXTRA_CFLAGS }}
      run: |
        # Verify the script generates the same output
        ./scripts/gen_gh_actions.py > gh_actions_script.yml

        # 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



