name: Build and Test

on:
  push:
    branches:
      - main
  pull_request:

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

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

    - name: Set up dependencies
      run: |
          sudo apt-get update
          sudo apt-get install -y cmake build-essential meson ninja-build python3 python3-pip libgtest-dev
          pip install meson==1.6.0
          # Compile gtest manually for Ubuntu
          cd /usr/src/googletest/googletest && sudo cmake . && sudo make && sudo cp lib/*.a /usr/lib

    - name: Run build and tests
      run: ./mk

