name: macOs build

on:
  push:
    branches: [ main, develop, 1.* ]
    tags: 1.*
    
  pull_request:
    branches: [ main, develop, 1.* ]

jobs:
  build:
    runs-on: macos-latest

    strategy:
      matrix:
        qt: ['6.4.3', '6.5.3', '6.6.3', '6.7.3', '6.8.0']

    steps:
    - uses: actions/checkout@v2

    - name: Installing PostgreSQL
      uses: tj-actions/install-postgresql@v3
      with:
        postgresql-version: 16
      
    - name: Installing Qt framework
      uses: jurplel/install-qt-action@v3
      with:
        version: ${{ matrix.qt }}

    - name: Running qmake
      run:  cd $GITHUB_WORKSPACE; qmake pgmodeler.pro -r PREFIX=/Applications/pgModeler.app/Contents PGSQL_INC=`pg_config --includedir` PGSQL_LIB=`pg_config --libdir`/libpq.dylib CONFIG+=debug
    
    - name: Building pgModeler
      run: make -j6
     
    - name: Deploying pgModeler
      run: make install
