name: Build and Test

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  build-and-test-ubuntu:
    strategy:
      matrix:
        os: [ubuntu-24.04]
    runs-on: ${{ matrix.os }}

    steps:
    - name: Checkout code
      uses: actions/checkout@v3

    - name: Set GCC 13 as default
      run: |
        sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 --slave /usr/bin/g++ g++ /usr/bin/g++-13

    - name: Verify GCC Version
      run: gcc --version # Should output 13.x if alternatives were updated, or check gcc-13 --version

    - name: Set up dependencies
      run: |
          sudo apt-get update
          sudo apt-get install -y python3 python3-pip
    
    - name: Install Dependencies and Build
      run: |
          yes | ./mk

    - name: Run Tests
      run: |
          source ~/.4DSSE_env/bin/activate
          meson test -C build

