# This GitHub Actions workflow will install Python dependencies and run tests for PyImfit
# with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: PyImfit CI

on:
  push:
    branches: [ master ]
#  pull_request:
#    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        # use quotes to avoid YAML processor interpreting version numbers as *numbers*
        # and e.g. trying to turn 3.10 into 3.1
        # NOTE that we currently do *not* test with Python 3.12, since that breaks the
        # pip version we need to use (see below)
        python-version: ['3.10', '3.11', '3.12']
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v5
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install flake8 astropy pytest scons
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
        python -c "import setuptools; print(setuptools.__version__)"
    - name: Build and test import of package
      run: |
        python -m pip install -e .
        python -c "import pyimfit"  
    - name: Test with pytest
      run: |
        cd pyimfit/tests ; pytest
